Search in sources :

Example 71 with Solution

use of kodkod.engine.Solution 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 72 with Solution

use of kodkod.engine.Solution 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 73 with Solution

use of kodkod.engine.Solution 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 74 with Solution

use of kodkod.engine.Solution 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 75 with Solution

use of kodkod.engine.Solution 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

Solution (kodkod.engine.Solution)153 Formula (kodkod.ast.Formula)101 Bounds (kodkod.instance.Bounds)75 Solver (kodkod.engine.Solver)72 Universe (kodkod.instance.Universe)32 Relation (kodkod.ast.Relation)30 TupleFactory (kodkod.instance.TupleFactory)30 TupleSet (kodkod.instance.TupleSet)25 Variable (kodkod.ast.Variable)24 IntExpression (kodkod.ast.IntExpression)19 Expression (kodkod.ast.Expression)17 Test (org.junit.Test)16 QuantifiedFormula (kodkod.ast.QuantifiedFormula)15 Decls (kodkod.ast.Decls)11 Evaluator (kodkod.engine.Evaluator)10 HigherOrderDeclException (kodkod.engine.fol2sat.HigherOrderDeclException)7 UnboundLeafException (kodkod.engine.fol2sat.UnboundLeafException)7 ConsoleReporter (kodkod.engine.config.ConsoleReporter)6 Instance (kodkod.instance.Instance)6 ArrayList (java.util.ArrayList)5