Class Element

All Implemented Interfaces:
UsesQueueVariable

public class Element extends Constraint implements UsesQueueVariable
Element constraint implements the element/4 constraint (both with integer list and variables list). It defines a following relation variables[index + shift] = value. The default shift value is equal to zero. The first index in the variables list is equal to 1.
Version:
4.8
  • Field Details

  • Constructor Details

    • Element

      @Deprecated public Element(IntVar index, List<? extends IntVar> variables, IntVar value)
      Deprecated.
      It constructs element constraint based on variables. The default shift value is equal 0.
      Parameters:
      index - index variable.
      variables - list of variables.
      value - variable to which index variable is equal to.
    • Element

      @Deprecated public Element(IntVar index, List<? extends IntVar> variables, IntVar value, int shift)
      Deprecated.
      It constructs element constraint based on variables.
      Parameters:
      index - index variable.
      variables - variables list.
      value - value variable.
      shift - shift by which the index value is moved to the left.
    • Element

      @Deprecated public Element(IntVar index, int[] values, IntVar value)
      Deprecated.
      It constructs element constraint based on variables. The default shift value is equal 0.
      Parameters:
      index - index variable.
      values - list of integers.
      value - variable to which index variable is equal to.
    • Element

      @Deprecated public Element(IntVar index, int[] values, IntVar value, int shift)
      Deprecated.
      It constructs element constraint based on variables.
      Parameters:
      index - index variable.
      values - integer list.
      value - value variable.
      shift - shift by which the index value is moved to the left.
    • Element

      @Deprecated public Element(IntVar index, IntVar[] variables, IntVar value)
      Deprecated.
      It constructs element constraint based on variables. The default shift value is equal 0.
      Parameters:
      index - index variable.
      variables - list of integers.
      value - variable to which index variable is equal to.
    • Element

      @Deprecated public Element(IntVar index, IntVar[] variables, IntVar value, int shift)
      Deprecated.
      It constructs element constraint based on variables.
      Parameters:
      index - index variable.
      variables - variables list.
      value - value variable.
      shift - shift by which the index value is moved to the left.
  • Method Details

    • arguments

      public Set<Var> arguments()
      Description copied from class: Constraint
      It returns the variables in a scope of the constraint.
      Overrides:
      arguments in class Constraint
      Returns:
      variables in a scope of the constraint.
    • consistency

      public void consistency(Store store)
      Description copied from class: Constraint
      It is a (most probably incomplete) consistency function which removes the values from variables domains. Only values which do not have any support in a solution space are removed.
      Specified by:
      consistency in class Constraint
      Parameters:
      store - constraint store within which the constraint consistency is being checked.
    • getConsistencyPruningEvent

      public int getConsistencyPruningEvent(Var var)
      Description copied from class: Constraint
      It retrieves the pruning event which causes reevaluation of the constraint.
      Overrides:
      getConsistencyPruningEvent in class Constraint
      Parameters:
      var - variable for which pruning event is retrieved
      Returns:
      it returns the int code of the pruning event (GROUND, BOUND, ANY, NONE)
    • getDefaultConsistencyPruningEvent

      public int getDefaultConsistencyPruningEvent()
      Specified by:
      getDefaultConsistencyPruningEvent in class Constraint
    • id

      public String id()
      Description copied from class: Constraint
      It gives the id string of a constraint.
      Overrides:
      id in class Constraint
      Returns:
      string id of the constraint.
    • impose

      public void impose(Store store)
      Description copied from class: Constraint
      It imposes the constraint in a given store.
      Overrides:
      impose in class Constraint
      Parameters:
      store - the constraint store to which the constraint is imposed to.
    • queueVariable

      public void queueVariable(int level, Var V)
      Description copied from class: Constraint
      This is a function called to indicate which variable in a scope of constraint has changed. It also indicates a store level at which the change has occurred.
      Overrides:
      queueVariable in class Constraint
      Parameters:
      level - the level of the store at which the change has occurred.
      V - variable which has changed.
    • removeConstraint

      public void removeConstraint()
      Description copied from class: Constraint
      It removes the constraint by removing this constraint from all variables.
      Overrides:
      removeConstraint in class Constraint
    • toString

      public String toString()
      Description copied from class: Constraint
      It produces a string representation of a constraint state.
      Overrides:
      toString in class Constraint
    • increaseWeight

      public void increaseWeight()
      Description copied from class: Constraint
      It increases the weight of the variables in the constraint scope.
      Overrides:
      increaseWeight in class Constraint
    • choose

      public static Constraint choose(IntVar index, List<? extends IntVar> variables, IntVar value)
      It constructs element constraint based on variables. The default shift value is equal 0.
      Parameters:
      index - index variable.
      variables - list of variables.
      value - variable to which index variable is equal to.
      Returns:
      constraint that encodes the desired logic.
    • choose

      public static Constraint choose(IntVar index, List<? extends IntVar> variables, IntVar value, int shift)
      It constructs element constraint based on variables.
      Parameters:
      index - index variable.
      variables - variables list.
      value - value variable.
      shift - shift by which the index value is moved to the left.
      Returns:
      constraint that encodes the desired logic.
    • choose

      public static Constraint choose(IntVar index, int[] values, IntVar value)
      It constructs element constraint based on variables. The default shift value is equal 0.
      Parameters:
      index - index variable.
      values - list of integers.
      value - variable to which index variable is equal to.
      Returns:
      constraint that encodes the desired logic.
    • choose

      public static Constraint choose(IntVar index, int[] values, IntVar value, int shift)
      It constructs element constraint based on variables.
      Parameters:
      index - index variable.
      values - integer list.
      value - value variable.
      shift - shift by which the index value is moved to the left.
      Returns:
      constraint that encodes the desired logic.
    • choose

      public static Constraint choose(IntVar index, IntVar[] variables, IntVar value)
      It constructs element constraint based on variables. The default shift value is equal 0.
      Parameters:
      index - index variable.
      variables - list of integers.
      value - variable to which index variable is equal to.
      Returns:
      constraint that encodes the desired logic.
    • choose

      public static Constraint choose(IntVar index, IntVar[] variables, IntVar value, int shift)
      It constructs element constraint based on variables.
      Parameters:
      index - index variable.
      variables - variables list.
      value - value variable.
      shift - shift by which the index value is moved to the left.
      Returns:
      constraint that encodes the desired logic.