|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectJaCoP.constraints.DecomposedConstraint
JaCoP.constraints.Constraint
JaCoP.constraints.ExtensionalSupportSTR
public class ExtensionalSupportSTR
Extensional constraint assures that one of the tuples is enforced in the relation. 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.
| Field Summary | |
|---|---|
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<java.lang.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<java.lang.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. |
java.util.HashMap<Var,java.lang.Integer> |
varToIndex
It specifies the mapping of the variable into its index. |
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.Constraint |
|---|
atomicExecution, consistencyPruningEvents, earlyTerminationOK, id, increaseWeight, numberArgs, numberId |
| Fields inherited from class JaCoP.constraints.DecomposedConstraint |
|---|
queueIndex |
| Constructor Summary | |
|---|---|
ExtensionalSupportSTR(IntVar[] list,
boolean reinsertBefore,
boolean residuesBefore)
Partial constructor which stores variables involved in a constraint but does not get information about tuples yet. |
|
ExtensionalSupportSTR(IntVar[] variables,
int[][] tuples)
It creates an extensional constraint. |
|
ExtensionalSupportSTR(IntVar[] list,
int[][] tuples,
boolean reinsertBefore,
boolean residuesBefore)
It constructs an extensional constraint. |
|
| Method Summary | |
|---|---|
java.util.ArrayList<Var> |
arguments()
It returns the variables in a scope of the constraint. |
void |
consistency(Store store)
It is a (most probably incomplete) consistency function which removes the values from variables domains. |
static void |
fromXML(ExtensionalSupportSTR object,
java.lang.String content)
It updates the specified constraint with the information stored in the string. |
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 |
increaseWeight()
It increases the weight of the variables in the constraint scope. |
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 |
removeConstraint()
It removes the constraint by removing this constraint from all variables. |
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. |
void |
storeResidue(int previous,
int current)
It moves the residue to the beginning of the list. |
java.lang.String |
toString()
It produces a string representation of a constraint state. |
void |
toXML(javax.xml.transform.sax.TransformerHandler tf)
It writes the content of this object as the content of XML element so later it can be used to restore the object from XML. |
| 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 |
|---|
public IntVar[] list
public int[][] tuples
public int first
public int last
public int[] nexts
public TimeStamp<java.lang.Integer> headsOfEliminatedTuples
public TimeStamp<java.lang.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 java.util.HashMap<Var,java.lang.Integer> varToIndex
public int lastAssignedVariablePosition
public static java.lang.String[] xmlAttributes
public boolean reinsertBefore
public boolean residuesBefore
public boolean firstConsistencyCheck
public boolean backtrackOccured
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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 java.util.ArrayList<Var> arguments()
Constraint
arguments in class Constraintpublic void removeLevel(int level)
Constraint
removeLevel in class Constraintlevel - the level which is being removed.public void consistency(Store store)
Constraint
consistency in class Constraintstore - constraint store within which the constraint consistency is being checked.public int getConsistencyPruningEvent(Var var)
Constraint
getConsistencyPruningEvent in class Constraintvar - variable for which pruning event is retrieved
public java.lang.String id()
Constraint
id in class Constraintpublic void impose(Store store)
Constraint
impose in class Constraintstore - the constraint store to which the constraint is imposed to.public void increaseWeight()
Constraint
increaseWeight in class Constraint
public void queueVariable(int level,
Var V)
Constraint
queueVariable in class Constraintlevel - the level of the store at which the change has occurred.V - variable which has changed.public void removeConstraint()
Constraint
removeConstraint in class Constraintpublic boolean satisfied()
Constraint
satisfied in class Constraintpublic java.lang.String toString()
Constraint
toString in class Constraint
public void toXML(javax.xml.transform.sax.TransformerHandler tf)
throws org.xml.sax.SAXException
tf - a place to write the content of the object.
org.xml.sax.SAXException
public static void fromXML(ExtensionalSupportSTR object,
java.lang.String content)
object - the constraint to be updated.content - the information used for update.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||