Package gnu.trove.list.array

Examples of gnu.trove.list.array.TIntArrayList


        this.array = new SetVar[array.length];
        for (int i = 0; i < array.length; i++) {
            this.array[i] = (SetVar) vars[i];
        }
        this.offSet = offSet;
        constructiveDisjunction = new TIntArrayList();
    }
View Full Code Here


        for (Transition t : s.getTransitions()) {
            for (char c = t.getMin(); c <= t.getMax(); c++) {
                set.add(getIntFromChar(c));
            }
        }
        return new TIntArrayList(set.toArray());

    }
View Full Code Here

    @Override
    public void buildModel() {
        boolean[][] matrix = HCP_Utils.generateKingTourInstance(40);
        int n = matrix.length;
    succ = new IntVar[n];
    TIntArrayList values = new TIntArrayList();
        for (int i = 0; i < n; i++) {
      values.clear();
            for (int j = 0; j < n; j++) {
                if (matrix[i][j]) {
          values.add(j);
                }
            }
      succ[i] = VF.enumerated("succ_"+i,values.toArray(),solver);
        }
        solver.post(ICF.circuit(succ,0));
    }
View Full Code Here

                    BoolVar bv = (BoolVar) clause;
                    ret &= addTrue(bv);
                } else {
                    LogOp n = (LogOp) clause;
                    BoolVar[] bvars = n.flattenBoolVar();
                    TIntList lits = new TIntArrayList(bvars.length);
                    for (int j = 0; j < bvars.length; j++) {
                        lits.add(sat.Literal(bvars[j]));
                    }
                    ret &= sat.addClause(lits);
                }
            }
            return ret;
View Full Code Here

     * @return true if the clause has been added to the clause store
     */
    public static boolean addClauses(BoolVar[] POSLITS, BoolVar[] NEGLITS) {
        Solver solver = POSLITS.length > 0 ? POSLITS[0].getSolver() : NEGLITS[0].getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        TIntList lits = new TIntArrayList(POSLITS.length + NEGLITS.length);
        for (int i = 0; i < POSLITS.length; i++) {
            lits.add(sat.Literal(POSLITS[i]));
        }
        for (int i = 0; i < NEGLITS.length; i++) {
            lits.add(SatSolver.negated(sat.Literal(NEGLITS[i])));
        }
        sat.addClause(lits);
        return true;
    }
View Full Code Here

     */
    public static boolean addBoolOrArrayEqVar(BoolVar[] BOOLVARS, BoolVar TARGET) {
        Solver solver = TARGET.getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        int target_lit = sat.Literal(TARGET);
        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(target_lit));
        sat.addClause(lits);
        for (int i = 0; i < BOOLVARS.length; i++) {
            sat.addClause(target_lit, SatSolver.negated(sat.Literal(BOOLVARS[i])));
        }
        return true;
View Full Code Here

     */
    public static boolean addBoolAndArrayEqVar(BoolVar[] BOOLVARS, BoolVar TARGET) {
        Solver solver = TARGET.getSolver();
        PropSat sat = solver.getMinisat().getPropSat();
        int target_lit = sat.Literal(TARGET);
        TIntList lits = new TIntArrayList(BOOLVARS.length + 1);
        for (int i = 0; i < BOOLVARS.length; i++) {
            lits.add(SatSolver.negated(sat.Literal(BOOLVARS[i])));
        }
        lits.add(target_lit);
        sat.addClause(lits);
        for (int i = 0; i < BOOLVARS.length; i++) {
            sat.addClause(SatSolver.negated(target_lit), sat.Literal(BOOLVARS[i]));
        }
        return true;
View Full Code Here

     * @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);
        return true;
    }
View Full Code Here

     * @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++) {
            for (int j = i + 1; j < lits.size(); ++j) {
                sat.addClause(lits.get(i), lits.get(j));
            }
        }
        return true;
    }
View Full Code Here

     * @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);
        return true;
    }
View Full Code Here

TOP

Related Classes of gnu.trove.list.array.TIntArrayList

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.