Search in sources :

Example 56 with Bounds

use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.

the class MED001 method bounds.

/**
 * Returns bounds for the given scope.
 *
 * @return bounds for the given scope.
 */
public final Bounds bounds(int n) {
    assert n > 0;
    final List<String> atoms = new ArrayList<String>(n);
    for (int i = 0; i < n; i++) atoms.add("a" + i);
    final Universe u = new Universe(atoms);
    final Bounds b = new Bounds(u);
    final TupleFactory f = u.factory();
    final TupleSet s = f.allOf(1);
    b.bound(bcapacityne, s);
    b.bound(bcapacityex, s);
    b.bound(bcapacitysn, s);
    b.bound(conditionhyper, s);
    b.bound(conditionhypo, s);
    b.bound(conditionnormo, s);
    b.bound(drugi, s);
    b.bound(uptakelg, s);
    b.bound(uptakepg, s);
    b.bound(releaselg, s);
    b.bound(bsecretioni, s);
    b.bound(drugbg, s);
    b.bound(qilt27, s);
    b.bound(s0, s);
    b.bound(s1, s);
    b.bound(s2, s);
    b.bound(s3, s);
    b.bound(drugsu, s);
    b.bound(n0, s);
    b.bound(gt, f.allOf(2));
    return b;
}
Also used : TupleSet(kodkod.instance.TupleSet) Bounds(kodkod.instance.Bounds) ArrayList(java.util.ArrayList) TupleFactory(kodkod.instance.TupleFactory) Universe(kodkod.instance.Universe)

Example 57 with Bounds

use of kodkod.instance.Bounds 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 58 with Bounds

use of kodkod.instance.Bounds 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)

Example 59 with Bounds

use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.

the class SET948 method bounds.

/**
 * Returns bounds for the given scope.
 *
 * @return bounds for the given scope.
 */
public final Bounds bounds(int n) {
    assert n > 0;
    final List<String> atoms = new ArrayList<String>(n);
    for (int i = 0; i < n; i++) atoms.add("a" + i);
    final Universe u = new Universe(atoms);
    final Bounds b = new Bounds(u);
    final TupleFactory f = u.factory();
    b.bound(empty, f.allOf(1));
    b.bound(subset, f.allOf(2));
    b.bound(in, f.allOf(2));
    b.bound(disjoint, f.allOf(2));
    b.bound(union, f.allOf(2));
    b.bound(intersect2, f.allOf(3));
    b.bound(union2, f.allOf(3));
    return b;
}
Also used : Bounds(kodkod.instance.Bounds) ArrayList(java.util.ArrayList) TupleFactory(kodkod.instance.TupleFactory) Universe(kodkod.instance.Universe)

Example 60 with Bounds

use of kodkod.instance.Bounds in project org.alloytools.alloy by AlloyTools.

the class MGT066 method main.

/**
 * Usage: java examples.tptp.MGT066 [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 MGT066 model = new MGT066();
        final Solver solver = new Solver();
        solver.options().setSolver(SATFactory.MiniSat);
        solver.options().setSymmetryBreaking(n * n);
        final Formula f = model.axioms();
        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

Bounds (kodkod.instance.Bounds)140 Formula (kodkod.ast.Formula)83 Universe (kodkod.instance.Universe)79 TupleFactory (kodkod.instance.TupleFactory)76 Solution (kodkod.engine.Solution)75 Solver (kodkod.engine.Solver)67 TupleSet (kodkod.instance.TupleSet)55 Relation (kodkod.ast.Relation)49 ArrayList (java.util.ArrayList)45 Expression (kodkod.ast.Expression)21 Variable (kodkod.ast.Variable)21 IntExpression (kodkod.ast.IntExpression)20 Instance (kodkod.instance.Instance)12 Decls (kodkod.ast.Decls)11 Evaluator (kodkod.engine.Evaluator)8 HigherOrderDeclException (kodkod.engine.fol2sat.HigherOrderDeclException)7 UnboundLeafException (kodkod.engine.fol2sat.UnboundLeafException)7 ConsoleReporter (kodkod.engine.config.ConsoleReporter)6 Tuple (kodkod.instance.Tuple)6 LinkedHashSet (java.util.LinkedHashSet)5