use of suite.lp.doer.ProverFactory.Prove_ in project suite by stupidsing.
the class SewingProverBuilder method build.
@Override
public Fun<Node, Finder> build(RuleSet ruleSet) {
ProverFactory sewingProver = new SewingProverImpl(ruleSet);
return goal -> {
Node goal1 = SewingGeneralizerImpl.generalize(goal);
Prove_ pred = sewingProver.prover(goal1);
return (source, sink) -> {
ProverConfig proverConfig1 = new ProverConfig(ruleSet, proverConfig);
proverConfig1.setSource(source);
proverConfig1.setSink(sink);
pred.test(proverConfig1);
};
};
}
use of suite.lp.doer.ProverFactory.Prove_ in project suite by stupidsing.
the class SewingProverTest method testPerformance.
@Test
public void testPerformance() {
RuleSet rs = Suite.newRuleSet();
Atom pred = Atom.of("q");
Atom tail = Atom.NIL;
for (int i = 0; i < 65536; i++) rs.addRule(Rule.of(Tree.of(TermOp.IS____, Tree.of(TermOp.TUPLE_, pred, Int.of(i)), tail)));
ProverFactory sp = new SewingProverImpl(rs);
ProverConfig pc = new ProverConfig(rs);
Prove_ test = sp.prover(Suite.parse("q 32768"));
Source<Stopwatch<Boolean>> trial = () -> Stopwatch.of(() -> {
boolean isOk = true;
for (int i = 0; i < 65536; i++) isOk &= test.test(pc);
assertTrue(isOk);
return isOk;
});
for (int i = 0; i < 8; i++) trial.source();
Stopwatch<Boolean> sw = trial.source();
System.out.println(sw.duration);
assertTrue(sw.duration < 300);
}
use of suite.lp.doer.ProverFactory.Prove_ in project suite by stupidsing.
the class ProverFactoryTest method test.
private void test(String query, boolean result) {
for (ProverFactory pf : new ProverFactory[] { //
new CompileProverImpl(), new SewingProverImpl(Suite.newRuleSet(List.of("auto.sl"))) }) {
Prove_ p = pf.prover(Suite.parse(query));
assertEquals(result, p.test(new ProverConfig()));
}
}
Aggregations