use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class Toughnut method main.
/**
* Usage: java examples.Toughnut [size of one side of the board; optional]
*/
public static void main(String[] args) {
try {
int n = args.length == 0 ? 4 : Integer.parseInt(args[0]);
final Toughnut nut = new Toughnut();
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
final Formula covering = nut.checkBelowTooDoublePrime();
final Bounds bounds = nut.bounds(n);
// System.out.println(covering);
// System.out.println(bounds);
final Solution sol = solver.solve(covering, bounds);
System.out.println(sol);
} catch (NumberFormatException nfe) {
System.out.println("Usage: java examples.Toughnut [size of one side of the board; optional]");
}
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class Viktor method main.
/**
* Usage: java tests.Viktor
*/
public static void main(String[] args) {
final Viktor model = new Viktor();
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
solver.options().setReporter(new ConsoleReporter());
solver.options().setBitwidth(7);
final Formula f = model.checkEquations();
final Bounds b = model.bounds();
System.out.println(f);
System.out.println(b);
final Solution sol = solver.solve(f, b);
System.out.println(sol);
if (sol.instance() != null)
model.display(sol.instance(), solver.options());
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class ConfigAssure method main.
/**
* Usage: java examples.ConfigAssure <ipAddresses file> <subnets file>
*/
public static void main(String[] args) {
if (args.length < 2)
usage();
try {
final ConfigAssure ca = new ConfigAssure();
final Solver solver = new Solver();
solver.options().setBitwidth(32);
solver.options().setSolver(SATFactory.MiniSat);
final Formula formula = ca.requirements();
final Bounds bounds = ca.bounds(args[0], args[1]);
System.out.println("---explicit requirements (others are implicit in the bounds)---");
System.out.println(PrettyPrinter.print(formula, 2));
System.out.println("\n---solving with config files " + args[0] + " and " + args[1] + "---");
final Solution sol = solver.solve(formula, bounds);
System.out.println("\n---OUTCOME---");
System.out.println(sol.outcome());
System.out.println("\n---STATS---");
System.out.println(sol.stats());
if (sol.instance() != null) {
System.out.println("\n---INSTANCE--");
ca.display(sol.instance(), solver.options());
}
} catch (IOException ioe) {
ioe.printStackTrace();
usage();
}
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class Netconfig method main.
/**
* Usage: java examples.Netconfig [# sites] [# hq] [# routers] [# time steps]
*/
public static void main(String[] args) {
if (args.length < 4)
usage();
final Netconfig model = new Netconfig();
final Solver solver = new Solver();
// solver.options().setSolver(SATFactory.ZChaffMincost);
solver.options().setSolver(SATFactory.MiniSat);
try {
final Formula show = model.show();
final Solution sol = solver.solve(show, model.bounds(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])));
// System.out.println(show);
// System.out.println("p cnf " +
// (solver.numberOfIntermediateVariables()+solver.numberOfPrimaryVariables())
// + " " + solver.numberOfClauses());
System.out.println(sol.outcome());
System.out.println(sol.stats());
} catch (NumberFormatException nfe) {
usage();
}
}
use of kodkod.engine.Solution in project org.alloytools.alloy by AlloyTools.
the class ALG212 method main.
/**
* Usage: java examples.tptp.ALG212 [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 ALG212 model = new ALG212();
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
// solver.options().setSymmetryBreaking(n*n);
// solver.options().setFlatten(false);
final Formula f = model.checkDistLong();
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();
}
}
Aggregations