choco.palm.global.matching
Class PalmCardinality

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.AbstractBipartiteFlow
                          extended by choco.global.matching.GlobalCardinality
                              extended by choco.palm.global.matching.PalmCardinality
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, PalmIntVarListener, PalmConstraint, PalmVarListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class PalmCardinality
extends GlobalCardinality
implements PalmConstraint, PalmIntVarListener


Nested Class Summary
 
Nested classes/interfaces inherited from class choco.global.matching.AbstractBipartiteGraph
AbstractBipartiteGraph.IntQueue
 
Field Summary
 
Fields inherited from class choco.global.matching.AbstractBipartiteFlow
compatibleFlow, flow, maxFlow, minFlow
 
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
PalmCardinality(IntDomainVar[] vars, int[] low, int[] up)
           
PalmCardinality(IntDomainVar[] vars, int minValue, int maxValue, int[] low, int[] up)
           
 
Method Summary
 void augmentFlow()
          keeps augmenting the flow until a maximal flow is reached
 void awake()
          performing the initial propagation, reduce variables domain to the candidate assign values
 void awakeOnRem(int idx, int val)
          Implement reaction to edge removal
 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
 java.lang.Object clone()
          returns a copy of the constraint.
 void deleteEdgeAndPublish(int i, int j)
          implement one of the two main events: when an edge is definitely removed from the bipartite assignment graph
 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.GlobalCardinality
awakeOnInf, awakeOnInst, awakeOnSup, awakeOnVar, isSatisfied, pretty, setEdgeAndPublish
 
Methods inherited from class choco.global.matching.AbstractBipartiteFlow
augment, decreaseMatchingSize, deleteMatch, findAlternatingPath, increaseMatchingSize, initAbstractBipartiteFlow, mayDiminishFlowFromSource, mayGrowFlowFromSource, mustGrowFlowFromSource, putRefMatch, setMatch
 
Methods inherited from class choco.global.matching.AbstractBipartiteGraph
addComponentEdge, addComponentVertex, 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 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
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.Constraint
getConstraintIdx, getNbVars, getVar, getVarIdxInOpposite, isEquivalentTo, isSatisfied, opposite, setConstraintIndex, setVar
 
Methods inherited from interface choco.Entity
getProblem, pretty
 
Methods inherited from interface choco.palm.PalmVarListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.palm.PalmVarListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.integer.var.IntVarEventListener
awakeOnInf, awakeOnInst, awakeOnSup, getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.integer.IntConstraint
awakeOnBounds, awakeOnRemovals, getIntVar
 

Constructor Detail

PalmCardinality

public PalmCardinality(IntDomainVar[] vars,
                       int minValue,
                       int maxValue,
                       int[] low,
                       int[] up)

PalmCardinality

public PalmCardinality(IntDomainVar[] vars,
                       int[] low,
                       int[] up)
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: Constraint
returns a copy of the constraint. This copy is a new object, may be a recursive copy in case of composite constraints. The original and the copy share the same variables & plugins

Specified by:
clone in interface Constraint
Overrides:
clone in class GlobalCardinality
Returns:
Throws:
java.lang.CloneNotSupportedException

deleteEdgeAndPublish

public void deleteEdgeAndPublish(int i,
                                 int j)
                          throws ContradictionException
Description copied from class: GlobalCardinality
implement one of the two main events: when an edge is definitely removed from the bipartite assignment graph

Overrides:
deleteEdgeAndPublish in class GlobalCardinality
Parameters:
i - the variable to unmatch
j - the value to remove
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).

awakeOnRem

public void awakeOnRem(int idx,
                       int val)
Description copied from class: GlobalCardinality
Implement reaction to edge removal

Specified by:
awakeOnRem in interface IntVarEventListener
Overrides:
awakeOnRem in class GlobalCardinality
Parameters:
idx - variable index
val - value to remove

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

awake

public void awake()
           throws ContradictionException
Description copied from class: GlobalCardinality
performing the initial propagation, reduce variables domain to the candidate assign values

Specified by:
awake in interface Propagator
Overrides:
awake in class GlobalCardinality
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