Package solver.variables

Examples of solver.variables.BoolVar


    @Test(groups = "1s")
    public void test6() {
        Solver solver = new Solver();

        BoolVar a = VariableFactory.bool("a", solver);
        BoolVar b = VariableFactory.bool("b", solver);

        LogOp root = LogOp.implies(a, b);

        ILogical l = LogicTreeToolBox.toCNF(root, solver);
View Full Code Here


    @Test(groups = "1s")
    public void test7() {
        Solver solver = new Solver();

        BoolVar a = VariableFactory.bool("a", solver);
        BoolVar b = VariableFactory.bool("b", solver);
        BoolVar c = VariableFactory.bool("c", solver);


        LogOp root = LogOp.ifThenElse(a, b, c);

        ILogical l = LogicTreeToolBox.toCNF(root, solver);
View Full Code Here

    @Test(groups = "1s")
    public void test8() {
        Solver solver = new Solver();

        BoolVar a = VariableFactory.bool("a", solver);
        BoolVar na = a.not();
        BoolVar b = VariableFactory.bool("b", solver);
        BoolVar nb = b.not();
        BoolVar c = VariableFactory.bool("c", solver);
        BoolVar d = VariableFactory.bool("d", solver);

        LogOp root = LogOp.and(LogOp.or(a, b, na), LogOp.or(c, d), LogOp.or(b, nb));

        ILogical l = LogicTreeToolBox.toCNF(root, solver);
View Full Code Here

    @Test(groups = "1s")
    public void test9() {
        Solver solver = new Solver();

        BoolVar a = VariableFactory.bool("a", solver);
        BoolVar na = a.not();
        BoolVar b = VariableFactory.bool("b", solver);
        BoolVar c = VariableFactory.bool("c", solver);
        BoolVar d = VariableFactory.bool("d", solver);

        LogOp root = LogOp.and(a, b, na, c, d);

        ILogical l = LogicTreeToolBox.toCNF(root, solver);
View Full Code Here

    }

    @Test(groups = "1s")
    public void test3() {
        Solver solver = new Solver("Choco");
        BoolVar b = VF.bool("b", solver);
        VF.not(b);
        b.not();
        VF.eq(b);
        IntVar e = VF.enumerated("e", 1, 3, solver);
        VF.offset(e, -2);
        VF.scale(e, 3);
        VF.minus(e);
View Full Code Here

    @Test(groups = "1s")
    public void test46() {
        Solver solver = new Solver("Choco");
        BoolVar[] X = VF.boolArray("vs", 3, solver);
        BoolVar M = VF.bool("M", solver);
        solver.post(ICF.maximum(M, X));

        Solver copy = solver.duplicateModel();

        solver.findAllSolutions();
View Full Code Here

    @Test(groups = "1s")
    public void test47() {
        Solver solver = new Solver("Choco");
        BoolVar[] X = VF.boolArray("vs", 3, solver);
        BoolVar M = VF.bool("M", solver);
        solver.post(ICF.minimum(M, X));

        Solver copy = solver.duplicateModel();

        solver.findAllSolutions();
View Full Code Here

    @Test(groups = "1s")
    public void test49() {
        Solver solver = new Solver("Choco");
        BoolVar[] X = VF.boolArray("vs", 3, solver);
        BoolVar M = VF.bool("M", solver);
        solver.post(ICF.nvalues(X, M));

        Solver copy = solver.duplicateModel();

        solver.findAllSolutions();
View Full Code Here

    @Test(groups = "1s")
    public void testJGF() {
        for (int i = 0; i < 2; i++) {

            Solver solver = new Solver();
            BoolVar a = VariableFactory.bool("a", solver);
            BoolVar b = VariableFactory.bool("b", solver);
            IntVar x = VariableFactory.bounded("x", 0, 24, solver);
            IntVar y = VariableFactory.bounded("y", 0, 24, solver);

            if (i == 0) {
                SatFactory.addClauses(LogOp.implies(
                        a,
                        b
                ), solver);
            } else {
                SatFactory.addClauses(LogOp.implies(
                        b.not(),
                        a.not()
                ), solver);
            }
            solver.post(LogicalConstraintFactory.ifThenElse(b, IntConstraintFactory.arithm(x, ">=", y), IntConstraintFactory.arithm(x, "<", y)));
//            SearchMonitorFactory.log(solver, true, true);
View Full Code Here

//                        Blist.add(b);
//                        Constraint cB = ConstraintFactory.leq(X[j], l, solver, eng2);
//                        Constraint ocB = ConstraintFactory.geq(X[j], l + 1, solver, eng2);
//                        lcstrs.add(new ReifiedConstraint(b, cB, ocB, solver, eng2));
                for (int q = p; q <= u; q++) {
                    BoolVar a = VariableFactory.bool("A" + j + "_" + p + "_" + q, solver);
                    mA[j][p - l][q - p] = a;
                    listA.add(a);

                    Constraint cA = IntConstraintFactory.member(X[j], p, q);
                    Constraint ocA = IntConstraintFactory.not_member(X[j], p, q);
View Full Code Here

TOP

Related Classes of solver.variables.BoolVar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.