Package solver.constraints

Examples of solver.constraints.Constraint


   * Prevents SET to be empty
   * @param SET a SetVar
   * @return a constraint ensuring that SET is not empty
   */
  public static Constraint notEmpty(SetVar SET){
    return new Constraint("SetNotEmpty",new PropNotEmpty(SET));
  }
View Full Code Here


   *                  false : the set may be empty (if so, the SUM constraint is not applied)
     * @return a constraint ensuring that sum{WEIGHTS[i-OFFSET] | i in INDEXES} = SUM
     */
    public static Constraint sum(SetVar INDEXES, int[] WEIGHTS, int OFFSET, IntVar SUM, boolean NOT_EMPTY) {
    if (NOT_EMPTY) {
      return new Constraint("SetSum_NotEmpty",new PropNotEmpty(INDEXES),new PropSumOfElements(INDEXES, WEIGHTS, OFFSET, SUM, NOT_EMPTY));
    }else{
      return new Constraint("SetSum",new PropSumOfElements(INDEXES, WEIGHTS, OFFSET, SUM, NOT_EMPTY));
    }
    }
View Full Code Here

   *                  false : the set may be empty (if so, the MAX constraint is not applied)
     * @return a constraint ensuring that max{WEIGHTS[i-OFFSET] | i in INDEXES} = MAX_ELEMENT_VALUE
     */
    public static Constraint max(SetVar INDEXES, int[] WEIGHTS, int OFFSET, IntVar MAX_ELEMENT_VALUE, boolean NOT_EMPTY) {
    if (NOT_EMPTY) {
      return new Constraint("SetMax_NotEmpty",new PropNotEmpty(INDEXES),new PropMaxElement(INDEXES, WEIGHTS, OFFSET, MAX_ELEMENT_VALUE, NOT_EMPTY));
    }else{
      return new Constraint("SetMax",new PropMaxElement(INDEXES, WEIGHTS, OFFSET, MAX_ELEMENT_VALUE, NOT_EMPTY));
    }
    }
View Full Code Here

   *                  false : the set may be empty (if so, the MIN constraint is not applied)
     * @return a constraint ensuring that min{WEIGHTS[i-OFFSET] | i in INDEXES} = MIN_ELEMENT_VALUE
     */
    public static Constraint min(SetVar INDEXES, int[] WEIGHTS, int OFFSET, IntVar MIN_ELEMENT_VALUE, boolean NOT_EMPTY) {
    if (NOT_EMPTY) {
      return new Constraint("SetMin_NotEmpty",new PropNotEmpty(INDEXES),new PropMinElement(INDEXES, WEIGHTS, OFFSET, MIN_ELEMENT_VALUE, NOT_EMPTY));
    }else{
      return new Constraint("SetMin",new PropMinElement(INDEXES, WEIGHTS, OFFSET, MIN_ELEMENT_VALUE, NOT_EMPTY));
    }
    }
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 i in SET <=> BOOLEANS[i-OFFSET] = TRUE
     */
    public static Constraint bool_channel(BoolVar[] BOOLEANS, SetVar SET, int OFFSET) {
    return new Constraint("SetBoolChanneling",new PropBoolChannel(SET, BOOLEANS, OFFSET));
    }
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] <=> INTEGERS[x-OFFSET_2] = y
     */
    public static Constraint int_channel(SetVar[] SETS, IntVar[] INTEGERS, int OFFSET_1, int OFFSET_2) {
    return new Constraint("SetIntChanneling",
        new PropIntChannel(SETS, INTEGERS, OFFSET_1, OFFSET_2),
                new PropIntChannel(SETS, INTEGERS, OFFSET_1, OFFSET_2),new PropAllDisjoint(SETS)
    );
    }
View Full Code Here

   * @param VARS    integer variables
   * @param VALUES  a set variable
   * @return  a channeling constraint ensuring that VALUES = {value(x) | x in VARS}
   */
  public static Constraint int_values_union(IntVar[] VARS, SetVar VALUES){
    return new Constraint("SetIntValuesUnion"
        ,new PropSetIntValuesUnion(VARS,VALUES)
        ,new PropSetIntValuesUnion(VARS,VALUES)
    );
  }
View Full Code Here

     *
     * @param SETS disjoint set variables
     * @return a constraint ensuring that non-empty sets are all disjoint
     */
    public static Constraint all_disjoint(SetVar[] SETS) {
    return new Constraint("SetAllDisjoint",new PropAllDisjoint(SETS));
    }
View Full Code Here

     *
     * @param SETS different set variables
     * @return a constraint ensuring that SETS are all different
     */
    public static Constraint all_different(SetVar[] SETS) {
    return new Constraint("SetAllDifferent",new PropAllDiff(SETS),
        new PropAllDiff(SETS),new PropAtMost1Empty(SETS)
    );
    }
View Full Code Here

     *
     * @param SETS set variables to be equals
     * @return a constraint ensuring that all sets in SETS are equal
     */
    public static Constraint all_equal(SetVar[] SETS) {
    return new Constraint("SetAllEqual",new PropAllEqual(SETS));
    }
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.