use of edu.mit.csail.sdg.translator.A4Options in project org.alloytools.alloy by AlloyTools.
the class DemoFileSystem method runFor3.
void runFor3(Expr expr) throws Err {
A4Options opt = new A4Options();
Command cmd = new Command(false, 3, 3, 3, expr.and(fact));
A4Solution sol = TranslateAlloyToKodkod.execute_command(NOP, sigs, cmd, opt);
System.out.println(sol.toString().trim());
if (sol.satisfiable()) {
System.out.println("In particular, File = " + sol.eval(file));
System.out.println("In particular, Dir = " + sol.eval(dir));
System.out.println("In particular, contains = " + sol.eval(contains));
System.out.println("In particular, parent = " + sol.eval(parent));
}
System.out.println();
}
use of edu.mit.csail.sdg.translator.A4Options in project org.alloytools.alloy by AlloyTools.
the class ExampleCompilingFromSource method compileModuleAndRun.
public static void compileModuleAndRun(String model) throws Err {
A4Reporter rep = new A4Reporter();
// parse model from string
CompModule world = CompUtil.parseEverything_fromString(rep, model);
ConstList<Command> commands = world.getAllCommands();
if (commands.size() != 1)
throw new ErrorAPI("Must specify exactly one command; number of commands found: " + commands.size());
Command cmd = commands.get(0);
A4Options opt = new A4Options();
opt.solver = A4Options.SatSolver.SAT4J;
// solve
A4Solution sol = TranslateAlloyToKodkod.execute_command(rep, world.getAllSigs(), cmd, opt);
// print solution
System.out.println(sol);
for (Sig sig : world.getAllReachableSigs()) {
System.out.println("traversing sig: " + sig);
SafeList<Field> fields = sig.getFields();
for (Field field : fields) {
System.out.println(" traversing field: " + field);
A4TupleSet ts = (sol.eval(field));
for (A4Tuple t : ts) {
System.out.print(" [");
for (int i = 0; i < t.arity(); i++) System.out.print(t.atom(i) + " ");
System.out.println("]");
}
}
}
}
Aggregations