Package solver

Examples of solver.Solver.post()


            return b;
        } else {
            Solver solver = a.getSolver();
            IntVar z = new IntervalIntVarImpl(StringUtils.randomName(),
                    Math.min(a.getLB(), b.getLB()), Math.min(a.getUB(), b.getUB()), solver);
            solver.post(IntConstraintFactory.minimum(z, a, b));
            return z;
        }
    }
}
View Full Code Here


        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                int k = j - i;
                Constraint neq = IntConstraintFactory.arithm(vars[i], "!=", vars[j]);
                s.post(neq);
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
        }
View Full Code Here

        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                int k = j - i;
                Constraint neq = IntConstraintFactory.arithm(vars[i], "!=", vars[j]);
                s.post(neq);
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
        }

View Full Code Here

            for (int j = i + 1; j < n; j++) {
                int k = j - i;
                Constraint neq = IntConstraintFactory.arithm(vars[i], "!=", vars[j]);
                s.post(neq);
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
        }


        File file = null;
View Full Code Here

        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                int k = j - i;
                Constraint neq = IntConstraintFactory.arithm(vars[i], "!=", vars[j]);
                s.post(neq);
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
        }
        Solver clone = s.duplicateModel();
View Full Code Here

        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                int k = j - i;
                Constraint neq = IntConstraintFactory.arithm(vars[i], "!=", vars[j]);
                s.post(neq);
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
        }
        Solver clone = s.duplicateModel();
        Assert.assertNotNull(s);
View Full Code Here

            for (int j = i + 1; j < n; j++) {
                int k = j - i;
                Constraint neq = IntConstraintFactory.arithm(vars[i], "!=", vars[j]);
                s.post(neq);
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                s.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
        }
        Solver clone = s.duplicateModel();
        Assert.assertNotNull(s);
    }
View Full Code Here

    public void testEq() throws ContradictionException {
        Solver solver = new Solver();
        IntVar x = VariableFactory.enumerated("X", 1, 6, solver);
        IntVar y = VariableFactory.enumerated("Y", 1, 6, solver);

        solver.post(IntConstraintFactory.arithm(x, "=", y));

        solver.propagate();

        x.removeValue(4, Cause.Null);
View Full Code Here

        final SetVar s0 = VF.set("s0", 0, 1, solver);
        final BoolVar b0 = VF.bool("b0", solver);
        final BoolVar b1 = VF.bool("b1", solver);
        final IntVar i0 = VF.bool("i0", solver);
        solver.set(ISF.lexico_LB(i0));
        solver.post(SCF.bool_channel(new BoolVar[]{b0, b1}, s0, 0));
        solver.post(SCF.cardinality(s0, VF.fixed(0, solver)));

        solver.findSolution();
        solver.getSearchLoop().reset();
        solver.findSolution();
View Full Code Here

        final BoolVar b0 = VF.bool("b0", solver);
        final BoolVar b1 = VF.bool("b1", solver);
        final IntVar i0 = VF.bool("i0", solver);
        solver.set(ISF.lexico_LB(i0));
        solver.post(SCF.bool_channel(new BoolVar[]{b0, b1}, s0, 0));
        solver.post(SCF.cardinality(s0, VF.fixed(0, solver)));

        solver.findSolution();
        solver.getSearchLoop().reset();
        solver.findSolution();
    }
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.