Search in sources :

Example 6 with FunctionTable

use of com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable in project aic-praise by aic-sri-international.

the class UAIModelReader method createFunctionTable.

private static FunctionTable createFunctionTable(List<Integer> variableCardinalities, BufferedReader br) throws IOException {
    // For each factor table, first the number of entries is given (this should be equal to the product
    // of the domain sizes of the variables in the scope). Then, one by one, separated by whitespace,
    // the values for each assignment to the variables in the function's scope are enumerated.
    String[] entryLineEntries = split(readLine(br));
    int numberEntries = Integer.parseInt(entryLineEntries[0]);
    List<Double> entries = new ArrayList<Double>();
    // Handle table entries on the same line as the #entries information.
    if (entryLineEntries.length > 1) {
        for (int i = 1; i < entryLineEntries.length; i++) {
            entries.add(Double.parseDouble(entryLineEntries[i]));
        }
    }
    while (entries.size() < numberEntries) {
        String[] entryValues = split(readLine(br));
        for (String entry : entryValues) {
            entries.add(Double.parseDouble(entry));
        }
    }
    FunctionTable result = new FunctionTable(variableCardinalities, entries);
    return result;
}
Also used : FunctionTable(com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable) ArrayList(java.util.ArrayList)

Example 7 with FunctionTable

use of com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable in project aic-praise by aic-sri-international.

the class TransformMarkovToBayes method sumOutChildAndCreateCPT.

private static Pair<FactorTable, ConditionalProbabilityTable> sumOutChildAndCreateCPT(MarkovNetwork markov, Integer c, FactorTable cFactor) {
    List<Integer> parentVarIdxs = new ArrayList<>(cFactor.getVariableIndexes());
    parentVarIdxs.remove(c);
    int cCardinality = markov.cardinality(c);
    int cIdx = cFactor.getVariableIndexes().indexOf(c);
    FactorTable summedOut = null;
    FunctionTable cptTable = null;
    if (parentVarIdxs.size() == 0) {
        // No summed out factor as no remaining elements but still need to ensure the cpt values are normalized
        int idx = 0;
        List<Double> factorEntries = cFactor.getTable().getEntries();
        List<Double> cptEntries = new ArrayList<>(factorEntries.size());
        while (idx < factorEntries.size()) {
            double total = 0;
            for (int i = 0; i < cCardinality; i++) {
                total += factorEntries.get(idx + i);
            }
            for (int i = 0; i < cCardinality; i++) {
                cptEntries.add(factorEntries.get(idx + i) / total);
            }
            idx += cCardinality;
        }
        cptTable = new FunctionTable(Arrays.asList(cCardinality), cptEntries);
    } else {
        List<Integer> cptCardinalities = new ArrayList<>();
        List<Integer> parentVarCardinalities = new ArrayList<>();
        Map<Integer, Integer> parentCardIdxToCFactorIdx = new LinkedHashMap<>();
        int cFactorCardIdx = 0;
        for (Integer varIdx : cFactor.getVariableIndexes()) {
            if (!varIdx.equals(c)) {
                int card = markov.cardinality(varIdx);
                cptCardinalities.add(card);
                parentVarCardinalities.add(card);
                parentCardIdxToCFactorIdx.put(parentCardIdxToCFactorIdx.size(), cFactorCardIdx);
            }
            cFactorCardIdx++;
        }
        // The child index will be placed at the end of the table by convention
        cptCardinalities.add(markov.cardinality(c));
        List<Double> cptEntries = new ArrayList<>(FunctionTable.numEntriesFor(cptCardinalities));
        List<Double> parentSummedOutEntries = new ArrayList<>(FunctionTable.numEntriesFor(parentVarCardinalities));
        Map<Integer, Integer> assignmentMap = new LinkedHashMap<>();
        CartesianProductEnumeration<Integer> cpe = new CartesianProductEnumeration<>(FunctionTable.cardinalityValues(parentVarCardinalities));
        while (cpe.hasMoreElements()) {
            List<Integer> parentValues = cpe.nextElement();
            assignmentMap.clear();
            for (int i = 0; i < parentValues.size(); i++) {
                assignmentMap.put(parentCardIdxToCFactorIdx.get(i), parentValues.get(i));
            }
            Double sum = cFactor.getTable().valueFor(assignmentMap);
            parentSummedOutEntries.add(sum);
            for (int i = 0; i < cCardinality; i++) {
                assignmentMap.put(cIdx, i);
                if (sum.equals(0.0)) {
                    // TODO - is this approach correct?
                    // NOTE: This prevents invalid models being generated by assigning an impossibly small probability to an event that should never occur
                    cptEntries.add(Double.MIN_NORMAL);
                } else {
                    cptEntries.add(cFactor.getTable().valueFor(assignmentMap) / sum);
                }
            }
        }
        summedOut = new FactorTable(parentVarIdxs, new FunctionTable(parentVarCardinalities, parentSummedOutEntries));
        cptTable = new FunctionTable(cptCardinalities, cptEntries);
    }
    ConditionalProbabilityTable cpt = new ConditionalProbabilityTable(parentVarIdxs, c, cptTable);
    Pair<FactorTable, ConditionalProbabilityTable> result = new Pair<>(summedOut, cpt);
    return result;
}
Also used : ConditionalProbabilityTable(com.sri.ai.praise.core.representation.classbased.table.core.data.bayes.ConditionalProbabilityTable) ArrayList(java.util.ArrayList) CartesianProductEnumeration(com.sri.ai.util.collect.CartesianProductEnumeration) LinkedHashMap(java.util.LinkedHashMap) FunctionTable(com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable) FactorTable(com.sri.ai.praise.core.representation.classbased.table.core.data.markov.FactorTable) Pair(com.sri.ai.util.base.Pair)

