choco.kernel.solver.constraints.set
Class AbstractMixedSetIntSConstraint

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<Var>
          extended by choco.kernel.solver.constraints.set.AbstractMixedSetIntSConstraint
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<Var>, IntPropagator, SetPropagator, Cloneable, EventListener
Direct Known Subclasses:
AbstractBinSetIntSConstraint, AbstractLargeSetIntSConstraint, AmongSet

public abstract class AbstractMixedSetIntSConstraint
extends AbstractSConstraint<Var>
implements SetPropagator, IntPropagator

A class for mixed set and int constraint. It refers to both interface SetConstraint and IntConstraint and implements a default behaviour for all events awakeOn...


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
protected AbstractMixedSetIntSConstraint(Var[] vars)
          Constructs a mixed set-int constraint
 
Method Summary
 void awakeOnBounds(int varIndex)
           
 void awakeOnEnv(int varIdx, int x)
          Default propagation on enveloppe modification: propagation on removing a value from the enveloppe.
 void awakeOnEnvRemovals(int idx, DisposableIntIterator deltaDomain)
          BEWARE: No need to dipose the iterator, this done in the calling methode
 void awakeOnInf(int varIdx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int varIdx)
          Default propagation on instantiation.
 void awakeOnKer(int varIdx, int x)
          Default propagation on kernel modification: propagation on adding a value to the kernel.
 void awakeOnkerAdditions(int idx, DisposableIntIterator deltaDomain)
          BEWARE: No need to dipose the iterator, this done in the calling methode
 void awakeOnRem(int varIdx, int val)
          Default propagation on one value removal: propagation on domain revision.
 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 varIdx)
          Default propagation on improved upper bound: propagation on domain revision.
 SConstraintType getConstraintType()
          Return the type of constraint, ie the type of variable involved in the constraint
 boolean isConsistent()
          tests if the constraint is consistent with respect to the current state of domains
 boolean isSatisfied(int[] tuple)
           
 
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, propagate, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.kernel.solver.constraints.SConstraint
isSatisfied
 

Constructor Detail

AbstractMixedSetIntSConstraint

protected AbstractMixedSetIntSConstraint(Var[] vars)
Constructs a mixed set-int constraint

Parameters:
vars - list of variables
Method Detail

awakeOnRemovals

public void awakeOnRemovals(int idx,
                            DisposableIntIterator deltaDomain)
                     throws ContradictionException
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
Parameters:
idx -
Throws:
ContradictionException

awakeOnBounds

public void awakeOnBounds(int varIndex)
                   throws ContradictionException
Specified by:
awakeOnBounds in interface IntPropagator
Throws:
ContradictionException

awakeOnKer

public void awakeOnKer(int varIdx,
                       int x)
                throws ContradictionException
Description copied from interface: SetPropagator
Default propagation on kernel modification: propagation on adding a value to the kernel.

Specified by:
awakeOnKer in interface SetPropagator
Throws:
ContradictionException

awakeOnEnv

public void awakeOnEnv(int varIdx,
                       int x)
                throws ContradictionException
Description copied from interface: SetPropagator
Default propagation on enveloppe modification: propagation on removing a value from the enveloppe.

Specified by:
awakeOnEnv in interface SetPropagator
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int varIdx)
                 throws ContradictionException
Description copied from interface: SetPropagator
Default propagation on instantiation.

Specified by:
awakeOnInst in interface IntPropagator
Specified by:
awakeOnInst in interface SetPropagator
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int varIdx,
                       int val)
                throws ContradictionException
Default propagation on one value removal: propagation on domain revision.

Specified by:
awakeOnRem in interface IntPropagator
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int varIdx)
                throws ContradictionException
Default propagation on improved lower bound: propagation on domain revision.

Specified by:
awakeOnInf in interface IntPropagator
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int varIdx)
                throws ContradictionException
Default propagation on improved upper bound: propagation on domain revision.

Specified by:
awakeOnSup in interface IntPropagator
Throws:
ContradictionException

awakeOnEnvRemovals

public void awakeOnEnvRemovals(int idx,
                               DisposableIntIterator deltaDomain)
                        throws ContradictionException
Description copied from interface: SetPropagator
BEWARE: No need to dipose the iterator, this done in the calling methode

Specified by:
awakeOnEnvRemovals in interface SetPropagator
Throws:
ContradictionException

awakeOnkerAdditions

public void awakeOnkerAdditions(int idx,
                                DisposableIntIterator deltaDomain)
                         throws ContradictionException
Description copied from interface: SetPropagator
BEWARE: No need to dipose the iterator, this done in the calling methode

Specified by:
awakeOnkerAdditions in interface SetPropagator
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied(int[] tuple)
Specified by:
isSatisfied in interface IntPropagator

getConstraintType

public SConstraintType getConstraintType()
Description copied from interface: SConstraint
Return the type of constraint, ie the type of variable involved in the constraint

Specified by:
getConstraintType in interface SConstraint<Var>
Returns:

isConsistent

public boolean isConsistent()
tests if the constraint is consistent with respect to the current state of domains

Specified by:
isConsistent in class Propagator
Returns:
wether the constraint is consistent


Copyright © 2012. All Rights Reserved.