choco.kernel.solver.constraints.global.matching
Class AbstractBipartiteFlow

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
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener
Direct Known Subclasses:
GlobalCardinality

public abstract class AbstractBipartiteFlow
extends AbstractBipartiteGraph

A general assignment constraint with constraints on the flow bounds


Nested Class Summary
 
Nested classes/interfaces inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
AbstractBipartiteGraph.IntQueue
 
Field Summary
protected  boolean compatibleFlow
           
protected  IStateBool compatibleSupport
           
protected  IStateIntVector flow
           
protected  int[] maxFlow
           
protected  int[] 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
AbstractBipartiteFlow(IEnvironment environment, IntDomainVar[] vars, int nbLeft, int nbRight)
          Constructor for AbstractBipartiteFlow
 
Method Summary
 void augment(int x)
          Augment flow on the current matching
 void decreaseMatchingSize(int j)
          updates the matching size when the matching is rebuilt
 void deleteMatch(int i, int j)
          remove the assignment of j to the ith variable
 int findAlternatingPath()
          Search for an augmenting path
protected  int getMaxFlow(int j)
           
protected  int getMinFlow(int j)
           
 void increaseMatchingSize(int j)
          updates the matching size when one more left vertex is matched with j
protected  void init()
           
 boolean mayDiminishFlowFromSource(int j)
          check unassignement
 boolean mayGrowFlowFromSource(int j)
          check assignement
 boolean mustGrowFlowFromSource(int j)
          check if j should be assigned to other variables
 void putRefMatch(int i, int j)
          Assignment of j to the ith variable
protected  void removeUselessEdges()
          remove arcs connecting two different strongly connected components the event generated by the flow algorithm: discovering that an edge is no longer valid, and posting this event to the constraint strategy: since we are already achieving GAC consistency in one single loop, there is no need to post a constAwake
 void setMatch(int i, int j)
          match the ith variable to value j
 
Methods inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
addComponentEdge, addComponentVertex, augmentFlow, deleteEdgeAndPublish, firstDFSearch, firstPassDFS, getNbComponents, initSCCGraph, match, mayDiminishFlowBetween, mayGrowFlowBetween, mayGrowFlowToSink, mayInverseMatch, mayMatch, prettyPrintForDebug, propagate, refreshSCC, secondDFSearch, secondPassDFS
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnInf, awakeOnInst, awakeOnRem, awakeOnRemovals, awakeOnSup, getConstraintType, isConsistent, isSatisfied, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, isEntailed, opposite, pretty, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, awake, 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
 

Field Detail

minFlow

protected int[] minFlow

maxFlow

protected int[] maxFlow

flow

protected IStateIntVector flow

compatibleFlow

protected boolean compatibleFlow

compatibleSupport

protected IStateBool compatibleSupport
Constructor Detail

AbstractBipartiteFlow

public AbstractBipartiteFlow(IEnvironment environment,
                             IntDomainVar[] vars,
                             int nbLeft,
                             int nbRight)
Constructor for AbstractBipartiteFlow

Parameters:
environment -
vars - nbLeft domain variables
nbLeft - number of domain variables to assign
nbRight - number of values for assignment
Method Detail

init

protected void init()
Overrides:
init in class AbstractBipartiteGraph

getMinFlow

protected int getMinFlow(int j)

getMaxFlow

protected int getMaxFlow(int j)

setMatch

public void setMatch(int i,
                     int j)
match the ith variable to value j

Specified by:
setMatch in class AbstractBipartiteGraph
Parameters:
i - the variable to match
j - the value to assign

deleteMatch

public void deleteMatch(int i,
                        int j)
remove the assignment of j to the ith variable

Specified by:
deleteMatch in class AbstractBipartiteGraph
Parameters:
i - the variable to unmatch
j - the value to remove

putRefMatch

public void putRefMatch(int i,
                        int j)
Assignment of j to the ith variable

Specified by:
putRefMatch in class AbstractBipartiteGraph
Parameters:
i - the variable to assign
j - the value

mayDiminishFlowFromSource

public boolean mayDiminishFlowFromSource(int j)
check unassignement

Specified by:
mayDiminishFlowFromSource in class AbstractBipartiteGraph
Parameters:
j - the jth value
Returns:
true if a variable assigned to j could be unassigned

mayGrowFlowFromSource

public boolean mayGrowFlowFromSource(int j)
check assignement

Specified by:
mayGrowFlowFromSource in class AbstractBipartiteGraph
Parameters:
j - the jth value
Returns:
true if a variable could be assigned to j

mustGrowFlowFromSource

public boolean mustGrowFlowFromSource(int j)
check if j should be assigned to other variables

Specified by:
mustGrowFlowFromSource in class AbstractBipartiteGraph
Parameters:
j - the jth value
Returns:
true if j has not been assigned to enough variables

increaseMatchingSize

public void increaseMatchingSize(int j)
updates the matching size when one more left vertex is matched with j

Specified by:
increaseMatchingSize in class AbstractBipartiteGraph
Parameters:
j - indice of the assigned value

decreaseMatchingSize

public void decreaseMatchingSize(int j)
updates the matching size when the matching is rebuilt

Specified by:
decreaseMatchingSize in class AbstractBipartiteGraph
Parameters:
j - indice of the removed assignement

findAlternatingPath

public int findAlternatingPath()
Search for an augmenting path

Overrides:
findAlternatingPath in class AbstractBipartiteGraph
Returns:

augment

public void augment(int x)
Augment flow on the current matching

Overrides:
augment in class AbstractBipartiteGraph
Parameters:
x - left extremity of one of the matching arc

removeUselessEdges

protected void removeUselessEdges()
                           throws ContradictionException
Description copied from class: AbstractBipartiteGraph
remove arcs connecting two different strongly connected components the event generated by the flow algorithm: discovering that an edge is no longer valid, and posting this event to the constraint strategy: since we are already achieving GAC consistency in one single loop, there is no need to post a constAwake

Overrides:
removeUselessEdges in class AbstractBipartiteGraph
Throws:
ContradictionException


Copyright © 2012. All Rights Reserved.