choco.palm.global.matching
Class PalmAllDifferent
java.lang.Object
choco.AbstractEntity
choco.AbstractConstraint
choco.integer.constraints.AbstractIntConstraint
choco.integer.constraints.AbstractLargeIntConstraint
choco.global.matching.AbstractBipartiteGraph
choco.global.matching.AbstractBipartiteMatching
choco.global.matching.AllDifferent
choco.palm.global.matching.PalmAllDifferent
- All Implemented Interfaces:
- Constraint, Entity, IntConstraint, IntVarEventListener, PalmIntVarListener, PalmConstraint, PalmVarListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener
public class PalmAllDifferent
- extends AllDifferent
- implements PalmConstraint, PalmIntVarListener
Fields inherited from class choco.global.matching.AbstractBipartiteGraph |
component, componentOrder, currentComponent, currentNode, finishDate, left2rightArc, matchingSize, maxValue, minValue, nbLeftVertices, nbRightVertices, nbVertices, queue, refMatch, right2leftArc, seen, source, time |
Method Summary |
void |
augmentFlow()
keeps augmenting the flow until a maximal flow is reached |
void |
awake()
no specific initial propagation (awake does the same job as propagate) |
void |
awakeOnRem(int idx,
int val)
when a value is removed from a domain var, removed the corresponding edge in current matching |
void |
awakeOnRestoreInf(int idx)
Handles an inf bound restoration on the constraint idx |
void |
awakeOnRestoreSup(int idx)
Handles a sup bound restoration on the constraint idx |
void |
awakeOnRestoreVal(int idx,
int val)
Handles a val restoration on the constraint idx |
void |
awakeOnRestoreVal(int idx,
IntIterator it)
Handles a val restoration on the constraint idx |
void |
deleteEdgeAndPublish(int i,
int j)
when an edge is definitely removed from the bipartite assignment graph. |
boolean |
isSatisfied()
Checks if the constraint is satisfied when all variables are instantiated. |
static AllDifferent |
newAllDiff(IntDomainVar[] vars)
|
void |
takeIntoAccountStatusChange(int index)
Informs constraints that one of their children has a modified status (due to value restoration). |
void |
updateDataStructuresOnConstraint(int idx,
int select,
int newValue,
int oldValue)
Method called when one of the variables is modified. |
void |
updateDataStructuresOnRestoreConstraint(int idx,
int select,
int newValue,
int oldValue)
Method called when one of the variables has a restored value. |
java.util.Set |
whyIsFalse()
When all variables are instantiated, explains why the wonstraint is false. |
java.util.Set |
whyIsTrue()
When all variables are instantiated, explains why the wonstraint is true. |
Methods inherited from class choco.global.matching.AbstractBipartiteGraph |
addComponentEdge, addComponentVertex, augment, findAlternatingPath, firstDFSearch, firstPassDFS, getPriority, init, initSCCGraph, match, mayDiminishFlowBetween, mayGrowFlowBetween, mayGrowFlowToSink, mayInverseMatch, mayMatch, propagate, removeUselessEdges, secondDFSearch, secondPassDFS |
Methods inherited from class choco.AbstractConstraint |
addListener, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getProblem, getVarIdxInOpposite, isActive, isEntailed, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface choco.Propagator |
assignIndices, awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent, isEntailed, propagate |
PalmAllDifferent
public PalmAllDifferent(IntDomainVar[] vars,
int minValue,
int maxValue)
newAllDiff
public static AllDifferent newAllDiff(IntDomainVar[] vars)
isSatisfied
public boolean isSatisfied()
- Description copied from class:
AllDifferent
- Checks if the constraint is satisfied when all variables are instantiated.
- Specified by:
isSatisfied
in interface Constraint
- Overrides:
isSatisfied
in class AllDifferent
deleteEdgeAndPublish
public void deleteEdgeAndPublish(int i,
int j)
throws ContradictionException
- Description copied from class:
AllDifferent
- when an edge is definitely removed from the bipartite assignment graph.
- Overrides:
deleteEdgeAndPublish
in class AllDifferent
- Throws:
ContradictionException
takeIntoAccountStatusChange
public void takeIntoAccountStatusChange(int index)
- Description copied from interface:
PalmConstraint
- Informs constraints that one of their children has a modified status (due to value restoration).
- Specified by:
takeIntoAccountStatusChange
in interface PalmConstraint
updateDataStructuresOnConstraint
public void updateDataStructuresOnConstraint(int idx,
int select,
int newValue,
int oldValue)
- Description copied from interface:
PalmVarListener
- Method called when one of the variables is modified.
- Specified by:
updateDataStructuresOnConstraint
in interface PalmVarListener
- Parameters:
idx
- Index of the variable.select
- Type of modification (PalmIntVar.INF
, PalmIntVar.SUP
,
PalmIntVar.VAL
).newValue
- New value (or modified value).oldValue
- Old value (or 0 if this a value removal).
updateDataStructuresOnRestoreConstraint
public void updateDataStructuresOnRestoreConstraint(int idx,
int select,
int newValue,
int oldValue)
- Description copied from interface:
PalmVarListener
- Method called when one of the variables has a restored value.
- Specified by:
updateDataStructuresOnRestoreConstraint
in interface PalmVarListener
- Parameters:
idx
- Index of the variable.select
- Type of modification.newValue
- New value (or modified value).oldValue
- Old value (or 0 if this a value removal).
awakeOnRestoreInf
public void awakeOnRestoreInf(int idx)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles an inf bound restoration on the constraint
idx
- Specified by:
awakeOnRestoreInf
in interface PalmIntVarListener
- Parameters:
idx
- Variable involved.
- Throws:
ContradictionException
awakeOnRestoreSup
public void awakeOnRestoreSup(int idx)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles a sup bound restoration on the constraint
idx
- Specified by:
awakeOnRestoreSup
in interface PalmIntVarListener
- Parameters:
idx
- Variable involved.
- Throws:
ContradictionException
awakeOnRestoreVal
public void awakeOnRestoreVal(int idx,
int val)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles a val restoration on the constraint
idx
- Specified by:
awakeOnRestoreVal
in interface PalmIntVarListener
- Parameters:
idx
- Variable involved.
- Throws:
ContradictionException
awakeOnRestoreVal
public void awakeOnRestoreVal(int idx,
IntIterator it)
throws ContradictionException
- Description copied from interface:
PalmIntVarListener
- Handles a val restoration on the constraint
idx
- Specified by:
awakeOnRestoreVal
in interface PalmIntVarListener
- Parameters:
idx
- Variable involved.
- Throws:
ContradictionException
awakeOnRem
public void awakeOnRem(int idx,
int val)
- Description copied from class:
AllDifferent
- when a value is removed from a domain var, removed the corresponding edge in current matching
- Specified by:
awakeOnRem
in interface IntVarEventListener
- Overrides:
awakeOnRem
in class AllDifferent
- Parameters:
idx
- the variable indexval
- the removed value
awake
public void awake()
throws ContradictionException
- Description copied from class:
AllDifferent
- no specific initial propagation (awake does the same job as propagate)
- Specified by:
awake
in interface Propagator
- Overrides:
awake
in class AllDifferent
- Throws:
ContradictionException
whyIsTrue
public java.util.Set whyIsTrue()
- Description copied from interface:
PalmIntVarListener
- When all variables are instantiated, explains why the wonstraint is true.
- Specified by:
whyIsTrue
in interface PalmIntVarListener
- Returns:
- A set of constraint justifying that the constraint is satisfied.
whyIsFalse
public java.util.Set whyIsFalse()
- Description copied from interface:
PalmIntVarListener
- When all variables are instantiated, explains why the wonstraint is false.
- Specified by:
whyIsFalse
in interface PalmIntVarListener
- Returns:
- A set of constraint justifying that the constraint is not satisfied.
augmentFlow
public void augmentFlow()
throws ContradictionException
- Description copied from class:
AbstractBipartiteGraph
- keeps augmenting the flow until a maximal flow is reached
- Overrides:
augmentFlow
in class AbstractBipartiteGraph
- Throws:
ContradictionException