Class Alldiff

All Implemented Interfaces:
SatisfiedPresent, UsesQueueVariable
Direct Known Subclasses:
Circuit, Subcircuit

public class Alldiff extends Alldifferent
Alldiff constraint assures that all FDVs has different values. It uses bounds consistency technique as described in the paper by Alejandro Lopez-Ortiz, Claude-Guy Quimper, John Tromp, Peter van Beek, "A fast and simple algorithm for bounds consistency of the alldifferent constraint", Proceedings of the 18th international joint conference on Artificial intelligence (IJCAI'03), Pages 245-250. Before using bounds consistency it calls consistency method for ground variables.

It extends basic functionality of Alldifferent constraint.

Version:
4.8
  • Field Details

  • Constructor Details

    • Alldiff

      protected Alldiff()
    • Alldiff

      public Alldiff(IntVar[] variables)
      It constructs the alldiff constraint for the supplied variable.
      Parameters:
      variables - variables which are constrained to take different values.
    • Alldiff

      public Alldiff(List<? extends IntVar> variables)
      It constructs the alldiff constraint for the supplied variable.
      Parameters:
      variables - variables which are constrained to take different values.
  • Method Details

    • getDefaultConsistencyPruningEvent

      public int getDefaultConsistencyPruningEvent()
      Overrides:
      getDefaultConsistencyPruningEvent in class Alldifferent
    • impose

      public void impose(Store store)
      Description copied from class: Constraint
      It imposes the constraint in a given store.
      Overrides:
      impose in class Alldifferent
      Parameters:
      store - the constraint store to which the constraint is imposed to.
    • 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.
      Overrides:
      consistency in class Alldifferent
      Parameters:
      store - constraint store within which the constraint consistency is being checked.
    • init

      private void init()
    • updateLB

      private void updateLB()
    • updateUB

      private void updateUB()
    • pathset

      private void pathset(int[] v, int start, int end, int to)
    • pathmin

      private int pathmin(int[] v, int i)
    • pathmax

      private int pathmax(int[] v, int i)
    • toString

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

      public void queueVariable(int level, Var var)
      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 Alldifferent
      Parameters:
      level - the level of the store at which the change has occurred.
      var - variable which has changed.