public class TwoBucketPropagationEngine extends Object implements IPropagationEngine
Then, managing coarse events (that is, delayed calls to `propagate(int)') is made thanks to 4 additional queues: UNARY, BINARY, TERNARY propagators cannot be delayed! LINEAR propagators are in the top-priority queue, QUADRATIC propagators are in the second-priority queue, CUBIC propagators are in the second-priority queue, VERY_SLOW propagators are in the second-priority queue.
The engine empties the first queue, then propagates one event from the following one, and check the first queue again, etc.
IPropagationEngine.Trace
Constructor and Description |
---|
TwoBucketPropagationEngine(Model model)
Creates a two-bucket propagation engine.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear internal structures
|
void |
delayedPropagation(Propagator propagator,
PropagatorEventType type)
Exeucte a delayed propagator
|
void |
desactivatePropagator(Propagator propagator)
Set the propagator as inactivated within the propagation engine
|
void |
dynamicAddition(boolean permanent,
Propagator... ps)
Add a constraint to the propagation engine
|
void |
dynamicDeletion(Propagator... ps)
Delete the list of propagators in input from the engine
|
void |
flush()
Flush
this , ie. remove every pending events |
void |
initialize()
Build up internal structure, if not yet done, in order to allow propagation.
|
boolean |
isInitialized()
Is the engine initialized?
|
void |
onPropagatorExecution(Propagator propagator)
Action to do when a propagator is executed
|
void |
onVariableUpdate(Variable variable,
IEventType type,
ICause cause)
Take into account the modification of a variable
|
void |
propagate()
Launch the proapagation, ie, active propagators if necessary, then reach a fix point
|
void |
propagateOnBacktrack(Propagator p)
State that the propagator needs to be propagated (coarse event) on backtrack.
|
void |
reset()
Reset the propagation engine.
|
void |
updateInvolvedVariables(Propagator p)
Update the scope of variable of a propagator (addition or deletion are allowed -- p.vars are scanned)
|
public TwoBucketPropagationEngine(Model model)
model
- the declaring model.public void initialize() throws SolverException
IPropagationEngine
initialize
in interface IPropagationEngine
SolverException
- if a constraint is declared more than once in this propagation enginepublic boolean isInitialized()
IPropagationEngine
isInitialized
in interface IPropagationEngine
public void propagate() throws ContradictionException
IPropagationEngine
propagate
in interface IPropagationEngine
ContradictionException
- if a contradiction occurrspublic void flush()
IPropagationEngine
this
, ie. remove every pending eventsflush
in interface IPropagationEngine
public void onVariableUpdate(Variable variable, IEventType type, ICause cause)
IPropagationEngine
onVariableUpdate
in interface IPropagationEngine
variable
- modified variabletype
- type of modification eventcause
- origin of the modificationpublic void delayedPropagation(Propagator propagator, PropagatorEventType type) throws ContradictionException
IPropagationEngine
delayedPropagation
in interface IPropagationEngine
propagator
- propagator to executetype
- type of event to executeContradictionException
- if a failure is encounteredpublic void onPropagatorExecution(Propagator propagator)
IPropagationEngine
onPropagatorExecution
in interface IPropagationEngine
propagator
- propagator to executepublic void desactivatePropagator(Propagator propagator)
IPropagationEngine
desactivatePropagator
in interface IPropagationEngine
propagator
- propagator to desactivatepublic void reset()
IPropagationEngine
reset
in interface IPropagationEngine
public void clear()
IPropagationEngine
clear
in interface IPropagationEngine
public void dynamicAddition(boolean permanent, Propagator... ps) throws SolverException
IPropagationEngine
dynamicAddition
in interface IPropagationEngine
permanent
- does the constraint is permanently addedps
- propagators to add
* @throws SolverException if a constraint is declared more than once in this propagation engineSolverException
public void updateInvolvedVariables(Propagator p)
IPropagationEngine
updateInvolvedVariables
in interface IPropagationEngine
p
- a propagatorpublic void propagateOnBacktrack(Propagator p)
IPropagationEngine
propagateOnBacktrack
in interface IPropagationEngine
p
- a propagatorpublic void dynamicDeletion(Propagator... ps)
IPropagationEngine
dynamicDeletion
in interface IPropagationEngine
ps
- a list of propagatorsCopyright © 2017. All rights reserved.