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

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
                          extended by choco.cp.solver.constraints.global.matching.AllDifferent
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class AllDifferent
extends AbstractBipartiteMatching

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.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
AbstractBipartiteGraph.IntQueue
 
Field Summary
 
Fields inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteMatching
refInverseMatch
 
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
AllDifferent(IntDomainVar[] vars, IEnvironment environment)
          API entry point: creating an ice alldifferent constraint (before posting it)
AllDifferent(IntDomainVar[] vars, int minValue, int maxValue, IEnvironment environment)
          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
 Object clone()
          Clone the constraint
 void deleteEdgeAndPublish(int i, int j)
          when an edge is definitely removed from the bipartite assignment graph.
 int getFilteredEventMask(int idx)
           
 int getFineDegree(int idx)
          Some global constraint might be able to provide some fine grained information about the "real" degree of a variables.
protected  void init()
           
 boolean isSatisfied(int[] tuple)
          Checks if the constraint is satisfied when all variables are instantiated.
 String pretty()
          pretty printing of the object.
 void setEdgeAndPublish(int i, int j)
          when an edge is definitely chosen in the bipartite assignment graph.
 
Methods inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteMatching
decreaseMatchingSize, deleteMatch, increaseMatchingSize, inverseMatch, mayDiminishFlowFromSource, mayGrowFlowFromSource, mustGrowFlowFromSource, putRefMatch, setMatch
 
Methods inherited from class choco.kernel.solver.constraints.global.matching.AbstractBipartiteGraph
addComponentEdge, addComponentVertex, augment, augmentFlow, 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, awakeOnRemovals, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, isEntailed, opposite, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, constAwake, fail, getEvent, 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

AllDifferent

public AllDifferent(IntDomainVar[] vars,
                    IEnvironment environment)
API entry point: creating an ice alldifferent constraint (before posting it)

Parameters:
vars -
environment -

AllDifferent

public AllDifferent(IntDomainVar[] vars,
                    int minValue,
                    int maxValue,
                    IEnvironment environment)
AllDiff constraint constructor

Parameters:
vars - the choco variable list
minValue - minimal value in vars domain
maxValue - maximal value in vars domain
environment -
Method Detail

getFilteredEventMask

public int getFilteredEventMask(int idx)
Overrides:
getFilteredEventMask in class Propagator

init

protected void init()
Overrides:
init in class AbstractBipartiteMatching

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: AbstractSConstraint
Clone the constraint

Overrides:
clone in class AbstractSConstraint<IntDomainVar>
Returns:
the clone of the constraint
Throws:
CloneNotSupportedException - Clone not supported exception

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 IntPropagator
Overrides:
awakeOnRem in class AbstractIntSConstraint
Parameters:
idx - the variable index
val - the removed value

awakeOnInf

public void awakeOnInf(int idx)
update current matching when a domain inf is increased

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
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 IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
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 IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Parameters:
idx - the variable index
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
no specific initial propagation (awake does the same job as propagate)

Overrides:
awake in class Propagator
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied(int[] tuple)
Checks if the constraint is satisfied when all variables are instantiated.

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

pretty

public String pretty()
Description copied from interface: IPretty
pretty printing of the object. This String is not constant and may depend on the context.

Specified by:
pretty in interface IPretty
Overrides:
pretty in class AbstractSConstraint<IntDomainVar>
Returns:
a readable string representation of the object

getFineDegree

public int getFineDegree(int idx)
Description copied from class: AbstractSConstraint
Some global constraint might be able to provide some fine grained information about the "real" degree of a variables. For example the global constraint on clauses can give the real number of clauses on each variable

Specified by:
getFineDegree in interface SConstraint<IntDomainVar>
Overrides:
getFineDegree in class AbstractSConstraint<IntDomainVar>
Parameters:
idx - index of the variable in the constraint
Returns:
a weight given to the variable by the constraint


Copyright © 2012. All Rights Reserved.