Example 8 with FunctionTable

use of com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable in project aic-praise by aic-sri-international.

the class TranslationOfTableToInequalitiesTest method test.

@Test
public void test() {
    FunctionTable table;
    String expected;
    table = new FunctionTable(list(2), list(1.0, 1.0));
    expected = "1";
    run(table, expected);
    table = new FunctionTable(list(5), list(0.0, 1.0, 1.0, 0.0, 0.0));
    expected = "if (g0 = 0) or (g0 >= 3) then 0 else 1";
    run(table, expected);
    table = new FunctionTable(list(4, 3), list(0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0));
    expected = "if (g0 = 0) and (g1 >= 1) or (g0 >= 1) and (g0 <= 2) then 1 else 0";
    run(table, expected);
    table = new FunctionTable(list(1, 3), list(0.0, 1.0, 1.0));
    expected = "if (g1 >= 1) then 1 else 0";
    run(table, expected);
    table = new FunctionTable(list(4, 1), list(0.0, 1.0, 1.0, 0.0));
    expected = "if (g0 >= 1) and (g0 <= 2) then 1 else 0";
    run(table, expected);
    table = new FunctionTable(list(4, 3), list(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0));
    expected = "if (g0 >= 1) and (g0 <= 2) then 1 else 0";
    run(table, expected);
    table = new FunctionTable(list(3, 3), list(0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0));
    expected = "if (g0 = 0) or (g0 = 1) and (g1 = 0) or (g0 = 2) then 0 else 1";
    run(table, expected);
    table = new FunctionTable(list(3, 3), list(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
    expected = "0";
    run(table, expected);
    table = new FunctionTable(list(3, 3), list(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0));
    expected = "if g0 = 0 or g0 = 2 then 0 else 1";
    run(table, expected);
    table = new FunctionTable(list(10, 3), list(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0));
    expected = "if g0 >= 1 and g0 <= 8 then 1 else 0";
    run(table, expected);
    table = new FunctionTable(list(10, 3), list(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, // <--- different
    0.0, // <--- different
    1.0, // <--- different
    1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0));
    expected = "if (g0 >= 1) and (g0 <= 4) or (g0 = 5) and (g1 >= 1) or (g0 >= 6) and (g0 <= 8) then 1 else 0";
    run(table, expected);
    table = new FunctionTable(list(2, 5), list(0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0));
    expected = "if (g0 = 0) and (g1 = 0) or " + "   (g0 = 0) and (g1 >= 3) or (g0 = 1) and (g1 = 0) or " + "   (g0 = 1) and (g1 >= 3) then 0 else 1";
    run(table, expected);
    table = new FunctionTable(list(2, 5), list(0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 0.0));
    expected = "if (g0 = 0) and (g1 = 0) or " + "(g0 = 0) and (g1 >= 3) or (g0 = 1) and (g1 = 0) or (g0 = 1) and (g1 >= 3) then 0 else if (g0 = 0) and (g1 >= 1) and (g1 <= 2) or (g0 = 1) and (g1 = 1) then 1 else 2";
    run(table, expected);
    table = new FunctionTable(list(2, 5), list(1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0));
    expected = "if g0 = 1 then 2 else 1";
    run(table, expected);
    table = new FunctionTable(list(5, 4, 3), list(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0));
    expected = "if " + "(g0 = 0) or " + "(g0 = 1) and (g1 = 0) or " + "(g0 = 1) and (g1 = 3) or " + "(g0 = 2) and (g1 <= 1) or " + "(g0 = 2) and ((g1 = 2) and (g2 >= 1) or (g1 = 3)) or (g0 >= 3) " + "then 1 else 0";
    run(table, expected);
}
Also used : FunctionTable(com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable) Test(org.junit.Test)

Example 9 with FunctionTable

use of com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable in project aic-praise by aic-sri-international.

the class AbstractUAI_to_HOGMv1_Translator method translate.

// END-Translator
// 
@Override
protected void translate(String inputIdentifier, UAIModel uaiModel, PrintWriter[] translatedOutputs) throws Exception {
    PrintWriter hogmv1ModelWriter = translatedOutputs[0];
    // 
    // 1. Output some comments with respect to the input model
    hogmv1ModelWriter.println("// IMPORT OF: " + inputIdentifier);
    hogmv1ModelWriter.println("//");
    hogmv1ModelWriter.println("// #variables                                = " + uaiModel.numberVariables());
    hogmv1ModelWriter.println("// #tables                                   = " + uaiModel.numberTables());
    hogmv1ModelWriter.println("// #unique function tables                   = " + uaiModel.numberUniqueFunctionTables());
    hogmv1ModelWriter.println("// Largest variable cardinality              = " + uaiModel.largestCardinality());
    hogmv1ModelWriter.println("// Largest # entries                         = " + uaiModel.largestNumberOfFunctionTableEntries());
    hogmv1ModelWriter.println("// Total #entries across all function tables = " + uaiModel.totalNumberEntriesForAllFunctionTables());
    // 
    // 2. Output the sort and random variable declarations
    List<String> sorts = new ArrayList<>();
    List<String> randoms = new ArrayList<>();
    for (int varIdx = 0; varIdx < uaiModel.numberVariables(); varIdx++) {
        int varCardinality = uaiModel.cardinality(varIdx);
        addSortAndRandomVariableDeclarationsRegarding(varIdx, varCardinality, sorts, randoms);
    }
    if (sorts.size() > 0) {
        hogmv1ModelWriter.println();
        hogmv1ModelWriter.println("// SORT DECLARATIONS:");
        sorts.forEach(sort -> hogmv1ModelWriter.println(sort));
    }
    hogmv1ModelWriter.println();
    hogmv1ModelWriter.println("// RANDOM VARIABLE DECLARATIONS:");
    randoms.forEach(random -> hogmv1ModelWriter.println(random));
    // 
    // 3. Output the potentials
    hogmv1ModelWriter.println();
    hogmv1ModelWriter.println("// RULES:");
    double totalNumberUniqueEntries = 0;
    double totalCompressedEntries = 0;
    // i.e. none at all
    double bestIndividualCompressionRatio = 100;
    double worstIndividualCompressionRatio = 0;
    for (int i = 0; i < uaiModel.numberUniqueFunctionTables(); i++) {
        FunctionTable table = uaiModel.getUniqueFunctionTable(i);
        totalNumberUniqueEntries += table.numberEntries();
        Expression genericTableExpression = convertToHOGMv1Expression(table);
        double compressedEntries = calculateCompressedEntries(genericTableExpression);
        double compressedRatio = compressedEntries / table.numberEntries();
        if (compressedRatio < bestIndividualCompressionRatio) {
            bestIndividualCompressionRatio = compressedRatio;
        }
        if (compressedRatio > worstIndividualCompressionRatio) {
            worstIndividualCompressionRatio = compressedRatio;
        }
        totalCompressedEntries += compressedEntries;
        for (int tableIdx : uaiModel.getTableIndexes(i)) {
            Expression instanceTableExpression = UAIUtil.convertGenericTableToInstance(table, genericTableExpression, uaiModel.getVariableIndexesForTable(tableIdx));
            // If just a number then table is just a constant and is irrelevant
            if (!Expressions.isNumber(instanceTableExpression)) {
                hogmv1ModelWriter.println(instanceTableExpression.toString() + ";");
            }
        }
    }
    // 
    // 4. Output some stats related to the translation to potentials
    hogmv1ModelWriter.println();
    hogmv1ModelWriter.println("// STATS: ");
    hogmv1ModelWriter.println("// Table compression ratio            = " + (totalCompressedEntries / totalNumberUniqueEntries));
    hogmv1ModelWriter.println("// Best individual compression ratio  = " + bestIndividualCompressionRatio);
    hogmv1ModelWriter.println("// Worst individual compression ratio = " + worstIndividualCompressionRatio);
}
Also used : FunctionTable(com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable) Expression(com.sri.ai.expresso.api.Expression) ArrayList(java.util.ArrayList) PrintWriter(java.io.PrintWriter)

Example 10 with FunctionTable

use of com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable in project aic-praise by aic-sri-international.

the class TranslationOfTableToInequalities method constructGenericTableExpressionUsingInequalities.

/**
 * Returns an {@link Expression} equivalent to a given {@link FunctionTable} but in the form of a decision tree
 * (so hopefully more compact) using inequalities.
 * @param functionTable
 * @param solverListener if not null, invoked on solver used for compilation,
 * before and after compilation is performed; returned solver from "before" invocation is used (it may be the same one used as argument, of course).
 * @return
 */
public static Expression constructGenericTableExpressionUsingInequalities(FunctionTable functionTable, Function<MultiQuantifierEliminator, MultiQuantifierEliminator> solverListener) {
    // the strategy in this method is the following:
    // we collect all the contiguous indices sub-sets of the function table sharing their function value.
    // They are kept in a map from each value to a list of indices sub-sets with that value.
    // 
    // Then, we sort these groups of indices sub-sets by the sum of their sizes (number of entries), from smallest to largest.
    // This will help us later to create an expression that tests for the largest groups first.
    // 
    // Finally, we create an if-then-else expression, starting from the leaf (least common value).
    // For each group of indices sub-sets with the same value, we obtain an inequalities expression describing
    // the conditions for a variable assignment to be in that indices sub-set of the function table.
    // Each portion generates a conjunction, and the group of portions generates a disjunction.
    // 
    // The resulting if-then-else expression is linearly organized (only else clauses have nested if-then-else expressions).
    // A more balanced (and thus efficient) representation is obtained by compiling it using SGDPLL(T).
    Map<Double, List<FunctionTableIndicesSubSet>> functionValuesAndCorrespondingIndicesSubSet = map();
    Double currentSubSetFunctionValueIfAny = null;
    List<Integer> firstIndicesOfCurrentSubSetIfAny = null;
    List<Integer> previousIndices = null;
    List<Integer> indices = null;
    CartesianProductEnumeration<Integer> cartesianProduct = new CartesianProductEnumeration<>(UAIUtil.cardinalityValues(functionTable));
    while (cartesianProduct.hasMoreElements()) {
        previousIndices = indices;
        indices = new ArrayList<>(cartesianProduct.nextElement());
        Double functionValue = Math.round(functionTable.entryFor(indices) * 100) / 100.0;
        boolean hitNewFunctionValue = currentSubSetFunctionValueIfAny == null || !functionValue.equals(currentSubSetFunctionValueIfAny);
        if (hitNewFunctionValue) {
            storeIndicesSubSetOnAllVariables(functionTable, firstIndicesOfCurrentSubSetIfAny, previousIndices, currentSubSetFunctionValueIfAny, functionValuesAndCorrespondingIndicesSubSet);
            // get information for next indices sub-set
            currentSubSetFunctionValueIfAny = functionValue;
            firstIndicesOfCurrentSubSetIfAny = indices;
        }
    }
    previousIndices = indices;
    storeIndicesSubSetOnAllVariables(functionTable, firstIndicesOfCurrentSubSetIfAny, previousIndices, currentSubSetFunctionValueIfAny, functionValuesAndCorrespondingIndicesSubSet);
    // we sort (by using TreeMap) lists of indices sub-set with the same function value from those with smaller to greater sizes,
    // and form the final expression backwards, thus prioritizing larger sub-sets
    // whose conditions will be more often satisfied and leading to greater simplifications during inference.
    List<Pair<BigInteger, List<FunctionTableIndicesSubSet>>> listOfPairsOfSizeAndListsOfIndicesSubSetsWithSameFunctionValue = new ArrayList<>(functionValuesAndCorrespondingIndicesSubSet.size());
    for (Map.Entry<Double, List<FunctionTableIndicesSubSet>> functionValueAndIndicesSubSet : functionValuesAndCorrespondingIndicesSubSet.entrySet()) {
        List<FunctionTableIndicesSubSet> indicesSubSetsWithSameFunctionValue = functionValueAndIndicesSubSet.getValue();
        BigInteger sumOfSizes = BigInteger.ZERO;
        for (FunctionTableIndicesSubSet indicesSubSet : indicesSubSetsWithSameFunctionValue) {
            sumOfSizes = sumOfSizes.add(indicesSubSet.size());
        }
        listOfPairsOfSizeAndListsOfIndicesSubSetsWithSameFunctionValue.add(Pair.make(sumOfSizes, indicesSubSetsWithSameFunctionValue));
    }
    Collections.sort(listOfPairsOfSizeAndListsOfIndicesSubSetsWithSameFunctionValue, (Comparator<? super Pair<BigInteger, List<FunctionTableIndicesSubSet>>>) (p1, p2) -> p1.first.compareTo(p2.first));
    List<List<FunctionTableIndicesSubSet>> listsOfIndicesSubSetsWithSameFunctionValue = mapIntoList(listOfPairsOfSizeAndListsOfIndicesSubSetsWithSameFunctionValue, p -> p.second);
    Iterator<List<FunctionTableIndicesSubSet>> listsOfIndicesSubSetsWithSameFunctionValueIterator = listsOfIndicesSubSetsWithSameFunctionValue.iterator();
    List<FunctionTableIndicesSubSet> firstListOfIndicesSubSets = listsOfIndicesSubSetsWithSameFunctionValueIterator.next();
    Double valueOfFirstListOfIndicesSubSets = getFirstOrNull(firstListOfIndicesSubSets).getFunctionValue();
    Expression currentExpression = makeSymbol(valueOfFirstListOfIndicesSubSets);
    while (listsOfIndicesSubSetsWithSameFunctionValueIterator.hasNext()) {
        List<FunctionTableIndicesSubSet> indicesSubSetsWithSameFunctionValue = listsOfIndicesSubSetsWithSameFunctionValueIterator.next();
        Expression functionValueOfIndicesSubSetsWithSameFunctionValue = makeSymbol(getFirstOrNull(indicesSubSetsWithSameFunctionValue).getFunctionValue());
        Expression conditionForThisFunctionValue = Or.make(mapIntoList(indicesSubSetsWithSameFunctionValue, TranslationOfTableToInequalities::getInequalitiesExpressionForFunctionTableIndicesSubSet));
        currentExpression = IfThenElse.make(conditionForThisFunctionValue, functionValueOfIndicesSubSetsWithSameFunctionValue, currentExpression);
    }
    return currentExpression;
}
Also used : ONE(java.math.BigInteger.ONE) FALSE(com.sri.ai.expresso.helper.Expressions.FALSE) Expression(com.sri.ai.expresso.api.Expression) EQUALITY(com.sri.ai.grinder.library.FunctorConstants.EQUALITY) Function(java.util.function.Function) Util.forAll(com.sri.ai.util.Util.forAll) ArrayList(java.util.ArrayList) And(com.sri.ai.grinder.library.boole.And) Util.map(com.sri.ai.util.Util.map) Expressions.apply(com.sri.ai.expresso.helper.Expressions.apply) Map(java.util.Map) IntegerIterator(com.sri.ai.util.collect.IntegerIterator) BigInteger(java.math.BigInteger) UAIUtil(com.sri.ai.praise.core.representation.classbased.table.core.uai.UAIUtil) Pair(com.sri.ai.util.base.Pair) MultiQuantifierEliminator(com.sri.ai.grinder.api.MultiQuantifierEliminator) Or(com.sri.ai.grinder.library.boole.Or) CartesianProductEnumeration(com.sri.ai.util.collect.CartesianProductEnumeration) LESS_THAN_OR_EQUAL_TO(com.sri.ai.grinder.library.FunctorConstants.LESS_THAN_OR_EQUAL_TO) Iterator(java.util.Iterator) MixedRadixNumber(com.sri.ai.util.math.MixedRadixNumber) Util.mapIntoList(com.sri.ai.util.Util.mapIntoList) IfThenElse(com.sri.ai.grinder.library.controlflow.IfThenElse) Beta(com.google.common.annotations.Beta) Util.getFirstOrNull(com.sri.ai.util.Util.getFirstOrNull) GREATER_THAN_OR_EQUAL_TO(com.sri.ai.grinder.library.FunctorConstants.GREATER_THAN_OR_EQUAL_TO) List(java.util.List) Expressions.makeSymbol(com.sri.ai.expresso.helper.Expressions.makeSymbol) Util.arrayListFilledWith(com.sri.ai.util.Util.arrayListFilledWith) FunctionTable(com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable) Comparator(java.util.Comparator) Util.putInListValue(com.sri.ai.util.Util.putInListValue) Collections(java.util.Collections) TRUE(com.sri.ai.expresso.helper.Expressions.TRUE) ArrayList(java.util.ArrayList) CartesianProductEnumeration(com.sri.ai.util.collect.CartesianProductEnumeration) BigInteger(java.math.BigInteger) Expression(com.sri.ai.expresso.api.Expression) BigInteger(java.math.BigInteger) ArrayList(java.util.ArrayList) Util.mapIntoList(com.sri.ai.util.Util.mapIntoList) List(java.util.List) Map(java.util.Map) Pair(com.sri.ai.util.base.Pair)

Aggregations

FunctionTable (com.sri.ai.praise.core.representation.classbased.table.core.data.FunctionTable)11 ArrayList (java.util.ArrayList)8 LinkedHashMap (java.util.LinkedHashMap)5 Expression (com.sri.ai.expresso.api.Expression)4 CartesianProductEnumeration (com.sri.ai.util.collect.CartesianProductEnumeration)4 Map (java.util.Map)3 Beta (com.google.common.annotations.Beta)2 MultiQuantifierEliminator (com.sri.ai.grinder.api.MultiQuantifierEliminator)2 FactorTable (com.sri.ai.praise.core.representation.classbased.table.core.data.markov.FactorTable)2 Pair (com.sri.ai.util.base.Pair)2 BufferedReader (java.io.BufferedReader)2 List (java.util.List)2 Function (java.util.function.Function)2 Expressions (com.sri.ai.expresso.helper.Expressions)1 FALSE (com.sri.ai.expresso.helper.Expressions.FALSE)1 TRUE (com.sri.ai.expresso.helper.Expressions.TRUE)1 Expressions.apply (com.sri.ai.expresso.helper.Expressions.apply)1 Expressions.makeSymbol (com.sri.ai.expresso.helper.Expressions.makeSymbol)1 Context (com.sri.ai.grinder.api.Context)1 Compilation (com.sri.ai.grinder.application.Compilation)1