Class PropagationEngine

  • public class PropagationEngine
    extends Object
    This engine is priority-driven constraint-oriented seven queues engine.
    On a call to onVariableUpdate, it stores the event generated and schedules the propagator in one of the 7 queues wrt to its priority for future revision.

    Charles Prud'homme
    • Field Detail


        public static boolean CHECK_SCOPE
    • Constructor Detail

      • PropagationEngine

        public PropagationEngine​(Model model)
        A seven-queue propagation engine. Each of the seven queues deals with on priority. When a propagator needs to be executed, it is scheduled in the queue corresponding to its priority. The lowest priority queue is emptied before one element of the second lowest queue is popped, etc.
        model - the declaring model
    • Method Detail

      • initialize

        public void initialize()
                        throws SolverException
        Build up internal structure, if not yet done, in order to allow propagation. If new constraints are added after having initializing the engine, dynamic addition is used. A call to clear erase the internal structure, and allow new initialisation.
        SolverException - if a constraint is declared more than once in this propagation engine
      • isInitialized

        public boolean isInitialized()
        Is the engine initialized? Important for dynamic addition of constraints
        true if the engine has been initialized
      • execute

        public void execute​(Propagator propagator)
                     throws ContradictionException
        Execute 'coarse' propagation on a newly added propagator or one that should be propagated on backtrack
        propagator - a propagator to propagate
        ContradictionException - if propagation fails
      • flush

        public void flush()
        Flush this, ie. remove every pending events
      • onVariableUpdate

        public void onVariableUpdate​(Variable variable,
                                     IEventType type,
                                     ICause cause)
        Take into account the modification of a variable
        variable - modified variable
        type - type of modification event
        cause - origin of the modification
      • schedule

        public void schedule​(Propagator prop,
                             int pindice,
                             int mask)
      • delayedPropagation

        public void delayedPropagation​(Propagator propagator,
                                       PropagatorEventType type)
        Exeucte a delayed propagator
        propagator - propagator to execute
        type - type of event to execute
      • onPropagatorExecution

        public void onPropagatorExecution​(Propagator propagator)
        Action to do when a propagator is executed
        propagator - propagator to execute
      • desactivatePropagator

        public void desactivatePropagator​(Propagator propagator)
        Set the propagator as inactivated within the propagation engine
        propagator - propagator to desactivate
      • reset

        public void reset()
        Reset the propagation engine.
      • clear

        public void clear()
        Clear internal structures
      • ignoreModifications

        public void ignoreModifications()
      • dynamicAddition

        public void dynamicAddition​(boolean permanent,
                                    Propagator... ps)
                             throws SolverException
        Add a constraint to the propagation engine
        permanent - does the constraint is permanently added
        ps - propagators to add * @throws SolverException if a constraint is declared more than once in this propagation engine
      • updateInvolvedVariables

        public void updateInvolvedVariables​(Propagator p)
        Update the scope of variable of a propagator (addition or deletion are allowed -- p.vars are scanned)
        p - a propagator
      • propagateOnBacktrack

        public void propagateOnBacktrack​(Propagator propagator)
        Update the scope of variable of a propagator (addition or deletion are allowed -- p.vars are scanned)
        propagator - a propagator
      • dynamicDeletion

        public void dynamicDeletion​(Propagator... ps)
        Delete the list of propagators in input from the engine
        ps - a list of propagators