Search in sources :

Example 6 with Options

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

the class IncrementalOverflowNumTest method testBasic.

@Test
public void testBasic() {
    Options opt = new Options();
    opt.setNoOverflow(true);
    opt.setBitwidth(2);
    IncrementalSolver solver = IncrementalSolver.solver(opt);
    Universe univ = new Universe("-2", "-1", "0", "1");
    Bounds b = new Bounds(univ);
    TupleFactory factory = univ.factory();
    b.boundExactly(-2, factory.range(factory.tuple("-2"), factory.tuple("-2")));
    b.boundExactly(-1, factory.range(factory.tuple("-1"), factory.tuple("-1")));
    b.boundExactly(0, factory.range(factory.tuple("0"), factory.tuple("0")));
    b.boundExactly(1, factory.range(factory.tuple("1"), factory.tuple("1")));
    Variable n = Variable.unary("n");
    Formula f = n.sum().plus(IntConstant.constant(1)).lte(n.sum()).forSome(n.oneOf(Expression.INTS));
    Solution sol = solver.solve(f, b);
    assertNoInstance(sol);
}
Also used : Options(kodkod.engine.config.Options) Formula(kodkod.ast.Formula) Variable(kodkod.ast.Variable) Bounds(kodkod.instance.Bounds) TupleFactory(kodkod.instance.TupleFactory) Universe(kodkod.instance.Universe) IncrementalSolver(kodkod.engine.IncrementalSolver) Solution(kodkod.engine.Solution) Test(org.junit.Test)

Example 7 with Options

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

the class OverflowNumTest method setupOptions.

protected void setupOptions() {
    options = new Options();
    options.setNoOverflow(true);
    options.setBitwidth(bw());
    options.setSolver(SATFactory.MiniSat);
}
Also used : Options(kodkod.engine.config.Options)

Example 8 with Options

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

the class OverflowSigTest method createOptions.

protected void createOptions(int bw) {
    this.options = new Options();
    options.setNoOverflow(true);
    options.setBitwidth(bw);
    options.setSolver(SATFactory.MiniSat);
}
Also used : Options(kodkod.engine.config.Options)

Example 9 with Options

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

the class OverflowTheoremTest method setupOptions.

protected void setupOptions() {
    options = new Options();
    options.setNoOverflow(true);
    options.setBitwidth(bw);
    options.setSolver(SATFactory.MiniSat);
    options.setSkolemDepth(0);
}
Also used : Options(kodkod.engine.config.Options)

Example 10 with Options

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

the class IntTest method testComparisonOps.

/**
 * Tests all comparison ops for this.solver.options and range of vals.
 *
 * @requires this.solver.options.intEncoding = binary
 * @requires vals contains int expressions that represent all integers allowed
 *           by this.solver.options, in proper sequence
 */
private final void testComparisonOps(IntExpression[] vals) {
    final Options options = solver.options();
    final IntRange range = options.integers();
    final int min = range.min(), max = range.max();
    for (int i = min; i <= max; i++) {
        IntExpression vi = vals[i - min];
        for (int j = min; j <= max; j++) {
            IntExpression vj = vals[j - min];
            testCompOp(EQ, vi, vj, i, j, i == j);
            testCompOp(LT, vi, vj, i, j, i < j);
            testCompOp(LTE, vi, vj, i, j, i <= j);
            testCompOp(GT, vi, vj, i, j, i > j);
            testCompOp(GTE, vi, vj, i, j, i >= j);
        }
    }
}
Also used : Options(kodkod.engine.config.Options) IntExpression(kodkod.ast.IntExpression) IntRange(kodkod.util.ints.IntRange)

Aggregations

Options (kodkod.engine.config.Options)13 IntExpression (kodkod.ast.IntExpression)5 IntRange (kodkod.util.ints.IntRange)5 Relation (kodkod.ast.Relation)3 Bounds (kodkod.instance.Bounds)3 Formula (kodkod.ast.Formula)2 Solution (kodkod.engine.Solution)2 TupleFactory (kodkod.instance.TupleFactory)2 LinkedHashSet (java.util.LinkedHashSet)1 Variable (kodkod.ast.Variable)1 IncrementalSolver (kodkod.engine.IncrementalSolver)1 Solver (kodkod.engine.Solver)1 BooleanFormula (kodkod.engine.bool.BooleanFormula)1 BooleanValue (kodkod.engine.bool.BooleanValue)1 HOLTranslation (kodkod.engine.hol.HOLTranslation)1 TupleSet (kodkod.instance.TupleSet)1 Universe (kodkod.instance.Universe)1 Test (org.junit.Test)1