Package solver.constraints

Examples of solver.constraints.Constraint


        this.engine = NoPropagationEngine.SINGLETON;
        ZERO = (BoolVar) VF.fixed(0, this);
        ONE = (BoolVar) VF.fixed(1, this);
        ZERO._setNot(ONE);
        ONE._setNot(ZERO);
        TRUE = new Constraint("TRUE cstr", new PropTrue(ONE));
        FALSE = new Constraint("FALSE cstr", new PropFalse(ZERO));
        solutionRecorder = new LastSolutionRecorder(new Solution(), false, this);
        set(ObjectiveManager.SAT());
    }
View Full Code Here


        while (idx < cIdx && cstrs[idx] != c) {
            idx++;
        }
        // 2. remove it from the network
        if (idx < cIdx) {
            Constraint cm = cstrs[--cIdx];
            cstrs[idx] = cm;
            cstrs[cIdx] = null;
            // 3. check if the resolution already started -> if true, dynamic deletion
            if (engine != NoPropagationEngine.SINGLETON && engine.isInitialized()) {
                engine.dynamicDeletion(c);
View Full Code Here

        square2 = VariableFactory.boundedArray("s2", mm, 1, m, solver);
        vars = VariableFactory.enumeratedArray("vars", mm, 0, mm - 1, solver);

        List<Constraint> ADS = new ArrayList<Constraint>();

        Constraint cc = IntConstraintFactory.alldifferent(vars, "AC");
        solver.post(cc);
        ADS.add(cc);

        int[] mod = new int[mm];
        int[] div = new int[mm];
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]);
                solver.post(neq);
                set.add(neq);
                solver.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", -k));
                solver.post(IntConstraintFactory.arithm(vars[i], "!=", vars[j], "+", k));
            }
View Full Code Here

     * @param SETS  set variables
     * @param UNION set variable representing the union of SET_VARS
     * @return A constraint ensuring that the union of SET_VARS is equal to SET_UNION
     */
    public static Constraint union(SetVar[] SETS, SetVar UNION) {
        return new Constraint("SetUnion",new PropUnion(SETS, UNION), new PropUnion(SETS, UNION));
    }
View Full Code Here

     * @param SETS         set variables
     * @param INTERSECTION set variable representing the intersection of SET_VARS
     * @return A constraint ensuring that the intersection of sets is equal to set intersection
     */
    public static Constraint intersection(SetVar[] SETS, SetVar INTERSECTION) {
        return new Constraint("SetIntersection",new PropIntersection(SETS, INTERSECTION), new PropIntersection(SETS, INTERSECTION));
    }
View Full Code Here

    public static Constraint subsetEq(SetVar[] SETS) {
    Propagator[] props = new Propagator[SETS.length-1];
        for (int i = 0; i < SETS.length - 1; i++) {
            props[i] = new PropSubsetEq(SETS[i], SETS[i + 1]);
        }
        return new Constraint("SetSubsetEq",props);
    }
View Full Code Here

     * @param CARD an integer variable representing SET_VAR's cardinality
     *             (i.e. the number of elements in it)
     * @return A constraint ensuring that |SET_VAR| = CARD
     */
    public static Constraint cardinality(SetVar SET, IntVar CARD) {
    return new Constraint("SetCard",new PropCardinality(SET, CARD));
    }
View Full Code Here

     * @param SETS          set variables
     * @param NB_EMPTY_SETS integer variable restricting the number of empty sets in SETS
     * @return A constraint ensuring that |{s in SETS such that |s|=0}| = NB_EMPTY_SETS
     */
    public static Constraint nbEmpty(SetVar[] SETS, IntVar NB_EMPTY_SETS) {
    return new Constraint("SetNbEmpty",new PropNbEmpty(SETS, NB_EMPTY_SETS));
    }
View Full Code Here

     * @param SET_2  a set variable
     * @param OFFSET offset index
     * @return a constraint ensuring that x in SET_1 <=> x+OFFSET in SET_2
     */
    public static Constraint offSet(SetVar SET_1, SetVar SET_2, int OFFSET) {
    return new Constraint("SetOffset",new PropOffSet(SET_1, SET_2, OFFSET));
    }
View Full Code Here

TOP

Related Classes of solver.constraints.Constraint

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.