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

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

public abstract class AbstractBipartiteMatching
extends AbstractBipartiteGraph

A subclass of AbtractBipartiteGraph restricted only to matchings (and not flows).


Nested Class Summary
 
Nested classes/interfaces inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
AbstractBipartiteGraph.IntQueue
 
Field Summary
protected  IStateIntVector refInverseMatch
          Vector with the reverse matching.
 
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
AbstractBipartiteMatching(IEnvironment environment, IntDomainVar[] vars, int nbLeft, int nbRight)
          Builds a new instance for the specified vars.
 
Method Summary
 void decreaseMatchingSize(int j)
          Matching size has been decrease by 1.
 void deleteMatch(int i, int j)
          Removing the arc i-j from the reference matching.
 void increaseMatchingSize(int j)
          Matching size has been increase by 1.
protected  void init()
           
 int inverseMatch(int j)
          Accessing the left vertex matched to j.
 boolean mayDiminishFlowFromSource(int j)
          Checks if the flow can be decreased between source and a vertex.
 boolean mayGrowFlowFromSource(int j)
          Checks if the flow can be increased between source and a vertex.
 boolean mustGrowFlowFromSource(int j)
          Checks if the flow must be increased between the source and a vertex.
 void putRefMatch(int i, int j)
          Adding the arc i-j in the reference matching without any updates.
 void setMatch(int i, int j)
          Adding the arc i-j in the reference matching.
 
Methods inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
addComponentEdge, addComponentVertex, augment, augmentFlow, deleteEdgeAndPublish, findAlternatingPath, firstDFSearch, firstPassDFS, getNbComponents, initSCCGraph, match, mayDiminishFlowBetween, mayGrowFlowBetween, mayGrowFlowToSink, mayInverseMatch, mayMatch, prettyPrintForDebug, propagate, refreshSCC, removeUselessEdges, 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

refInverseMatch

protected IStateIntVector refInverseMatch
Vector with the reverse matching.

Constructor Detail

AbstractBipartiteMatching

public AbstractBipartiteMatching(IEnvironment environment,
                                 IntDomainVar[] vars,
                                 int nbLeft,
                                 int nbRight)
Builds a new instance for the specified vars.

Parameters:
environment -
vars - the variables
nbLeft - number of nodes in the first part of the bipartite matching
nbRight - number of nodes in the second part
Method Detail

init

protected void init()
Overrides:
init in class AbstractBipartiteGraph

inverseMatch

public int inverseMatch(int j)
Accessing the left vertex matched to j.

Parameters:
j - the vertex
Returns:
the left vertex matched to j

increaseMatchingSize

public void increaseMatchingSize(int j)
Matching size has been increase by 1.

Specified by:
increaseMatchingSize in class AbstractBipartiteGraph
Parameters:
j - useless here

decreaseMatchingSize

public void decreaseMatchingSize(int j)
Matching size has been decrease by 1.

Specified by:
decreaseMatchingSize in class AbstractBipartiteGraph
Parameters:
j - useless here

deleteMatch

public void deleteMatch(int i,
                        int j)
Removing the arc i-j from the reference matching.

Specified by:
deleteMatch in class AbstractBipartiteGraph
Parameters:
i - the left vertex
j - the right vertex

putRefMatch

public void putRefMatch(int i,
                        int j)
Adding the arc i-j in the reference matching without any updates.

Specified by:
putRefMatch in class AbstractBipartiteGraph
Parameters:
i - the left vertex
j - the right vertex

setMatch

public void setMatch(int i,
                     int j)
Adding the arc i-j in the reference matching.

Specified by:
setMatch in class AbstractBipartiteGraph
Parameters:
i - the left vertex
j - the right vertex

mayDiminishFlowFromSource

public boolean mayDiminishFlowFromSource(int j)
Checks if the flow can be decreased between source and a vertex.

Specified by:
mayDiminishFlowFromSource in class AbstractBipartiteGraph
Parameters:
j - the vertex
Returns:
whether the flow from the source to j (a right vertex) may be decreased

mayGrowFlowFromSource

public boolean mayGrowFlowFromSource(int j)
Checks if the flow can be increased between source and a vertex.

Specified by:
mayGrowFlowFromSource in class AbstractBipartiteGraph
Parameters:
j - the vertex
Returns:
whether the flow from the source to j (a right vertex) may be increased

mustGrowFlowFromSource

public boolean mustGrowFlowFromSource(int j)
Checks if the flow must be increased between the source and a vertex.

Specified by:
mustGrowFlowFromSource in class AbstractBipartiteGraph
Parameters:
j - the vertex
Returns:
whether the flow from the source to j (a right vertex) must be increased in order to get a maximal (sink/left vertex set saturating) flow


Copyright © 2012. All Rights Reserved.