Search in sources :

Example 1 with BruteForceInterpreter

use of com.sri.ai.grinder.interpreter.BruteForceInterpreter in project aic-expresso by aic-sri-international.

the class BasicTest method debug.

private void debug(Expression problem) {
    Theory theory = new DifferenceArithmeticTheory(true, true);
    Context context = new TrueContext(theory);
    context = context.putGlobalObject(BRUTE_FORCE_CHECKING_OF_NON_CONDITIONAL_PROBLEMS, "Yes");
    Expression symbolicSolution = theory.evaluate(problem, context);
    println(symbolicSolution);
    BruteForceInterpreter bruteForceInterpreter = new BruteForceCommonInterpreter();
    Expression bruteForceSolution = bruteForceInterpreter.apply(problem, context);
    println(bruteForceSolution);
    Assert.assertEquals(bruteForceSolution, symbolicSolution);
}
Also used : TrueContext(com.sri.ai.grinder.core.TrueContext) Context(com.sri.ai.grinder.api.Context) BruteForceCommonInterpreter(com.sri.ai.grinder.interpreter.BruteForceCommonInterpreter) Theory(com.sri.ai.grinder.api.Theory) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) Expression(com.sri.ai.expresso.api.Expression) BruteForceInterpreter(com.sri.ai.grinder.interpreter.BruteForceInterpreter) DifferenceArithmeticTheory(com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory) TrueContext(com.sri.ai.grinder.core.TrueContext)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)1 Context (com.sri.ai.grinder.api.Context)1 Theory (com.sri.ai.grinder.api.Theory)1 TrueContext (com.sri.ai.grinder.core.TrueContext)1 BruteForceCommonInterpreter (com.sri.ai.grinder.interpreter.BruteForceCommonInterpreter)1 BruteForceInterpreter (com.sri.ai.grinder.interpreter.BruteForceInterpreter)1 DifferenceArithmeticTheory (com.sri.ai.grinder.theory.differencearithmetic.DifferenceArithmeticTheory)1