use of kodkod.engine.fol2sat.HigherOrderDeclException in project org.alloytools.alloy by AlloyTools.
the class GRA013_026 method main.
/**
* Usage: java examples.tptp.GRA013_026 <graph size> <clique size>
*/
public static void main(String[] args) {
if (args.length < 2)
usage();
try {
final GRA013_026 model = new GRA013_026(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
final Bounds b = model.bounds();
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
solver.options().setReporter(new ConsoleReporter());
final Formula f = model.checkGoalToBeProved();
System.out.println(PrettyPrinter.print(f, 2));
// System.out.println(b);
final Solution s = solver.solve(f, b);
System.out.println(s);
// System.out.println((new Evaluator(s.instance())).evaluate(f));
} catch (HigherOrderDeclException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnboundLeafException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NumberFormatException nfe) {
usage();
}
}
use of kodkod.engine.fol2sat.HigherOrderDeclException in project org.alloytools.alloy by AlloyTools.
the class BugTests method testFelix_08022006.
public final void testFelix_08022006() {
Relation x = Relation.nary("P", 1);
String[] atoms = { "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1", "0", "1", "2", "3", "4", "5", "6", "7" };
java.util.ArrayList<String> atomlist = new java.util.ArrayList<String>();
for (String a : atoms) atomlist.add(a);
Universe universe = new Universe(atomlist);
TupleFactory factory = universe.factory();
Bounds bounds = new Bounds(universe);
for (int i = -8; i <= 7; i++) bounds.boundExactly(i, factory.setOf(String.valueOf(i)));
bounds.bound(x, factory.allOf(1));
Formula f = x.in(Expression.INTS).and(x.some());
// System.out.println(bounds);
Solver solver = new Solver();
// solver.options().setSolver(SATFactory.ZChaff);
solver.options().setSolver(SATFactory.DefaultSAT4J);
solver.options().setBitwidth(4);
solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
Solution sol;
try {
sol = solver.solve(f, bounds);
assertNotNull(sol.instance());
} catch (HigherOrderDeclException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnboundLeafException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations