use of com.sri.ai.grinder.library.commonrewriters.CommonSimplifier in project aic-expresso by aic-sri-international.
the class SamplingProceduralAttachmentSingleQuantifierEliminatorTest method test.
@Test
public void test() {
String intervalString = "0..10";
Context context = new TrueContext(new DifferenceArithmeticTheory(true, true));
MultiQuantifierEliminationProblem problem = new DefaultMultiQuantifierEliminationProblem(new Sum(), list(parse("I")), list(parse(intervalString)), parse("I != 3"), parse("I^2"));
SamplingProceduralAttachmentSingleQuantifierEliminator eliminator = new SamplingProceduralAttachmentSingleQuantifierEliminator(new CommonSimplifier(), new Random());
// SHOULD NOT HAVE TO
context = problem.extend(context);
Expression sampler = eliminator.solve(problem, context);
println(sampler);
Rewriter rewriter = new CombiningTopRewriter(new CommonSimplifier(), ProceduralAttachments.getProceduralAttachmentsTopRewriter(context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
println(rewriter.apply(sampler, context));
}
use of com.sri.ai.grinder.library.commonrewriters.CommonSimplifier in project aic-expresso by aic-sri-international.
the class ProceduralAttachmentsTest method runTest.
private void runTest(Expression input, Expression expected, Context context) {
TopRewriter topRewriter;
Rewriter evaluator;
Expression output;
topRewriter = new CombiningTopRewriter(new CommonSimplifier(), getProceduralAttachmentsTopRewriter(context));
evaluator = new Recursive(new Exhaustive(topRewriter));
output = evaluator.apply(input, context);
println(output);
assertEquals(expected, output);
}
Aggregations