use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class Dijkstra method bounds.
/**
* Returns the bounds corresponding to the given scopes.
*
* @return bounds
*/
public Bounds bounds(int states, int processes, int mutexes) {
final List<String> atoms = new ArrayList<String>(states + processes + mutexes);
for (int i = 0; i < states; i++) {
atoms.add("State" + i);
}
for (int i = 0; i < processes; i++) {
atoms.add("Process" + i);
}
for (int i = 0; i < mutexes; i++) {
atoms.add("Mutex" + i);
}
final Universe u = new Universe(atoms);
final TupleFactory f = u.factory();
final Bounds b = new Bounds(u);
final TupleSet sb = f.range(f.tuple("State0"), f.tuple("State" + (states - 1)));
final TupleSet pb = f.range(f.tuple("Process0"), f.tuple("Process" + (processes - 1)));
final TupleSet mb = f.range(f.tuple("Mutex0"), f.tuple("Mutex" + (mutexes - 1)));
b.bound(State, sb);
b.bound(holds, sb.product(pb).product(mb));
b.bound(waits, sb.product(pb).product(mb));
b.bound(sfirst, sb);
b.bound(slast, sb);
b.bound(sord, sb.product(sb));
b.bound(Process, pb);
b.bound(Mutex, mb);
b.bound(mfirst, mb);
b.bound(mlast, mb);
b.bound(mord, mb.product(mb));
return b;
}
use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class NUM374 method bounds.
/**
* Returns the bounds for the given scope.
*
* @return bounds for the given scope
*/
public final Bounds bounds(int n) {
assert n > 0;
final List<String> atoms = new ArrayList<String>(n);
for (int i = 0; i < n; i++) atoms.add("a" + i);
final Universe u = new Universe(atoms);
final Bounds b = new Bounds(u);
final TupleFactory f = u.factory();
final TupleSet all3 = f.allOf(3);
b.bound(sum, all3);
b.bound(product, all3);
b.bound(exponent, all3);
b.bound(n1, f.allOf(1));
return b;
}
use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class Quasigroups7 method bounds.
/**
* Returns the partial bounds the problem (axioms 1, 4, 9-11).
*
* @return the partial bounds for the problem
*/
public Bounds bounds() {
final List<String> atoms = new ArrayList<String>(14);
for (int i = 0; i < 7; i++) atoms.add("e1" + i);
for (int i = 0; i < 7; i++) atoms.add("e2" + i);
final Universe u = new Universe(atoms);
final Bounds b = new Bounds(u);
final TupleFactory f = u.factory();
b.boundExactly(s1, f.range(f.tuple("e10"), f.tuple("e16")));
b.boundExactly(s2, f.range(f.tuple("e20"), f.tuple("e26")));
// axioms 9, 10, 11
for (int i = 0; i < 7; i++) {
b.boundExactly(e1[i], f.setOf("e1" + i));
b.boundExactly(e2[i], f.setOf("e2" + i));
}
// axom 1
final TupleSet op1h = f.area(f.tuple("e10", "e10", "e10"), f.tuple("e16", "e16", "e16"));
// axiom 4
final TupleSet op2h = f.area(f.tuple("e20", "e20", "e20"), f.tuple("e26", "e26", "e26"));
b.bound(op1, op1h);
b.bound(op2, op2h);
return b;
}
use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class SET948 method main.
/**
* Usage: java examples.tptp.SET948 [univ size]
*/
public static void main(String[] args) {
if (args.length < 1)
usage();
try {
final int n = Integer.parseInt(args[0]);
if (n < 1)
usage();
final SET948 model = new SET948();
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
// solver.options().setSymmetryBreaking(n*n);
// solver.options().setFlatten(false);
final Formula f = model.checkT101_zfmisc_1();
final Bounds b = model.bounds(n);
System.out.println(f);
final Solution sol = solver.solve(f, b);
System.out.println(sol);
} catch (NumberFormatException nfe) {
usage();
}
}
use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.
the class GEO159 method main.
/**
* Usage: ava examples.tptp.GEO159 [scope]
*/
public static void main(String[] args) {
if (args.length < 1)
usage();
try {
final int n = Integer.parseInt(args[0]);
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
final GEO159 model = new GEO159();
final Formula f = model.checkDefs();
final Bounds b = model.bounds(n);
final Solution sol = solver.solve(f, b);
System.out.println(sol);
} catch (NumberFormatException nfe) {
usage();
}
}
Aggregations