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
Modifier and Type | Field and Description |
---|---|
protected IEnvironment |
environment |
protected PropagatorEventType[] |
event_c |
protected IntCircularQueue[] |
event_f |
protected int[][] |
eventmasks |
protected ContradictionException |
exception |
protected Propagator |
lastProp |
protected int |
notEmpty |
protected IId2AbId |
p2i |
protected ArrayDeque<Propagator>[] |
pro_queue_c |
protected ArrayDeque<Propagator>[] |
pro_queue_f |
protected Propagator[] |
propagators |
protected boolean[] |
schedule_c |
protected boolean[] |
schedule_f |
protected Solver |
solver |
Constructor and Description |
---|
TwoBucketPropagationEngine(Solver solver) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
delayedPropagation(Propagator propagator,
PropagatorEventType type) |
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 |
fails(ICause cause,
Variable variable,
String message) |
void |
flush()
Flush
this , ie. remove every pending events |
ContradictionException |
getContradictionException() |
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) |
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 |
updateInvolvedVariables(Propagator p)
Update the scope of variable of a propagator (addition or deletion are allowed -- p.vars are scanned)
|
protected final Solver solver
protected final ContradictionException exception
protected final IEnvironment environment
protected Propagator[] propagators
protected IId2AbId p2i
protected Propagator lastProp
protected int notEmpty
protected ArrayDeque<Propagator>[] pro_queue_f
protected boolean[] schedule_f
protected IntCircularQueue[] event_f
protected int[][] eventmasks
protected ArrayDeque<Propagator>[] pro_queue_c
protected boolean[] schedule_c
protected PropagatorEventType[] event_c
public TwoBucketPropagationEngine(Solver solver)
public void initialize()
IPropagationEngine
initialize
in interface IPropagationEngine
public void fails(ICause cause, Variable variable, String message) throws ContradictionException
fails
in interface IPropagationEngine
ContradictionException
public ContradictionException getContradictionException()
getContradictionException
in interface IPropagationEngine
public 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) throws ContradictionException
IPropagationEngine
onVariableUpdate
in interface IPropagationEngine
variable
- modified variabletype
- type of modification eventContradictionException
public void delayedPropagation(Propagator propagator, PropagatorEventType type) throws ContradictionException
delayedPropagation
in interface IPropagationEngine
ContradictionException
public void onPropagatorExecution(Propagator propagator)
onPropagatorExecution
in interface IPropagationEngine
public void desactivatePropagator(Propagator propagator)
IPropagationEngine
desactivatePropagator
in interface IPropagationEngine
propagator
- propagator to desactivatepublic void clear()
clear
in interface IPropagationEngine
public void dynamicAddition(boolean permanent, Propagator... ps)
IPropagationEngine
dynamicAddition
in interface IPropagationEngine
permanent
- does the constraint is permanently addedps
- propagators to addpublic 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 © 2015. All rights reserved.