choco.cp.solver.constraints.global.matching
Class GlobalCardinalityVar

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
          extended by choco.kernel.solver.constraints.integer.AbstractIntSConstraint
              extended by choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
                  extended by choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
                      extended by choco.kernel.solver.constraints.global.matching.AbstractBipartiteFlow
                          extended by choco.cp.solver.constraints.global.matching.GlobalCardinality
                              extended by choco.cp.solver.constraints.global.matching.GlobalCardinalityVar
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class GlobalCardinalityVar
extends GlobalCardinality

Simple implementation of global cardinality constraint with occurrence constrained by variables and not only integer bounds.


Nested Class Summary
 
Nested classes/interfaces inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
AbstractBipartiteGraph.IntQueue
 
Field Summary
 
Fields inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteFlow
compatibleFlow, compatibleSupport, flow, maxFlow, minFlow
 
Fields inherited from class choco.kernel.solver.constraints.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.kernel.solver.constraints.AbstractSConstraint
cIndices, constraintType, extensions, vars
 
Fields inherited from class choco.kernel.solver.propagation.Propagator
active, constAwakeEvent, priority, propagationEngine
 
Fields inherited from interface choco.kernel.solver.constraints.SConstraint
LOGGER
 
Constructor Summary
GlobalCardinalityVar(IntDomainVar[] values, IntDomainVar[] occurences, IEnvironment environment)
           
GlobalCardinalityVar(IntDomainVar[] values, int minValue, int maxValue, IntDomainVar[] occurences, IEnvironment environment)
           
 
Method Summary
 void awake()
          performing the initial propagation, reduce variables domain to the candidate assign values
 void awakeOnInf(int idx)
          update the reference matching before redoing the strongly connected components analysis when removing value in the domain of variable idx
 void awakeOnInst(int idx)
          update the reference matching before redoing the strongly connected components analysis when idx is instantiated
 void awakeOnRem(int idx, int x)
          Implement reaction to edge removal
 void awakeOnSup(int idx)
          update the reference matching before redoing the strongly connected components analysis when removing value in the domain of variable idx
 void deleteSupport()
           
protected  int getMaxFlow(int j)
           
protected  int getMinFlow(int j)
           
 boolean isSatisfied(int[] tuple)
          TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !
 
Methods inherited from class choco.cp.solver.constraints.global.matching.GlobalCardinality
clone, deleteEdgeAndPublish, pretty, propagate, setEdgeAndPublish
 
Methods inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteFlow
augment, decreaseMatchingSize, deleteMatch, findAlternatingPath, increaseMatchingSize, init, mayDiminishFlowFromSource, mayGrowFlowFromSource, mustGrowFlowFromSource, putRefMatch, removeUselessEdges, setMatch
 
Methods inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
addComponentEdge, addComponentVertex, augmentFlow, firstDFSearch, firstPassDFS, getNbComponents, initSCCGraph, match, mayDiminishFlowBetween, mayGrowFlowBetween, mayGrowFlowToSink, mayInverseMatch, mayMatch, prettyPrintForDebug, refreshSCC, secondDFSearch, secondPassDFS
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnRemovals, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, isEntailed, opposite, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, constAwake, fail, getEvent, getFilteredEventMask, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlobalCardinalityVar

public GlobalCardinalityVar(IntDomainVar[] values,
                            IntDomainVar[] occurences,
                            IEnvironment environment)

GlobalCardinalityVar

public GlobalCardinalityVar(IntDomainVar[] values,
                            int minValue,
                            int maxValue,
                            IntDomainVar[] occurences,
                            IEnvironment environment)
Method Detail

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Description copied from class: GlobalCardinality
update the reference matching before redoing the strongly connected components analysis when removing value in the domain of variable idx

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class GlobalCardinality
Parameters:
idx - variable index
Throws:
ContradictionException

awakeOnRem

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

Specified by:
awakeOnRem in interface IntPropagator
Overrides:
awakeOnRem in class GlobalCardinality
Parameters:
idx - variable index
x - value to remove
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Description copied from class: GlobalCardinality
update the reference matching before redoing the strongly connected components analysis when removing value in the domain of variable idx

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class GlobalCardinality
Parameters:
idx - variable index
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Description copied from class: GlobalCardinality
update the reference matching before redoing the strongly connected components analysis when idx is instantiated

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class GlobalCardinality
Parameters:
idx - variable index
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

Overrides:
awake in class GlobalCardinality
Throws:
ContradictionException - contradiction exception

deleteSupport

public void deleteSupport()

getMinFlow

protected int getMinFlow(int j)
Overrides:
getMinFlow in class AbstractBipartiteFlow

getMaxFlow

protected int getMaxFlow(int j)
Overrides:
getMaxFlow in class AbstractBipartiteFlow

isSatisfied

public boolean isSatisfied(int[] tuple)
Description copied from class: AbstractIntSConstraint
TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class GlobalCardinality


Copyright © 2012. All Rights Reserved.