Package solver

Examples of solver.Solver.post()


    @Test(groups = "1s")
    public void testalldifferent_cond() {
        Solver solver = new Solver();
        IntVar[] XS = VF.enumeratedArray("XS", 5, 0, 3, solver);
        solver.post(ICF.alldifferent_conditionnal(XS,
                new Condition() {
                    @Override
                    public boolean holdOnVar(IntVar x) {
                        return !x.contains(1) && !x.contains(3);
                    }
View Full Code Here


    @Test(groups = "1s")
    public void testalldifferent_exc0() {
        Solver solver = new Solver();
        IntVar[] XS = VF.enumeratedArray("XS", 4, 0, 2, solver);
        solver.post(ICF.alldifferent_except_0(XS));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

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

    @Test(groups = "1s")
    public void testamong() {
        Solver solver = new Solver();
        IntVar N = VF.enumerated("N", 2, 3, solver);
        IntVar[] XS = VF.enumeratedArray("XS", 4, 0, 6, solver);
        solver.post(ICF.among(N, XS, new int[]{1, 2, 3}));
        SMF.log(solver, true, false);
        solver.findAllSolutions();

    }
View Full Code Here

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

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

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

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

    public void testbin_packing() {
        Solver solver = new Solver();
        IntVar[] IBIN = VF.enumeratedArray("IBIN", 5, 1, 3, solver);
        int[] sizes = new int[]{2, 3, 1, 4, 2};
        IntVar[] BLOADS = VF.enumeratedArray("BLOADS", 3, 0, 5, solver);
        solver.post(ICF.bin_packing(IBIN, sizes, BLOADS, 1));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

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

    @Test(groups = "1s")
    public void testboolean_channeling() {
        Solver solver = new Solver();
        BoolVar[] BVARS = VF.boolArray("BVARS", 5, solver);
        IntVar VAR = VF.enumerated("VAR", 1, 5, solver);
        solver.post(ICF.boolean_channeling(BVARS, VAR, 1));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

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

    @Test(groups = "1s")
    public void testcircuit() {
        Solver solver = new Solver();
        IntVar[] NODES = VF.enumeratedArray("NODES", 5, 0, 4, solver);
        solver.post(ICF.circuit(NODES, 0, CircuitConf.LIGHT));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

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

        costs[1] = new int[]{2, 3, 1};
        costs[2] = new int[]{3, 1, 2};
        costs[3] = new int[]{3, 2, 1};
        costs[4] = new int[]{2, 1, 3};

        solver.post(ICF.cost_regular(VARS, COST, CostAutomaton.makeSingleResource(fauto, costs, COST.getLB(), COST.getUB())));
        SMF.log(solver, true, false);
        solver.findAllSolutions();
    }

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

    public void testcount() {
        Solver solver = new Solver();
        IntVar[] VS = VF.enumeratedArray("VS", 4, 0, 3, solver);
        IntVar VA = VF.enumerated("VA", new int[]{1, 3}, solver);
        IntVar CO = VF.enumerated("CO", new int[]{0, 2, 4}, solver);
        solver.post(ICF.count(VA, VS, CO));
        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.