choco.kernel.solver.propagation
Class Propagator

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
AbstractSConstraint

public abstract class Propagator
extends Object
implements EventListener

An interface for all implementations of listeners.


Field Summary
protected  IStateBool active
          a field for storing whether the constraint is active or not
protected  ConstraintEvent constAwakeEvent
          The constraint awake var attached to the constraint.
protected  int priority
          The priority of the constraint.
protected  PropagationEngine propagationEngine
           
 
Constructor Summary
protected Propagator()
           
protected Propagator(int priority)
           
 
Method Summary
 void activate(IEnvironment environment)
          Activate a constraint.
abstract  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 constAwake(boolean isInitialPropagation)
          Forces a propagation of the constraint.
 void fail()
          raise a contradiction during propagation when the constraint can definitely not be satisfied given the current domains
 PropagationEvent getEvent()
          Returns the constraint awake var associated with this constraint.
 int getFilteredEventMask(int idx)
           
 int getPriority()
          Propagation: Accessing the priority level of the queue handling the propagation of the constraint.
 boolean isActive()
          Checks if the constraint is active (e.g. plays a role in the propagation phase).
abstract  boolean isCompletelyInstantiated()
          Utility: Testing if all the variables involved in the constraint are instantiated.
abstract  boolean isConsistent()
          tests if the constraint is consistent with respect to the current state of domains
abstract  Boolean isEntailed()
          Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.
abstract  void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void setActive()
          Un-freezing a constraint (this is useful for mimicking dynamic constraint posts...).
 void setActiveSilently()
           
 void setEntailed()
          records that a constraint is now entailed (therefore it is now useless to propagate it again)
 void setPassive()
          Freezing a constraint (this is useful for backtracking when mimicking dynamic constraint posts...).
 void setPropagationEngine(PropagationEngine propEng)
          Define the propagation engine within the constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propagationEngine

protected PropagationEngine propagationEngine

active

protected IStateBool active
a field for storing whether the constraint is active or not


constAwakeEvent

protected final ConstraintEvent constAwakeEvent
The constraint awake var attached to the constraint.


priority

protected final int priority
The priority of the constraint.

Constructor Detail

Propagator

protected Propagator()

Propagator

protected Propagator(int priority)
Method Detail

addListener

public abstract void addListener(boolean dynamicAddition)
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

Parameters:
dynamicAddition -

isCompletelyInstantiated

public abstract boolean isCompletelyInstantiated()
Utility: Testing if all the variables involved in the constraint are instantiated.

Returns:
whether all the variables have been completely instantiated

constAwake

public final void constAwake(boolean isInitialPropagation)
Forces a propagation of the constraint.

Parameters:
isInitialPropagation - indicates if it is the initial propagation or not

awake

public void awake()
           throws ContradictionException
Propagation: Propagating the constraint for the very first time until local consistency is reached.

Throws:
ContradictionException - contradiction exception

propagate

public abstract void propagate()
                        throws ContradictionException
Propagation: Propagating the constraint until local consistency is reached.

Throws:
ContradictionException - contradiction exception

activate

public final void activate(IEnvironment environment)
Activate a constraint.

Parameters:
environment - current environment

setActive

public final void setActive()
Un-freezing a constraint (this is useful for mimicking dynamic constraint posts...).


setActiveSilently

public final void setActiveSilently()

setPassive

public final void setPassive()
Freezing a constraint (this is useful for backtracking when mimicking dynamic constraint posts...).


isActive

public final boolean isActive()
Checks if the constraint is active (e.g. plays a role in the propagation phase).

Returns:
true if the constraint is indeed currently active

setEntailed

public final void setEntailed()
records that a constraint is now entailed (therefore it is now useless to propagate it again)


getPriority

public final int getPriority()
Propagation: Accessing the priority level of the queue handling the propagation of the constraint. Results range from 1 (most reactive, for listeners with fast propagation algorithms) to 4 (most delayed, for listeners with lengthy propagation algorithms).

Returns:
the priority level of the queue handling the propagation of the constraint

getEvent

public final PropagationEvent getEvent()
Returns the constraint awake var associated with this constraint.

Returns:
the constraint awake var associated with this constraint.

isEntailed

public abstract Boolean isEntailed()
Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.

Returns:
wether the constraint is entailed

isConsistent

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

Returns:
wether the constraint is consistent

getFilteredEventMask

public int getFilteredEventMask(int idx)

setPropagationEngine

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

Parameters:
propEng - the current propagation engine

fail

public void fail()
          throws ContradictionException
raise a contradiction during propagation when the constraint can definitely not be satisfied given the current domains

Throws:
ContradictionException - contradiction exception


Copyright © 2012. All Rights Reserved.