choco.global.matching
Class AllDifferent

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractLargeIntConstraint
                  extended by choco.global.matching.AbstractBipartiteGraph
                      extended by choco.global.matching.AbstractBipartiteMatching
                          extended by 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)


Nested Class Summary
 
Nested classes/interfaces inherited from class choco.global.matching.AbstractBipartiteGraph
AbstractBipartiteGraph.IntQueue
 
Field Summary
 
Fields inherited from class choco.global.matching.AbstractBipartiteMatching
refInverseMatch
 
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
 
Fields inherited from class choco.integer.constraints.AbstractLargeIntConstraint
cIndices, cste, vars
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
AllDifferent(IntDomainVar[] vars)
          API entry point: creating an ice alldifferent constraint (before posting it)
AllDifferent(IntDomainVar[] vars, int minValue, int maxValue)
          AllDiff constraint constructor
 
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.AbstractBipartiteMatching
decreaseMatchingSize, deleteMatch, increaseMatchingSize, initAbstractBipartiteMatching, inverseMatch, mayDiminishFlowFromSource, mayGrowFlowFromSource, mustGrowFlowFromSource, putRefMatch, setMatch
 
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.integer.constraints.AbstractLargeIntConstraint
assignIndices, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.integer.constraints.AbstractIntConstraint
awakeOnBounds, awakeOnRemovals, getSelfIndex, isConsistent
 
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 choco.AbstractEntity
pretty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.integer.IntConstraint
awakeOnBounds, awakeOnRemovals, getIntVar
 
Methods inherited from interface choco.Propagator
assignIndices, constAwake, delete, getEvent, getPlugIn, getPriority, isCompletelyInstantiated, isConsistent, isEntailed, propagate
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.integer.var.IntVarEventListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Constructor Detail

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 list
minValue - minimal value in vars domain
maxValue - maximal value in vars domain
Method Detail

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 index
val - 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