choco.cp.solver.constraints.global
Class LeximinSConstraint

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

public final class LeximinSConstraint
extends AbstractLargeIntSConstraint

SemiLeximinConstraint is a constraint that ensures the leximin ordering between one vector of variables and one of integers. We define the leximin preorder as follows: Let x and y be two vectors of n integers, and let x? and y? be the version of x and y rearranged in increasing order. x and y are said leximin-indifferent if x?=y?. y is leximin-preferred to x (written y>leximinx if and only if there is an i< n such that for all j� i: - the jth component of x? is equal to the jth component of y? - the ith component of x? is lower than the ith component of y? Let x and x' be two vectors of variables, and v be an instantiation. The constraint Leximin(x, x') holds on the set of variables belonging to x or x', and is satisfied by v if and only if v(x)

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
LeximinSConstraint(IntDomainVar[] x, IEnvironment environment)
          Creates a new LeximinConstraint instance.
LeximinSConstraint(IntVar[] x, IntVar[] y, IEnvironment environment)
          Creates a new LeximinConstraint instance.
 
Method Summary
 void awake()
          This method is invoked during the first propagation.
 void awakeOnInf(int idx)
          Cette m�thode r�agit si une variable a vu sa borne inf�rieure augmenter.
 void awakeOnInst(int idx)
          This method is called when a variable has been instanciated
 void awakeOnSup(int idx)
          Cette m�thode r�agit si une variable a vu sa borne sup�rieure diminuer.
 int getFilteredEventMask(int idx)
           
 boolean isSatisfied()
          This method checks if the constraint is satisfied, once the variables have all been satisfied.
 String pretty()
          Prints details about the constraint and its variables.
 void printOccVectors()
          Prints some of the useful private fields that are used by the gac algorithm.
 void propagate()
          This methode propagates the constraint events.
 void setPointersAndFlags()
          The setPointersAndFlags method sets the values α, β, γ and δ, used by the algorithm.
 String toString()
          The rather classical toString method...
 void updatePointersAndFlags(int idx, boolean inf)
          The setPointersAndFlags method updates the values α, β, γ and δ, used by the algorithm, when the domain of a variable has changed.
 
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
 
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

LeximinSConstraint

public LeximinSConstraint(IntVar[] x,
                          IntVar[] y,
                          IEnvironment environment)
Creates a new LeximinConstraint instance.

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

LeximinSConstraint

public LeximinSConstraint(IntDomainVar[] x,
                          IEnvironment environment)
Creates a new LeximinConstraint instance.

Parameters:
x - the concatenation of two integer variables array
environment -
Method Detail

getFilteredEventMask

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

setPointersAndFlags

public void setPointersAndFlags()
                         throws ContradictionException
The setPointersAndFlags method sets the values α, β, γ and δ, used by the algorithm.

Throws:
ContradictionException - if the model instance is inconsistant

updatePointersAndFlags

public void updatePointersAndFlags(int idx,
                                   boolean inf)
                            throws ContradictionException
The setPointersAndFlags method updates the values α, β, γ and δ, used by the algorithm, when the domain of a variable has changed.

Parameters:
idx - the index of the variable whose domain has changed
inf - a boolean value indicating whether the change occured with the lower bound (true) or with thee upper bound (false).
Throws:
ContradictionException - if the model instance is inconsistant

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
Cette m�thode r�agit si une variable a vu sa borne inf�rieure augmenter.

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Parameters:
idx - l'indice de la variable qui a �t� instanci�e.
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Cette m�thode r�agit si une variable a vu sa borne sup�rieure diminuer.

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Parameters:
idx - l'indice de la variable qui a �t� instanci�e.
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied()
This method checks if the constraint is satisfied, once the variables have all been satisfied.

Specified by:
isSatisfied in interface SConstraint<IntDomainVar>
Overrides:
isSatisfied in class AbstractIntSConstraint
Returns:
true iff the constraint is satisfied.

toString

public String toString()
The rather classical toString method...

Overrides:
toString in class AbstractSConstraint<IntDomainVar>
Returns:
a String representing the object.

pretty

public String pretty()
Prints details about the constraint and its variables.

Specified by:
pretty in interface IPretty
Overrides:
pretty in class AbstractSConstraint<IntDomainVar>
Returns:
The details in a string.

printOccVectors

public void printOccVectors()
Prints some of the useful private fields that are used by the gac algorithm.



Copyright © 2012. All Rights Reserved.