choco.cp.solver.constraints.reified
Class ReifiedIntSConstraint

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.reified.ReifiedIntSConstraint
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener
Direct Known Subclasses:
IfThenElse

public class ReifiedIntSConstraint
extends AbstractLargeIntSConstraint

A constraint that allows to reify another constraint into a boolean value. b = 1 <=> cons is satisfied b = 0 <=> oppositeCons is satisfied

cons and oppositeCons do not need to be really the constraint and its opposite, it can be two different constraints as well


Field Summary
protected  int[] scopeCons
           
protected  int[] scopeOCons
           
 
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
 
Method Summary
 void addExtension(int extensionNumber)
          Adds a new extension.
 void addListener(boolean dynamicAddition)
          This function connects a constraint with its variables in several ways.
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnBounds(int varIndex)
           
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnRem(int idx, int x)
          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 idx)
          Default propagation on improved upper bound: propagation on domain revision.
 void filter()
           
 void filterReifiedConstraintFromCons()
           
 int getFilteredEventMask(int idx)
           
 boolean isSatisfied(int[] tuple)
          TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !
 String pretty()
          pretty printing of the object.
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void setPropagationEngine(PropagationEngine propEng)
          Define the propagation engine within the constraint.
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
getConstraintType, isConsistent, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
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, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scopeCons

protected int[] scopeCons

scopeOCons

protected int[] scopeOCons
Method Detail

addExtension

public void addExtension(int extensionNumber)
Adds a new extension.

Specified by:
addExtension in interface IExtensionnable
Overrides:
addExtension in class AbstractSConstraint<IntDomainVar>
Parameters:
extensionNumber - should use the number returned by getAbstractSConstraintExtensionNumber

filterReifiedConstraintFromCons

public void filterReifiedConstraintFromCons()
                                     throws ContradictionException
Throws:
ContradictionException

getFilteredEventMask

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

filter

public final void filter()
                  throws ContradictionException
Throws:
ContradictionException

propagate

public final 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 final void awakeOnInf(int idx)
                      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 final void awakeOnSup(int idx)
                      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 final void awakeOnInst(int idx)
                       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

awakeOnRem

public final void awakeOnRem(int idx,
                             int x)
                      throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on one value removal: propagation on domain revision.

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

awakeOnRemovals

public final 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

awakeOnBounds

public final void awakeOnBounds(int varIndex)
                         throws ContradictionException
Specified by:
awakeOnBounds in interface IntPropagator
Overrides:
awakeOnBounds in class AbstractIntSConstraint
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

addListener

public void addListener(boolean dynamicAddition)
Description copied from class: AbstractSConstraint
This function connects a constraint with its variables in several ways. Note that it may only be called once the constraint has been fully created and is being posted to a model. Note that it should be called only once per constraint. This can be a dynamic addition (undone upon backtracking) or not

Overrides:
addListener in class AbstractSConstraint<IntDomainVar>
Parameters:
dynamicAddition - if the addition should be dynamical

setPropagationEngine

public void setPropagationEngine(PropagationEngine propEng)
Define the propagation engine within the constraint. Mandatory to throw ContradictionException.

Overrides:
setPropagationEngine in class Propagator
Parameters:
propEng - the current propagation engine

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

isSatisfied

public boolean isSatisfied(int[] tuple)
TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet !

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class AbstractIntSConstraint
Parameters:
tuple - value for each variable
Returns:
true if the tuple satisfies the constraint


Copyright © 2012. All Rights Reserved.