choco.palm.real.constraints
Class AbstractPalmSplit

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.real.constraint.AbstractUnRealConstraint
              extended by choco.palm.real.constraints.AbstractPalmUnRealConstraint
                  extended by choco.palm.real.constraints.AbstractPalmSplit
All Implemented Interfaces:
Constraint, Entity, DecisionConstraint, PalmConstraint, PalmVarListener, PalmRealVarListener, SymbolicDecision, VarEventListener, Propagator, RealConstraint, RealListener, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
PalmSplitLeft, PalmSplitRight

public abstract class AbstractPalmSplit
extends AbstractPalmUnRealConstraint
implements DecisionConstraint

An abstract implementation of a split constraint used for search algorithm. It is specialized for left split or right split (that lower half of the current interval or upper half).


Field Summary
protected  RealInterval current
          The propagated interval value (instantiated on creation on the specialized class).
protected  RealInterval previous
          The previous value of the variable.
 
Fields inherited from class choco.real.constraint.AbstractUnRealConstraint
cIdx0, v0
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
AbstractPalmSplit(RealVar var, RealInterval interval)
          Asbtract constructor: stores the variable, the previous value of this variable, and creates the PaLM plug-in.
 
Method Summary
 void addListener(boolean dynamicAddition)
          This function connects a constraint with its variables in several ways.
 void awake()
          First propagation of the constraint.
 void awakeOnInf(int idx)
          Awakes on lower bound (does nothing).
 void awakeOnRestoreInf(int idx)
          On lower bound restoration, launches the generic propagation.
 void awakeOnRestoreSup(int idx)
          On upper bound restoration, launches the generic propagation.
 void awakeOnSup(int idx)
          Awakes on upper bound (does nothing).
 java.lang.Object clone()
          returns a copy of the constraint.
 boolean isConsistent()
          Checks if the constraint is satisfied.
 boolean isSatisfied()
          Checks if the constraint is satisfied (should be called when completely instantiated).
 void propagate()
          Generic propagation of the constraint.
 void takeIntoAccountStatusChange(int index)
          Informs constraints that one of their children has a modified status (due to value restoration).
 java.lang.String toString()
          Returns this constraint as string: the name of the variable and the affected value.
 
Methods inherited from class choco.palm.real.constraints.AbstractPalmUnRealConstraint
updateDataStructuresOnConstraint, updateDataStructuresOnRestoreConstraint
 
Methods inherited from class choco.real.constraint.AbstractUnRealConstraint
assignIndices, getConstraintIdx, getNbVars, getRealVar, getRealVarNb, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.AbstractConstraint
awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEntailed, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
Methods inherited from class choco.AbstractEntity
pretty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface choco.palm.dbt.search.DecisionConstraint
getBranch, negate
 
Methods inherited from interface choco.prop.VarEventListener
isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
isActive, setActive, setPassive
 
Methods inherited from interface choco.real.constraint.RealConstraint
getRealVar, getRealVarNb
 
Methods inherited from interface choco.real.constraint.RealListener
getConstraintIdx, setConstraintIndex
 
Methods inherited from interface choco.real.constraint.RealListener
getConstraintIdx, setConstraintIndex
 

Field Detail

previous

protected RealInterval previous
The previous value of the variable.


current

protected RealInterval current
The propagated interval value (instantiated on creation on the specialized class).

Constructor Detail

AbstractPalmSplit

public AbstractPalmSplit(RealVar var,
                         RealInterval interval)
Asbtract constructor: stores the variable, the previous value of this variable, and creates the PaLM plug-in.

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: Constraint
returns a copy of the constraint. This copy is a new object, may be a recursive copy in case of composite constraints. The original and the copy share the same variables & plugins

Specified by:
clone in interface Constraint
Overrides:
clone in class AbstractConstraint
Returns:
Throws:
java.lang.CloneNotSupportedException

addListener

public void addListener(boolean dynamicAddition)
Description copied from class: AbstractConstraint
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 problem. Note that it should be called only once per constraint. This can be a dynamic addition (undone upon backtracking) or not

Specified by:
addListener in interface VarEventListener
Overrides:
addListener in class AbstractConstraint

toString

public java.lang.String toString()
Returns this constraint as string: the name of the variable and the affected value.

Overrides:
toString in class java.lang.Object

awake

public void awake()
           throws ContradictionException
First propagation of the constraint. Since we are now sure that the constraint is posted, the constraint is added to the explanation of the interval the variable must be included in. It allows to include this constraint in all withdrawals deduced by this constraint.

Specified by:
awake in interface Propagator
Overrides:
awake in class AbstractConstraint
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Generic propagation of the constraint. The variable is reduced to the intersection with the interval it should be included in.

Specified by:
propagate in interface Propagator
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Awakes on lower bound (does nothing).

Specified by:
awakeOnInf in interface RealListener
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Awakes on upper bound (does nothing).

Specified by:
awakeOnSup in interface RealListener
Throws:
ContradictionException

awakeOnRestoreInf

public void awakeOnRestoreInf(int idx)
                       throws ContradictionException
On lower bound restoration, launches the generic propagation.

Specified by:
awakeOnRestoreInf in interface PalmRealVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

awakeOnRestoreSup

public void awakeOnRestoreSup(int idx)
                       throws ContradictionException
On upper bound restoration, launches the generic propagation.

Specified by:
awakeOnRestoreSup in interface PalmRealVarListener
Parameters:
idx - Variable involved.
Throws:
ContradictionException

takeIntoAccountStatusChange

public void takeIntoAccountStatusChange(int index)
Description copied from interface: PalmConstraint
Informs constraints that one of their children has a modified status (due to value restoration).

Specified by:
takeIntoAccountStatusChange in interface PalmConstraint

isSatisfied

public boolean isSatisfied()
Checks if the constraint is satisfied (should be called when completely instantiated).

Specified by:
isSatisfied in interface Constraint

isConsistent

public boolean isConsistent()
Checks if the constraint is satisfied.

Specified by:
isConsistent in interface Propagator