choco.global.matching
Class AllDifferent
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
- All Implemented Interfaces:
- Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener
- Direct Known Subclasses:
- PalmAllDifferent
public class AllDifferent
- extends AbstractBipartiteMatching
- implements IntConstraint
Standard alldiff constraint with generalized AC
integer valued variables are used only for the left vertex set
no explicit variables are used for the right vertex set
the right vertex set is the interval (minValue .. maxValue)
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 |
awake()
no specific initial propagation (awake does the same job as propagate) |
void |
awakeOnInf(int idx)
update current matching when a domain inf is increased |
void |
awakeOnInst(int idx)
update current matching when a variable has been instantiated |
void |
awakeOnRem(int idx,
int val)
when a value is removed from a domain var, removed the corresponding edge in current matching |
void |
awakeOnSup(int idx)
update current matching when a domain sup is decreased |
void |
awakeOnVar(int idx)
the idx variable has been modified, awake the constraint
needs to be defined, otherwise the default awakeOnVar, calling propagate is called and thus the reference matching
is not updated before redoing the strongly connected components analysis. |
java.lang.Object |
clone()
Builds a copy of this contraint. |
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. |
void |
setEdgeAndPublish(int i,
int j)
when an edge is definitely chosen in the bipartite assignment graph. |
Methods inherited from class choco.global.matching.AbstractBipartiteGraph |
addComponentEdge, addComponentVertex, augment, augmentFlow, 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 |
AllDifferent
public AllDifferent(IntDomainVar[] vars)
- API entry point: creating an ice alldifferent constraint (before posting it)
- Parameters:
vars
-
AllDifferent
public AllDifferent(IntDomainVar[] vars,
int minValue,
int maxValue)
- AllDiff constraint constructor
- Parameters:
vars
- the choco variable listminValue
- minimal value in vars domainmaxValue
- maximal value in vars domain
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Description copied from class:
AbstractBipartiteMatching
- Builds a copy of this contraint.
- Specified by:
clone
in interface Constraint
- Overrides:
clone
in class AbstractBipartiteMatching
- Returns:
- a clone of this constraint
- Throws:
java.lang.CloneNotSupportedException
- if an error occurs during cloning
setEdgeAndPublish
public void setEdgeAndPublish(int i,
int j)
throws ContradictionException
- when an edge is definitely chosen in the bipartite assignment graph.
- Parameters:
i
- j
-
- Throws:
ContradictionException
deleteEdgeAndPublish
public void deleteEdgeAndPublish(int i,
int j)
throws ContradictionException
- when an edge is definitely removed from the bipartite assignment graph.
- Specified by:
deleteEdgeAndPublish
in class AbstractBipartiteGraph
- Parameters:
i
- j
-
- Throws:
ContradictionException
awakeOnRem
public void awakeOnRem(int idx,
int val)
- 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 AbstractIntConstraint
- Parameters:
idx
- the variable indexval
- the removed value
awakeOnVar
public void awakeOnVar(int idx)
- the idx variable has been modified, awake the constraint
needs to be defined, otherwise the default awakeOnVar, calling propagate is called and thus the reference matching
is not updated before redoing the strongly connected components analysis.
- Specified by:
awakeOnVar
in interface VarEventListener
- Specified by:
awakeOnVar
in interface Propagator
- Overrides:
awakeOnVar
in class AbstractConstraint
- Parameters:
idx
- the variable index
awakeOnInf
public void awakeOnInf(int idx)
- update current matching when a domain inf is increased
- Specified by:
awakeOnInf
in interface IntVarEventListener
- Overrides:
awakeOnInf
in class AbstractIntConstraint
- Parameters:
idx
- the variable index
awakeOnSup
public void awakeOnSup(int idx)
- update current matching when a domain sup is decreased
- Specified by:
awakeOnSup
in interface IntVarEventListener
- Overrides:
awakeOnSup
in class AbstractIntConstraint
- Parameters:
idx
- the variable index
awakeOnInst
public void awakeOnInst(int idx)
throws ContradictionException
- update current matching when a variable has been instantiated
- Specified by:
awakeOnInst
in interface IntVarEventListener
- Overrides:
awakeOnInst
in class AbstractIntConstraint
- Parameters:
idx
- the variable index
- Throws:
ContradictionException
awake
public void awake()
throws ContradictionException
- no specific initial propagation (awake does the same job as propagate)
- Specified by:
awake
in interface Propagator
- Overrides:
awake
in class AbstractConstraint
- Throws:
ContradictionException
isSatisfied
public boolean isSatisfied()
- Checks if the constraint is satisfied when all variables are instantiated.
- Specified by:
isSatisfied
in interface Constraint