use of kodkod.engine.config.ConsoleReporter in project org.alloytools.alloy by AlloyTools.
the class AbstractWorldDefinitions method main.
/**
* Usage: java examples.AbstractWorldDefinitions [A241 | AbOp_total |
* AbIgnore_inv | AbTransfer_inv] [univ size]
*/
public static void main(String[] args) {
if (args.length < 2)
usage();
try {
final String assertion = args[0];
final int n = Integer.parseInt(args[1]);
if (n < 1)
usage();
final AbstractWorldDefinitions model = new AbstractWorldDefinitions();
final Solver solver = new Solver();
solver.options().setSolver(SATFactory.MiniSat);
solver.options().setReporter(new ConsoleReporter());
// solver.options().setFlatten(true);
final Method method = model.getClass().getMethod(assertion);
final Formula f = model.decls().and(((Formula) method.invoke(model)).not());
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();
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
usage();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations