Package solver.constraints

Examples of solver.constraints.Constraint


     * @param SETS     set variables whose values are subsets of UNIVERSE
     * @param UNIVERSE a set variable representing union(SETS)
     * @return a constraint which ensures that SETS form a partition of UNIVERSE
     */
    public static Constraint partition(SetVar[] SETS, SetVar UNIVERSE) {
        return new Constraint("SetPartition",ArrayUtils.append(
        all_disjoint(SETS).getPropagators(),
        new Propagator[]{new PropUnion(SETS, UNIVERSE), new PropUnion(SETS, UNIVERSE)}
    ));
    }
View Full Code Here


     *                     but generally 1 with MiniZinc API
     *                     which counts from 1 to n instead of counting from 0 to n-1 (Java standard)
     * @return a constraint ensuring that x in SETS[y-OFFSET_1] <=> y in INVERSE_SETS[x-OFFSET_2]
     */
    public static Constraint inverse_set(SetVar[] SETS, SetVar[] INVERSE_SETS, int OFFSET_1, int OFFSET_2) {
    return new Constraint("SetInverse",new PropInverse(SETS, INVERSE_SETS, OFFSET_1, OFFSET_2));
    }
View Full Code Here

     *               but generally 1 with MiniZinc API
     *               which counts from 1 to n instead of counting from 0 to n-1 (Java standard)
     * @return a constraint ensuring that x in SETS[y-OFFSET] <=> y in SETS[x-OFFSET]
     */
    public static Constraint symmetric(SetVar[] SETS, int OFFSET) {
    return new Constraint("SetSymmetric",new PropSymmetric(SETS, OFFSET));
    }
View Full Code Here

     *               which counts from 1 to n instead of counting from 0 to n-1 (Java standard)
     * @param SET    a set variable which takes its value in SETS
     * @return a constraint ensuring that SETS[INDEX-OFFSET] = SET
     */
    public static Constraint element(IntVar INDEX, SetVar[] SETS, int OFFSET, SetVar SET) {
    return new Constraint("SetElement",new PropElement(INDEX, SETS, OFFSET, SET), new PropElement(INDEX, SETS, OFFSET, SET));
    }
View Full Code Here

     * @param INTEGER an integer variables which takes its values in SET
     * @param SET     a set variables representing possible values of INTEGER
     * @return a constraint ensuring that INTEGER belongs to SET
     */
    public static Constraint member(IntVar INTEGER, SetVar SET) {
    return new Constraint("SetMember",new PropIntMemberSet(SET, INTEGER));
    }
View Full Code Here

        vars = new IntVar[2];

        vars[0] = VariableFactory.bounded("X", minX, maxX, solver);
        vars[1] = VariableFactory.bounded("Y", minY, maxY, solver);

        Constraint abs = IntConstraintFactory.absolute(vars[0], vars[1]);
        solver.post(abs);
    }
View Full Code Here

        List<Constraint> cstrs = new ArrayList<Constraint>();
        for (int i = 0; i < card.length; i++) {
            IntVar cste = VF.fixed(i, solver);
            BoolVar[] bs = VF.boolArray("b_" + i, vars.length, solver);
            for (int j = 0; j < vars.length; j++) {
                Constraint cs = LCF.ifThenElse(bs[j], ICF.arithm(vars[j], "=", cste), ICF.arithm(vars[j], "!=", cste));
                cstrs.add(cs);
            }
            cstrs.add(ICF.sum(bs, card[i]));
        }
        return cstrs.toArray(new Constraint[cstrs.size()]);
View Full Code Here

        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                BoolVar boolVar = VariableFactory.bool("b_" + i + "_" + j, solver);
                booleans.add(boolVar);

                Constraint c1 = precedence(planes[i], data[i][ST + j], planes[j]);
                Constraint c2 = precedence(planes[j], data[j][ST + i], planes[i]);
                Constraint cr = LogicalConstraintFactory.ifThenElse(boolVar, c1, c2);
                solver.post(cr);
            }
        }

        bVars = booleans.toArray(new BoolVar[booleans.size()]);
View Full Code Here

            this.Y.duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.Y);
            this.Z.duplicate(solver, identitymap);
            IntVar Z = (IntVar) identitymap.get(this.Z);

            Constraint clone = new DistanceXYZ(X, Y, this.OP, Z);
            identitymap.put(this.propagators[0], clone.getPropagator(0));
            identitymap.put(this, clone);
        }
    }
View Full Code Here

            this.X.duplicate(solver, identitymap);
            IntVar X = (IntVar) identitymap.get(this.X);
            this.Y.duplicate(solver, identitymap);
            IntVar Y = (IntVar) identitymap.get(this.Y);

            Constraint clone = new DistanceXYC(X, Y, this.operator, this.C);
            identitymap.put(this.propagators[0], clone.getPropagator(0));
            identitymap.put(this, clone);
        }
    }
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.