use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class OverflowSigTest method testOverBw.
@Test
public void testOverBw() {
IntOperator[] ops = new IntOperator[] { IntOperator.PLUS, IntOperator.MULTIPLY };
for (IntOperator op : ops) {
for (int i = 1; i < 6; i++) {
Solution solution = checkForBw(op, i);
assertNoInstance(solution);
}
}
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class OverflowTheoremTest method solve.
protected Solution[] solve(Formula formula) {
Solution s1 = new Solver(options).solve(formula, bounds);
Options opt2 = options.clone();
opt2.setSkolemDepth(2);
// Solution s2 = new Solver(opt2).solve(formula, bounds);
return new Solution[] { s1 };
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class SymmetryBreakingTest method solve.
private Instance solve(Formula f, Bounds b) {
final Solution sol = solver.solve(f, b);
final Statistics stats = sol.stats();
pVars = stats.primaryVariables();
iVars = stats.variables() - pVars;
clauses = stats.clauses();
return sol.instance();
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class BenchmarkSymmStats2 method printGBP.
// <symm time (ms)> <# of symms> <state bits> <SAT|UNSAT> <SAT time (ms)>
private static void printGBP(Formula formula, Bounds bounds) {
final class SymmReporter extends AbstractReporter {
long gbpTime;
BigInteger symms;
@Override
public void detectingSymmetries(Bounds bounds) {
gbpTime = bean.getCurrentThreadUserTime();
}
@Override
public void detectedSymmetries(Set<IntSet> parts) {
final long end = bean.getCurrentThreadUserTime();
gbpTime = (end - gbpTime) / 1000000;
symms = new BigInteger("1");
for (IntSet s : parts) {
symms = symms.multiply(fact(s.size()));
}
// System.out.println(parts);
}
}
;
final SymmReporter reporter = new SymmReporter();
final Solver solver = new Solver();
solver.options().setBitwidth(8);
solver.options().setSolver(SATFactory.MiniSat);
solver.options().setReporter(reporter);
final Solution sol = solver.solve(formula, bounds);
// <gbp (ms)> <gbp (symms)>
System.out.print(reporter.gbpTime + "\t");
System.out.print(reporter.symms + "\t");
// <state bits> <SAT|UNSAT> <SAT time (ms)>
System.out.print(sol.stats().primaryVariables() + "\t");
System.out.print(sol.instance() == null ? "UNSAT\t" : "SAT\t");
System.out.print(sol.stats().solvingTime() + "\t");
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class BenchmarkSymmStats2 method printGAD.
// <symm time (ms)> <# of symms> <state bits> <SAT|UNSAT> <SAT time (ms)>
private static void printGAD(Formula formula, Bounds bounds) {
final class SymmReporter extends AbstractReporter {
String symms, time;
Bounds bounds;
@Override
public void detectingSymmetries(Bounds bounds) {
this.bounds = bounds.clone();
}
@Override
public void detectedSymmetries(Set<IntSet> parts) {
parts.clear();
final SymmInfo allSymms = allSymms(bounds);
parts.addAll(allSymms.parts);
symms = allSymms.symms;
time = allSymms.time;
// System.out.println(parts);
}
}
;
final SymmReporter reporter = new SymmReporter();
final Solver solver = new Solver();
solver.options().setBitwidth(8);
solver.options().setSolver(SATFactory.MiniSat);
solver.options().setReporter(reporter);
final Solution sol = solver.solve(formula, bounds);
// <gbp (ms)> <gbp (symms)>
System.out.print(reporter.time + "\t");
System.out.print(reporter.symms + "\t");
// <state bits> <SAT|UNSAT> <SAT time (ms)>
System.out.print(sol.stats().primaryVariables() + "\t");
System.out.print(sol.instance() == null ? "UNSAT\t" : "SAT\t");
System.out.print(sol.stats().solvingTime() + "\t");
}
Aggregations