Package solver

Examples of solver.Solver


     * @param RIGHT  another boolean variable
     * @param TARGET the reified boolean variable
     * @return true if the clause has been added to the clause store
     */
    public static boolean addBoolIsLeVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET) {
        Solver solver = TARGET.getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        int left_lit = sat.Literal(LEFT);
        int right_lit = sat.Literal(RIGHT);
        int target_lit = sat.Literal(TARGET);
        sat.addClause(SatSolver.negated(left_lit), right_lit, SatSolver.negated(target_lit));
        sat.addClause(left_lit, target_lit);
View Full Code Here


     * @param RIGHT  another boolean variable
     * @param TARGET the reified boolean variable
     * @return true if the clause has been added to the clause store
     */
    public static boolean addBoolIsLtVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET) {
        Solver solver = TARGET.getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        int left_lit = sat.Literal(LEFT);
        int right_lit = sat.Literal(RIGHT);
        int target_lit = sat.Literal(TARGET);
        sat.addClause(left_lit, right_lit, SatSolver.negated(target_lit));
        sat.addClause(SatSolver.negated(left_lit), right_lit, SatSolver.negated(target_lit));
View Full Code Here

     *
     * @param BOOLVARS a list of boolean variables
     * @return true if the clause has been added to the clause store
     */
    public static boolean addBoolOrArrayEqualTrue(BoolVar[] BOOLVARS) {
        Solver solver = BOOLVARS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        TIntList lits = new TIntArrayList(BOOLVARS.length);
        for (int i = 0; i < BOOLVARS.length; i++) {
            lits.add(sat.Literal(BOOLVARS[i]));
        }
        sat.addClause(lits);
View Full Code Here

     *
     * @param BOOLVARS a list of boolean variables
     * @return true if the clause has been added to the clause store
     */
    public static boolean addAtMostOne(BoolVar[] BOOLVARS) {
        Solver solver = BOOLVARS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        TIntList lits = new TIntArrayList(BOOLVARS.length);
        for (int i = 0; i < BOOLVARS.length; i++) {
            lits.add(SatSolver.negated(sat.Literal(BOOLVARS[i])));
        }
        for (int i = 0; i < lits.size() - 1; i++) {
View Full Code Here

    int[] freqs;
    int[] rank;

    @Override
    public void createSolver() {
        solver = new Solver("RLFAP " + dir);
    }
View Full Code Here

     *
     * @param BOOLVARS a list of boolean variables
     * @return true if the clause has been added to the clause store
     */
    public static boolean addAtMostNMinusOne(BoolVar[] BOOLVARS) {
        Solver solver = BOOLVARS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        TIntList lits = new TIntArrayList(BOOLVARS.length);
        for (int i = 0; i < BOOLVARS.length; i++) {
            lits.add(SatSolver.negated(sat.Literal(BOOLVARS[i])));
        }
        sat.addClause(lits);
View Full Code Here

     *
     * @param BOOLVARS a list of boolean variables
     * @return true if the clause has been added to the clause store
     */
    public static boolean addSumBoolArrayGreaterEqVar(BoolVar[] BOOLVARS, BoolVar TARGET) {
        Solver solver = BOOLVARS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        TIntList lits = new TIntArrayList(BOOLVARS.length + 1);
        for (int i = 0; i < BOOLVARS.length; ++i) {
            lits.add(sat.Literal(BOOLVARS[i]));
        }
        lits.add(SatSolver.negated(sat.Literal(TARGET)));
View Full Code Here

     *
     * @param BOOLVARS a list of boolean variables
     * @return true if the clause has been added to the clause store
     */
    public static boolean addMaxBoolArrayLessEqVar(BoolVar[] BOOLVARS, BoolVar TARGET) {
        Solver solver = BOOLVARS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        int tlit = sat.Literal(TARGET);
        for (int i = 0; i < BOOLVARS.length; ++i) {
            sat.addClause(SatSolver.negated(sat.Literal(BOOLVARS[i])), tlit);
        }
        return true;
View Full Code Here

     * @param BOOLVARS a list of boolean variables
     * @return true if the clause has been added to the clause store
     */
    public static boolean addSumBoolArrayLessEqVar(BoolVar[] BOOLVARS, BoolVar TARGET) {

        Solver solver = BOOLVARS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        if (BOOLVARS.length == 1) {
            return addBoolLe(BOOLVARS[0], TARGET);
        }

        BoolVar extra = VF.bool(StringUtils.randomName(), solver);
View Full Code Here

        if (a.getUB() <= b.getLB()) {
            return a;
        } else if (b.getLB() <= a.getUB()) {
            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

TOP

Related Classes of solver.Solver

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.