public class ExtensionalSupportSTR extends Constraint implements UsesQueueVariable, Stateful
This implementation uses technique developed/improved by Christophe Lecoutre. Paper presented at CP2008. We would like to thank him for making his code available, which helped to create our own version of this algorithm.
Modifier and Type | Field and Description |
---|---|
boolean |
backtrackOccured
It specifies if there was a backtrack and no yet consistency function execution after backtracking.
|
int |
first
Gives the position of the first tuple (in the current list)
or -1 if the current list is empty.
|
boolean |
firstConsistencyCheck
It specifies if there was no first consistency check yet.
|
int |
firstResidue
It stores the position of the first residue.
|
TimeStamp<Integer> |
headsOfEliminatedTuples
Gives the first position of the eliminated tuple at a given level.
|
int |
last
Gives the position of the last tuple (in the current list)
or -1 if the current list is empty.
|
int |
lastAssignedVariablePosition |
int |
lastResidue
It stores the position of the last residue.
|
IntVar[] |
list
It stores variables within this extensional constraint, order does
matter.
|
int |
nbGlobalValuesToBeSupported
The number of variable-value pairs which need to have support.
|
int |
nbSupportsVariables
It specifies the current number of variables for which it is required to check
if their values from the domains are supported.
|
int |
nbValidityVariables
It specifies the number of variables for which validity check within a tuple must be performed.
|
int[] |
nbValuesToBeSupported
The number of variable-value pairs which need to have support per variable.
|
int[] |
nexts
Gives the position of the next tuple wrt the position given in index, or -1.
|
boolean |
reinsertBefore
It specifies if the tuples previously removed are re-inserted at the beginning.
|
boolean |
residuesBefore
It specifies if the residues are moved at the beginning of the list.
|
int[] |
supportsVariablePositions
The positions of the variables for which GAC must be checked.
|
TimeStamp<Integer> |
tailsOfEliminatedTuples
Gives the last position of the eliminated tuple at a given level.
|
int[][] |
tuples |
int[] |
validityVariablePositions
The positions of the variables for which validity of any tuple must be checked.
|
Map<Var,Integer> |
varToIndex
It specifies the mapping of the variable into its index.
|
atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, trace
queueIndex
Constructor and Description |
---|
ExtensionalSupportSTR(IntVar[] list,
boolean reinsertBefore,
boolean residuesBefore)
Deprecated.
|
ExtensionalSupportSTR(IntVar[] variables,
int[][] tuples)
It creates an extensional constraint.
|
ExtensionalSupportSTR(IntVar[] list,
int[][] tuples,
boolean reinsertBefore,
boolean residuesBefore)
It constructs an extensional constraint.
|
Modifier and Type | Method and Description |
---|---|
void |
consistency(Store store)
It is a (most probably incomplete) consistency function which removes the
values from variables domains.
|
int |
getDefaultConsistencyPruningEvent() |
void |
impose(Store store)
It imposes the constraint in a given store.
|
void |
queueVariable(int level,
Var V)
This is a function called to indicate which variable in a scope of
constraint has changed.
|
void |
remove(int previous,
int current)
It removes the tuple which is no longer valid.
|
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.
|
void |
storeResidue(int previous,
int current)
It moves the residue to the beginning of the list.
|
String |
toString()
It produces a string representation of a constraint state.
|
afc, arguments, cleanAfterFailure, decompose, getConsistencyPruningEvent, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, long2int, numberArgs, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, updateAFC, watchedVariableGrounded
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isStateful
public IntVar[] list
public int[][] tuples
public int first
public int last
public int[] nexts
public TimeStamp<Integer> headsOfEliminatedTuples
public TimeStamp<Integer> tailsOfEliminatedTuples
public int nbGlobalValuesToBeSupported
public int[] nbValuesToBeSupported
public int firstResidue
public int lastResidue
public int nbValidityVariables
public int[] validityVariablePositions
public int nbSupportsVariables
public int[] supportsVariablePositions
public Map<Var,Integer> varToIndex
public int lastAssignedVariablePosition
public boolean reinsertBefore
public boolean residuesBefore
public boolean firstConsistencyCheck
public boolean backtrackOccured
@Deprecated public ExtensionalSupportSTR(IntVar[] list, boolean reinsertBefore, boolean residuesBefore)
list
- the variables in the scope of the constraint.reinsertBefore
- it specifies if the tuples which were removed and are reinstatiated are inserted at the beginning.residuesBefore
- it specifies if the residue tuples are moved to the beginning.public ExtensionalSupportSTR(IntVar[] list, int[][] tuples, boolean reinsertBefore, boolean residuesBefore)
list
- the variables in the scope of the constraint.tuples
- the tuples which are supports.reinsertBefore
- it specifies if the tuples which were removed and are reinstatiated are inserted at the beginning.residuesBefore
- it specifies if the residue tuples are moved to the beginning.public ExtensionalSupportSTR(IntVar[] variables, int[][] tuples)
variables
- the variables in the scope of the constraint.tuples
- the support tuples.public void remove(int previous, int current)
previous
- the tuple pointing at removed tuple.current
- the removed tuple.public void storeResidue(int previous, int current)
previous
- the tuple pointing at tuple residue.current
- the residue tuple.public void removeLevel(int level)
Stateful
removeLevel
in interface Stateful
level
- the level which is being removed.public void consistency(Store store)
Constraint
consistency
in class Constraint
store
- constraint store within which the constraint consistency is being checked.public int getDefaultConsistencyPruningEvent()
getDefaultConsistencyPruningEvent
in class Constraint
public void impose(Store store)
Constraint
impose
in class Constraint
store
- the constraint store to which the constraint is imposed to.public void queueVariable(int level, Var V)
Constraint
queueVariable
in class Constraint
level
- the level of the store at which the change has occurred.V
- variable which has changed.public String toString()
Constraint
toString
in class Constraint
Copyright © 2022. All rights reserved.