JaCoP.constraints
Class Alldiff

java.lang.Object
  extended by JaCoP.constraints.DecomposedConstraint
      extended by JaCoP.constraints.Constraint
          extended by JaCoP.constraints.Alldifferent
              extended by JaCoP.constraints.Alldiff
Direct Known Subclasses:
Circuit

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 J.-F. Puget, "A fast algorithm for the bound consistency of alldiff constraints", in Proceedings of the Fifteenth National Conference on Artificial Intelligence (AAAI '98), 1998. It implements the method with time complexity O(n^2). Before using bounds consistency it calls consistency method from Alldifferent constraint. It extends basic functionality of Alldifferent constraint.

Version:
3.1
Author:
Krzysztof Kuchcinski and Radoslaw Szymanek

Field Summary
static java.lang.String[] xmlAttributes
          It specifies the arguments required to be saved by an XML format as well as the constructor being called to recreate an object from an XML format.
 
Fields inherited from class JaCoP.constraints.Alldifferent
list
 
Fields inherited from class JaCoP.constraints.Constraint
atomicExecution, consistencyPruningEvents, earlyTerminationOK, id, increaseWeight, numberArgs, numberId
 
Fields inherited from class JaCoP.constraints.DecomposedConstraint
queueIndex
 
Constructor Summary
Alldiff(java.util.ArrayList<? extends IntVar> variables)
          It constructs the alldiff constraint for the supplied variable.
Alldiff(IntVar[] variables)
          It constructs the alldiff constraint for the supplied variable.
 
Method Summary
 void consistency(Store store)
          It is a (most probably incomplete) consistency function which removes the values from variables domains.
 int getConsistencyPruningEvent(Var var)
          It retrieves the pruning event which causes reevaluation of the constraint.
 java.lang.String id()
          It gives the id string of a constraint.
 void impose(Store store)
          It imposes the constraint in a given store.
 java.lang.String toString()
          It produces a string representation of a constraint state.
 
Methods inherited from class JaCoP.constraints.Alldifferent
arguments, increaseWeight, queueVariable, removeConstraint, satisfied
 
Methods inherited from class JaCoP.constraints.Constraint
cleanAfterFailure, decompose, getGuideConstraint, getGuideValue, getGuideVariable, impose, imposeDecomposition, numberArgs, removeLevel, removeLevelLate, requiresMonotonicity, setConsistencyPruningEvent, supplyGuideFeedback
 
Methods inherited from class JaCoP.constraints.DecomposedConstraint
auxiliaryVariables, imposeDecomposition
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmlAttributes

public static java.lang.String[] xmlAttributes
It specifies the arguments required to be saved by an XML format as well as the constructor being called to recreate an object from an XML format.

Constructor Detail

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(java.util.ArrayList<? extends IntVar> variables)
It constructs the alldiff constraint for the supplied variable.

Parameters:
variables - variables which are constrained to take different values.
Method Detail

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 Alldifferent
Parameters:
var - variable for which pruning event is retrieved
Returns:
it returns the int code of the pruning event (GROUND, BOUND, ANY, NONE)

id

public java.lang.String id()
Description copied from class: Constraint
It gives the id string of a constraint.

Overrides:
id in class Alldifferent
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 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.

toString

public java.lang.String toString()
Description copied from class: Constraint
It produces a string representation of a constraint state.

Overrides:
toString in class Alldifferent