choco.cp.solver.constraints.global
Class BoundAllDiff

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

public final class BoundAllDiff
extends AbstractLargeIntSConstraint


Field Summary
 boolean PROPAGATE_ON_BOUNDS
           
static boolean PROPAGATE_ON_INSTANTIATIONS
           
 
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
BoundAllDiff(IntDomainVar[] vars, boolean global)
           
 
Method Summary
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnBounds(int idx)
           
 void awakeOnInf(int i)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int i)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnRemovals(int idx, DisposableIntIterator deltaDomain)
          The default implementation of propagation when a variable has been modified consists in iterating all values that have been removed (the delta domain) and propagate them one after another, incrementally.
 void awakeOnSup(int i)
          Default propagation on improved upper bound: propagation on domain revision.
protected  void filterLower()
           
protected  void filterUpper()
           
 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.
 boolean isSatisfied(int[] tuple)
          This method assumes that all variables are instantiated and checks if the values are consistent with the constraint.
protected  int pathmax(int[] tab, int i)
           
protected  int pathmin(int[] tab, int i)
           
protected  void pathset(int[] tab, int start, int end, int to)
           
 String pretty()
          pretty printing of the object.
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
protected  void sortIt()
           
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnRem, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, 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
 

Field Detail

PROPAGATE_ON_INSTANTIATIONS

public static boolean PROPAGATE_ON_INSTANTIATIONS

PROPAGATE_ON_BOUNDS

public boolean PROPAGATE_ON_BOUNDS
Constructor Detail

BoundAllDiff

public BoundAllDiff(IntDomainVar[] vars,
                    boolean global)
Method Detail

getFilteredEventMask

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

sortIt

protected void sortIt()

pathset

protected void pathset(int[] tab,
                       int start,
                       int end,
                       int to)

pathmin

protected int pathmin(int[] tab,
                      int i)

pathmax

protected int pathmax(int[] tab,
                      int i)

filterLower

protected void filterLower()
                    throws ContradictionException
Throws:
ContradictionException

filterUpper

protected void filterUpper()
                    throws ContradictionException
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint for the very first time until local consistency is reached.

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

propagate

public void propagate()
               throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint until local consistency is reached.

Specified by:
propagate in class Propagator
Throws:
ContradictionException - contradiction exception

awakeOnInf

public void awakeOnInf(int i)
                throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on improved lower bound: propagation on domain revision.

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int i)
                throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on improved upper bound: propagation on domain revision.

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int i)
                 throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on instantiation: full constraint re-propagation.

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnBounds

public void awakeOnBounds(int idx)
                   throws ContradictionException
Specified by:
awakeOnBounds in interface IntPropagator
Overrides:
awakeOnBounds in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnRemovals

public void awakeOnRemovals(int idx,
                            DisposableIntIterator deltaDomain)
                     throws ContradictionException
Description copied from class: AbstractIntSConstraint
The default implementation of propagation when a variable has been modified consists in iterating all values that have been removed (the delta domain) and propagate them one after another, incrementally.

Specified by:
awakeOnRemovals in interface IntPropagator
Overrides:
awakeOnRemovals in class AbstractIntSConstraint
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied(int[] tuple)
This method assumes that all variables are instantiated and checks if the values are consistent with the constraint. Here it checks that all variables have distinct values. It uses double for loops (Thus the complixity is in O(n^2).

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class AbstractIntSConstraint
Returns:
true if values are different.

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.