use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class OverflowSigTest method createBounds.
protected void createBounds() {
Collection<String> atoms = new ArrayList<String>(sAtoms.size() + xAtoms.size());
atoms.addAll(sAtoms);
atoms.addAll(xAtoms);
final Universe universe = new Universe(atoms);
this.factory = universe.factory();
this.bounds = new Bounds(universe);
TupleSet sTs = factory.setOf(sAtoms.toArray());
TupleSet xTs = factory.setOf(xAtoms.toArray());
bounds.bound(s, sTs);
bounds.bound(x, xTs);
bounds.bound(sa, sTs.product(xTs));
bounds.bound(sb, sTs.product(xTs));
bounds.bound(sc, sTs.product(xTs));
}
use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class OverflowTheoremTest method setupBounds.
protected void setupBounds() {
Relation ret = Relation.unary("ret");
int min = min(bw);
int max = max(bw);
List<String> atoms = new ArrayList<String>(max - min + 1);
for (int i = min; i <= max; i++) {
atoms.add(String.valueOf(i));
}
final Universe universe = new Universe(atoms);
TupleFactory factory = universe.factory();
this.bounds = new Bounds(factory.universe());
for (int i = min; i <= max; i++) {
bounds.boundExactly(i, factory.setOf(String.valueOf(i)));
}
bounds.bound(ret, factory.noneOf(1), factory.allOf(1));
}
use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class SymmetryBreakingTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
bounds = new Bounds(factory.universe());
}
use of kodkod.instance.Bounds 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.instance.Bounds 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