JaCoP.constraints
Class Circuit

java.lang.Object
  extended by JaCoP.constraints.DecomposedConstraint
      extended by JaCoP.constraints.Constraint
          extended by JaCoP.constraints.Alldifferent
              extended by JaCoP.constraints.Alldiff
                  extended by JaCoP.constraints.Circuit

public class Circuit
extends Alldiff

Circuit constraint assures that all variables build a Hamiltonian circuit. Value of every variable x[i] points to the next variable in the circuit. Variables create one circuit.

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
Circuit(java.util.ArrayList<IntVar> list)
          It constructs a circuit constraint.
Circuit(IntVar[] list)
          It constructs a circuit constraint.
 
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.
 void removeLevel(int level)
          This function is called in case of the backtrack, so a constraint can clear the queue of changed variables which is no longer valid.
 boolean satisfied()
          It checks if the constraint is satisfied.
 java.lang.String toString()
          It produces a string representation of a constraint state.
 
Methods inherited from class JaCoP.constraints.Alldifferent
arguments, increaseWeight, queueVariable, removeConstraint
 
Methods inherited from class JaCoP.constraints.Constraint
cleanAfterFailure, decompose, getGuideConstraint, getGuideValue, getGuideVariable, impose, imposeDecomposition, numberArgs, 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

Circuit

public Circuit(IntVar[] list)
It constructs a circuit constraint.

Parameters:
list - variables which must form a circuit.

Circuit

public Circuit(java.util.ArrayList<IntVar> list)
It constructs a circuit constraint.

Parameters:
list - variables which must form a circuit.
Method Detail

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

impose

public void impose(Store store)
Description copied from class: Constraint
It imposes the constraint in a given store.

Overrides:
impose in class Alldiff
Parameters:
store - the constraint store to which the constraint is imposed to.

satisfied

public boolean satisfied()
Description copied from class: Constraint
It checks if the constraint is satisfied. If this function is incorrectly implemented a constraint may not be satisfied in a solution.

Overrides:
satisfied in class Alldifferent
Returns:
true if the constraint is for certain satisfied, false otherwise.

toString

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

Overrides:
toString in class Alldiff

removeLevel

public void removeLevel(int level)
Description copied from class: Constraint
This function is called in case of the backtrack, so a constraint can clear the queue of changed variables which is no longer valid. This function is called *before* all timestamps, variables, mutablevariables have reverted to their previous value.

Overrides:
removeLevel in class Constraint
Parameters:
level - the level which is being removed.

id

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

Overrides:
id in class Alldiff
Returns:
string id of the constraint.