Package solver

Examples of solver.Solver.post()


    @Test(groups = "1s")
    public void testsort() {
        Solver solver = new Solver();
        IntVar[] X = VF.enumeratedArray("X", 3, 0, 2, solver);
        IntVar[] Y = VF.enumeratedArray("Y", 3, 0, 2, solver);
        solver.post(ICF.sort(X, Y));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here


    @Test(groups = "1s")
    public void testsubcircuit() {
        Solver solver = new Solver();
        IntVar[] NODES = VF.enumeratedArray("NS", 5, 0, 4, solver);
        IntVar SI = VF.enumerated("SI", 2, 3, solver);
        solver.post(ICF.subcircuit(NODES, 0, SI));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

        Solver solver = new Solver();
        IntVar[] VS = VF.enumeratedArray("VS", 4, 0, 4, solver);
        IntVar S = VF.enumerated("S", 0, 3, solver);
        IntVar E = VF.enumerated("E", 0, 3, solver);
        IntVar SI = VF.enumerated("SI", 2, 3, solver);
        solver.post(ICF.subpath(VS, S, E, 0, SI));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

    @Test(groups = "1s")
    public void testsum() {
        Solver solver = new Solver();
        IntVar[] VS = VF.enumeratedArray("VS", 4, 0, 4, solver);
        IntVar SU = VF.enumerated("SU", 2, 3, solver);
        solver.post(ICF.sum(VS, "<=", SU));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

    @Test(groups = "1s")
    public void testtree() {
        Solver solver = new Solver();
        IntVar[] VS = VF.enumeratedArray("VS", 4, 0, 4, solver);
        IntVar NT = VF.enumerated("NT", 2, 3, solver);
        solver.post(ICF.tree(VS, NT, 0));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

    public void testtsp() {
        Solver solver = new Solver();
        IntVar[] VS = VF.enumeratedArray("VS", 4, 0, 4, solver);
        IntVar CO = VF.enumerated("CO", 0, 15, solver);
        int[][] costs = new int[][]{{0, 1, 3, 7}, {1, 0, 1, 3}, {3, 1, 0, 1}, {7, 3, 1, 0}};
        solver.post(ICF.tsp(VS, CO, costs));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

    @Test(groups = "1s")
    public void testbit_channeling() {
        Solver solver = new Solver();
        BoolVar[] BVARS = VF.boolArray("BVARS", 4, solver);
        IntVar VAR = VF.enumerated("VAR", 0, 15, solver);
        solver.post(ICF.bit_channeling(BVARS, VAR));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }
}
View Full Code Here

    public void testmod() {
        Solver solver = new Solver();
        IntVar X = VF.enumerated("X", 2, 4, solver);
        IntVar Y = VF.enumerated("Y", -1, 4, solver);
        IntVar Z = VF.enumerated("Z", 1, 3, solver);
        solver.post(ICF.mod(X, Y, Z));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

    public void testtimes() {
        Solver solver = new Solver();
        IntVar X = VF.enumerated("X", -1, 2, solver);
        IntVar Y = VF.enumerated("Y", 2, 4, solver);
        IntVar Z = VF.enumerated("Z", 5, 7, solver);
        solver.post(ICF.times(X, Y, Z));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

        Solver solver = new Solver();
        IntVar W = VF.enumerated("W", 0, 1, solver);
        IntVar X = VF.enumerated("X", -1, 2, solver);
        IntVar Y = VF.enumerated("Y", 2, 4, solver);
        IntVar Z = VF.enumerated("Z", 5, 7, solver);
        solver.post(ICF.alldifferent(new IntVar[]{W, X, Y, Z}));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

    @Test(groups = "1s")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.