choco.cp.solver.constraints.global
Class SortingSConstraint

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.SortingSConstraint
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class SortingSConstraint
extends AbstractLargeIntSConstraint

SortingConstraint is a constraint that ensures that a vector is the sorted version of a second one. The filtering algorithm is the version of Kurt Mehlhorn and Sven Thiel, from CP'00 (Faster algorithms for Bound-Consistency of the Sortedness and the Alldifferent Constraint).

Version:
1.0
Author:
Sylvain Bouveret

Field Summary
 
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
SortingSConstraint(IntDomainVar[] x, IntDomainVar[] y)
          Creates a new SortingConstraint instance.
 
Method Summary
 void awake()
          This method is invoked during the first propagation.
 void awakeOnInf(int idx)
          This method is called when the minimal value of the domain of a variable has been updated.
 void awakeOnInst(int idx)
          This method is called when a variable has been instanciated
 void awakeOnSup(int idx)
          This method is called when the maximal value of the domain of a variable has been updated.
 void boundConsistency()
           
 boolean isSatisfied(int[] tuple)
          This method checks if the constraint is satisfied or not.
 String pretty()
          pretty printing of the object.
 void printVectors()
           
 void propagate()
          This methode propagates the constraint events.
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnRem, awakeOnRemovals, getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, 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

SortingSConstraint

public SortingSConstraint(IntDomainVar[] x,
                          IntDomainVar[] y)
Creates a new SortingConstraint instance.

Parameters:
x - the first array of integer variables
y - the second array of integer variables
Method Detail

boundConsistency

public void boundConsistency()
                      throws ContradictionException
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
This method is invoked during the first propagation.

Overrides:
awake in class Propagator
Throws:
ContradictionException - if a variable has an empty domain.

propagate

public void propagate()
               throws ContradictionException
This methode propagates the constraint events.

Specified by:
propagate in class Propagator
Throws:
ContradictionException - if a variable has an empty domain.

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
This method is called when a variable has been instanciated

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Parameters:
idx - the index of the instanciated variable.
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
This method is called when the minimal value of the domain of a variable has been updated.

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Parameters:
idx - the index of the variable whose domain has been updated.
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
This method is called when the maximal value of the domain of a variable has been updated.

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Parameters:
idx - the index of the variable whose domain has been updated.
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied(int[] tuple)
This method checks if the constraint is satisfied or not.

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class AbstractIntSConstraint
Returns:
true if and only if the constraint is satisfied.

printVectors

public final void printVectors()

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


Copyright © 2012. All Rights Reserved.