Search in sources :

Example 1 with ExpressionWrapperStepSolver

use of com.sri.ai.grinder.sgdpllt.theory.base.ExpressionWrapperStepSolver in project aic-expresso by aic-sri-international.

the class SelectExpressionsSatisfyingComparisonStepSolverTest method runTest.

private void runTest(List<String> expressions, Expression bound, Expression expected, Context context) {
    StepSolver<List<Expression>> stepSolver = new SelectExpressionsSatisfyingComparisonStepSolver(mapIntoArrayList(expressions, Expressions::parse), LESS_THAN, bound);
    ExpressionWrapperStepSolver<List<Expression>> wrapInList = new ExpressionWrapperStepSolver<>(stepSolver, selection -> apply("list", selection));
    Expression solution = ContextDependentExpressionProblemSolver.staticSolve(wrapInList, context);
    System.out.println("Elements in " + expressions + " which are less than " + bound + ": " + solution);
    assertEquals(expected, solution);
}
Also used : Expression(com.sri.ai.expresso.api.Expression) SelectExpressionsSatisfyingComparisonStepSolver(com.sri.ai.grinder.sgdpllt.helper.SelectExpressionsSatisfyingComparisonStepSolver) Util.mapIntoArrayList(com.sri.ai.util.Util.mapIntoArrayList) List(java.util.List) ExpressionWrapperStepSolver(com.sri.ai.grinder.sgdpllt.theory.base.ExpressionWrapperStepSolver)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)1 SelectExpressionsSatisfyingComparisonStepSolver (com.sri.ai.grinder.sgdpllt.helper.SelectExpressionsSatisfyingComparisonStepSolver)1 ExpressionWrapperStepSolver (com.sri.ai.grinder.sgdpllt.theory.base.ExpressionWrapperStepSolver)1 Util.mapIntoArrayList (com.sri.ai.util.Util.mapIntoArrayList)1 List (java.util.List)1