Search in sources :

Example 1 with BruteForceFallbackTheory

use of com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory in project aic-expresso by aic-sri-international.

the class SymbolicShell method makeTheory.

private static Theory makeTheory() {
    Theory theory = new CompoundTheory(new EqualityTheory(false, true), new DifferenceArithmeticTheory(false, false), new LinearRealArithmeticTheory(false, false), new TupleTheory(), new PropositionalTheory(), new BruteForceFunctionTheory());
    theory = new BruteForceFallbackTheory(theory);
    return theory;
}
Also used : BruteForceFallbackTheory(com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory) EqualityTheory(com.sri.ai.grinder.theory.equality.EqualityTheory) BruteForceFunctionTheory(com.sri.ai.grinder.theory.function.BruteForceFunctionTheory) PropositionalTheory(com.sri.ai.grinder.theory.propositional.PropositionalTheory) BruteForceFallbackTheory(com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory) BruteForceFunctionTheory(com.sri.ai.grinder.theory.function.BruteForceFunctionTheory) EqualityTheory(com.sri.ai.grinder.theory.equality.EqualityTheory) LinearRealArithmeticTheory(com.sri.ai.grinder.theory.linearrealarithmetic.LinearRealArithmeticTheory) Theory(com.sri.ai.grinder.api.Theory) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) CompoundTheory(com.sri.ai.grinder.theory.compound.CompoundTheory) TupleTheory(com.sri.ai.grinder.theory.tuple.TupleTheory) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) LinearRealArithmeticTheory(com.sri.ai.grinder.theory.linearrealarithmetic.LinearRealArithmeticTheory) PropositionalTheory(com.sri.ai.grinder.theory.propositional.PropositionalTheory) CompoundTheory(com.sri.ai.grinder.theory.compound.CompoundTheory) TupleTheory(com.sri.ai.grinder.theory.tuple.TupleTheory)

Example 2 with BruteForceFallbackTheory

use of com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory in project aic-expresso by aic-sri-international.

the class BruteForceFallbackTheoryTest method runTest.

private static void runTest(String expressionString, String expectedString, String... symbolsAndTypes) {
    Theory theory = new BruteForceFallbackTheory(new DifferenceArithmeticTheory(false, true));
    Context context = new TrueContext(theory);
    context = context.extendWithSymbolsAndTypes(symbolsAndTypes);
    Expression expression = parse(expressionString);
    Expression expected = parse(expectedString);
    Expression actual = theory.evaluate(expression, context);
    println(actual);
    assertEquals(expected, actual);
}
Also used : TrueContext(com.sri.ai.grinder.core.TrueContext) Context(com.sri.ai.grinder.api.Context) BruteForceFallbackTheory(com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory) Theory(com.sri.ai.grinder.api.Theory) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) BruteForceFallbackTheory(com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory) Expression(com.sri.ai.expresso.api.Expression) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) TrueContext(com.sri.ai.grinder.core.TrueContext)

Aggregations

Theory (com.sri.ai.grinder.api.Theory)2 BruteForceFallbackTheory (com.sri.ai.grinder.theory.bruteforce.BruteForceFallbackTheory)2 DifferenceArithmeticTheory (com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory)2 Expression (com.sri.ai.expresso.api.Expression)1 Context (com.sri.ai.grinder.api.Context)1 TrueContext (com.sri.ai.grinder.core.TrueContext)1 CompoundTheory (com.sri.ai.grinder.theory.compound.CompoundTheory)1 EqualityTheory (com.sri.ai.grinder.theory.equality.EqualityTheory)1 BruteForceFunctionTheory (com.sri.ai.grinder.theory.function.BruteForceFunctionTheory)1 LinearRealArithmeticTheory (com.sri.ai.grinder.theory.linearrealarithmetic.LinearRealArithmeticTheory)1 PropositionalTheory (com.sri.ai.grinder.theory.propositional.PropositionalTheory)1 TupleTheory (com.sri.ai.grinder.theory.tuple.TupleTheory)1