Search in sources :

Example 26 with Solver

use of kodkod.engine.Solver in project org.alloytools.alloy by AlloyTools.

the class ALG195_1 method main.

/**
 * Usage: java examples.tptp.ALG195_1
 */
public static void main(String[] args) {
    try {
        final ALG195_1 model = new ALG195_1();
        final Solver solver = new Solver();
        solver.options().setSolver(SATFactory.MiniSat);
        final Formula f = model.axioms().and(model.co1().not());
        final Bounds b = model.bounds();
        // System.out.println(model.decls());
        // System.out.println(model.ax2ax7());
        // System.out.println(b);
        final Solution sol = solver.solve(f, b);
        if (sol.instance() == null) {
            System.out.println(sol);
        } else {
            System.out.println(sol.stats());
            model.display(sol.instance());
        }
    } catch (NumberFormatException nfe) {
        usage();
    }
}
Also used : Formula(kodkod.ast.Formula) Solver(kodkod.engine.Solver) Bounds(kodkod.instance.Bounds) Solution(kodkod.engine.Solution)

Example 27 with Solver

use of kodkod.engine.Solver in project org.alloytools.alloy by AlloyTools.

the class COM008 method main.

/**
 * Usage: java examples.tptp.COM008 [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 COM008 model = new COM008();
        final Solver solver = new Solver();
        solver.options().setSolver(SATFactory.MiniSat);
        // solver.options().setSymmetryBreaking(22);
        // solver.options().setFlatten(false);
        final Formula f = model.checkGoalToBeProved();
        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();
    }
}
Also used : Formula(kodkod.ast.Formula) Solver(kodkod.engine.Solver) Bounds(kodkod.instance.Bounds) Solution(kodkod.engine.Solution)

Example 28 with Solver

use of kodkod.engine.Solver in project org.alloytools.alloy by AlloyTools.

the class GEO158 method main.

/**
 * Usage: java examples.tptp.GEO158 [# univ size ]
 */
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 GEO158 model = new GEO158();
        final Formula f = model.checkConsistent();
        // System.out.println(model.decls());
        // System.out.println(model.partOfDefn());
        // System.out.println(model.sumDefn());
        // 
        // System.out.println(model.endPointDefn());
        // System.out.println(model.innerPointDefn());
        // System.out.println(model.meetDefn());
        // 
        // System.out.println(model.openDefn());
        // System.out.println(model.closedDefn());
        // System.out.println(model.c1());
        // 
        // System.out.println(model.c2());
        // System.out.println(model.c3());
        // System.out.println(model.c4());
        // 
        // System.out.println(model.c6());
        // System.out.println(model.c7());
        // System.out.println(model.c8());
        // 
        // System.out.println(model.c9());
        final Bounds b = model.bounds(n);
        final Solution sol = solver.solve(f, b);
        System.out.println(sol);
    } catch (NumberFormatException nfe) {
        usage();
    }
}
Also used : Formula(kodkod.ast.Formula) Solver(kodkod.engine.Solver) Bounds(kodkod.instance.Bounds) Solution(kodkod.engine.Solution)

Example 29 with Solver

use of kodkod.engine.Solver in project org.alloytools.alloy by AlloyTools.

the class MED009 method main.

/**
 * Usage: java examples.tptp.MED009 [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 MED009 model = new MED009();
        final Solver solver = new Solver();
        solver.options().setSolver(SATFactory.MiniSat);
        // solver.options().setSymmetryBreaking(1000);
        // solver.options().setFlatten(false);
        final Formula f = model.checkTranssls2_qige27();
        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();
    }
}
Also used : Formula(kodkod.ast.Formula) Solver(kodkod.engine.Solver) Bounds(kodkod.instance.Bounds) Solution(kodkod.engine.Solution)

Example 30 with Solver

use of kodkod.engine.Solver in project org.alloytools.alloy by AlloyTools.

the class NUM374 method main.

/**
 * Usage: java examples.tptp.NUM374 [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 NUM374 model = new NUM374();
        final Solver solver = new Solver();
        solver.options().setSolver(SATFactory.MiniSat);
        solver.options().setSymmetryBreaking(n * n);
        final Formula f = model.checkWilkie();
        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();
    }
}
Also used : Formula(kodkod.ast.Formula) Solver(kodkod.engine.Solver) Bounds(kodkod.instance.Bounds) Solution(kodkod.engine.Solution)

Aggregations

Solver (kodkod.engine.Solver)76 Solution (kodkod.engine.Solution)72 Formula (kodkod.ast.Formula)67 Bounds (kodkod.instance.Bounds)67 Universe (kodkod.instance.Universe)26 TupleFactory (kodkod.instance.TupleFactory)25 Relation (kodkod.ast.Relation)24 TupleSet (kodkod.instance.TupleSet)23 Expression (kodkod.ast.Expression)14 IntExpression (kodkod.ast.IntExpression)14 Variable (kodkod.ast.Variable)14 Decls (kodkod.ast.Decls)11 HigherOrderDeclException (kodkod.engine.fol2sat.HigherOrderDeclException)7 UnboundLeafException (kodkod.engine.fol2sat.UnboundLeafException)7 ConsoleReporter (kodkod.engine.config.ConsoleReporter)6 LinkedHashSet (java.util.LinkedHashSet)5 Evaluator (kodkod.engine.Evaluator)3 AbstractReporter (kodkod.engine.config.AbstractReporter)3 Instance (kodkod.instance.Instance)3 Method (java.lang.reflect.Method)2