Package solver.variables

Examples of solver.variables.BoolVar


        // START extra variables/constraints for guided improvement algorithm
        List<Constraint> stack = new ArrayList<>();
        IntVar lbA = VF.enumerated("lbA", 0, 2, solver);
        IntVar lbB = VF.enumerated("lbB", 0, 2, solver);
        BoolVar aSBetter = ICF.arithm(a, ">", lbA).reif();
        BoolVar bSBetter = ICF.arithm(b, ">", lbB).reif();
        BoolVar aBetter = ICF.arithm(a, ">=", lbA).reif();
        BoolVar bBetter = ICF.arithm(b, ">=", lbB).reif();
        push(ICF.arithm(lbA, "=", a), stack, solver);
        push(ICF.arithm(lbB, "=", b), stack, solver);
        Constraint strictlyBetter
                = LCF.or(
                LCF.and(aSBetter, bBetter),
View Full Code Here


    @Test(groups = "1s")
    public void test4() {
        Solver solver = new Solver();
        IntVar iv = VF.enumerated("iv", 0, 10, solver);
        BoolVar v = ICF.arithm(iv, "<=", 2).reif();

        solver.findOptimalSolution(ResolutionPolicy.MINIMIZE, v);
//        System.out.println("Minimum1: " + iv + " : " + solver.isSatisfied());
        Assert.assertEquals(ESat.TRUE, solver.isSatisfied());
View Full Code Here

    }

    @Test(groups = "1s")
    public void testJL1() {
        Solver solver = new Solver();
        BoolVar b1 = VF.bool("b1", solver);
        BoolVar b2 = VF.bool("b2", solver);
        solver.post(ICF.arithm(b1, "<=", b2));
//        SMF.log(solver, true, true);
        solver.set(new ObjectiveManager<IntVar, Integer>(b1, ResolutionPolicy.MINIMIZE, true));
        //search.plugSearchMonitor(new LastSolutionRecorder(new Solution(), true, solver));
        if (solver.getEngine() == NoPropagationEngine.SINGLETON) {
View Full Code Here

public class SatTest {

    @Test(groups = "1s")
    public void test1() {
        Solver solver = new Solver();
        BoolVar b1, b2;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        SatFactory.addBoolEq(b1, b2);
        solver.findAllSolutions();
        Assert.assertEquals(solver.getMeasures().getSolutionCount(), 2);
View Full Code Here

    }

    @Test(groups = "1s")
    public void test2() {
        Solver solver = new Solver();
        BoolVar b1, b2;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        SatFactory.addBoolNot(b1, b2);
        solver.findAllSolutions();
        Assert.assertEquals(solver.getMeasures().getSolutionCount(), 2);
View Full Code Here

    }

    @Test(groups = "1s")
    public void test3() {
        Solver solver = new Solver();
        BoolVar b1, b2;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        SatFactory.addBoolLe(b1, b2);
        solver.findAllSolutions();
        Assert.assertEquals(solver.getMeasures().getSolutionCount(), 3);
View Full Code Here


    @Test(groups = "1s")
    public void test4() {
        Solver solver = new Solver();
        BoolVar b1, b2, r;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        r = VF.bool("r", solver);
        SatFactory.addBoolIsEqVar(b1, b2, r);
        solver.findAllSolutions();
View Full Code Here

    }

    @Test(groups = "1s")
    public void test5() {
        Solver solver = new Solver();
        BoolVar b1, b2, r;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        r = VF.bool("r", solver);
        SatFactory.addBoolAndEqVar(b1, b2, r);
        solver.findAllSolutions();
View Full Code Here

    }

    @Test(groups = "1s")
    public void test6() {
        Solver solver = new Solver();
        BoolVar b1, b2, r;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        r = VF.bool("r", solver);
        SatFactory.addBoolOrEqVar(b1, b2, r);
        solver.findAllSolutions();
View Full Code Here

    }

    @Test(groups = "1s")
    public void test7() {
        Solver solver = new Solver();
        BoolVar b1, b2;
        b1 = VF.bool("b1", solver);
        b2 = VF.bool("b2", solver);
        SatFactory.addBoolLt(b1, b2);
        solver.findAllSolutions();
        Assert.assertEquals(solver.getMeasures().getSolutionCount(), 1);
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.