clingo
|
Base class for post propagators. More...
#include <constraint.h>
Public Types | |
enum | Priority { priority_class_simple = 0, priority_reserved_msg = 0, priority_reserved_ufs = 10, priority_reserved_look = 1023, priority_class_general = 1024 } |
Default priorities for post propagators. More... | |
Public Member Functions | |
PostPropagator () | |
virtual | ~PostPropagator () |
virtual uint32 | priority () const =0 |
Shall return a value representing the priority of this propagator. More... | |
virtual bool | init (Solver &s) |
Called during initialization of s. More... | |
virtual bool | propagateFixpoint (Solver &s, PostPropagator *ctx)=0 |
Shall enqueue and propagate new assignments implied by this propagator. More... | |
virtual void | reset () |
Aborts an active propagation operation. More... | |
virtual bool | isModel (Solver &s) |
Is the current total assignment a model? More... | |
Public Member Functions inherited from Clasp::Constraint | |
Constraint () | |
virtual void | destroy (Solver *s=0, bool detach=false) |
Default is to call delete this. More... | |
virtual ConstraintType | type () const |
Returns the type of this constraint. More... | |
virtual bool | minimize (Solver &s, Literal p, CCMinRecursive *rec) |
virtual void | undoLevel (Solver &s) |
Called when the solver undid a decision level watched by this constraint. More... | |
virtual bool | simplify (Solver &s, bool reinit=false) |
virtual uint32 | estimateComplexity (const Solver &s) const |
Returns an estimate of the constraint's complexity relative to a clause (complexity = 1). More... | |
virtual ClauseHead * | clause () |
Shall return this if constraint is a clause, otherwise 0. More... | |
virtual bool | valid (Solver &s) |
Shall return whether the constraint is valid (i.e. not conflicting) w.r.t the current assignment in s. More... | |
Public Attributes | |
PostPropagator * | next |
Protected Member Functions | |
Constraint * | cloneAttach (Solver &) |
PostPropagators are not clonable by default. More... | |
PropResult | propagate (Solver &, Literal, uint32 &) |
void | reason (Solver &, Literal, LitVec &) |
Protected Member Functions inherited from Clasp::Constraint | |
virtual | ~Constraint () |
Base class for post propagators.
Post propagators are called during propagation on each decision level and once after a total assignment is found.
They may extend a solver's unit-propagation with more elaborate propagation mechanisms. The typical asp example is an unfounded set check.
Default priorities for post propagators.
Clasp::PostPropagator::PostPropagator | ( | ) |
|
virtual |
|
inlineprotectedvirtual |
PostPropagators are not clonable by default.
Implements Clasp::Constraint.
|
virtual |
Called during initialization of s.
Reimplemented in Clasp::Lookahead, and Clasp::DefaultUnfoundedCheck.
|
virtual |
Is the current total assignment a model?
Reimplemented in Clasp::DefaultUnfoundedCheck.
|
pure virtual |
Shall return a value representing the priority of this propagator.
The priority is used to order sequences of post propagators and to classify post propagators w.r.t the classes: class_simple and class_general.
Implemented in Clasp::MessageHandler, Clasp::Lookahead, and Clasp::DefaultUnfoundedCheck.
|
protectedvirtual |
Propagate is called for each constraint that watches p. It shall enqueue all consequences of p becoming true.
s | The solver in which p became true. |
p | A literal watched by this constraint that recently became true. |
data | The data-blob that this constraint passed when the watch for p was registered. |
Implements Clasp::Constraint.
|
pure virtual |
Shall enqueue and propagate new assignments implied by this propagator.
This function shall enqueue and propagate all assignments currently implied by this propagator until a fixpoint is reached w.r.t this post propagator or a conflict is detected.
s | The solver in which this post propagator is used. |
ctx | The post propagator from which this post propagator is called or 0 if no other post propagator is currently active. |
Typically, propagateFixpoint() should implemet a loop like this:
Implemented in Clasp::MessageHandler, Clasp::SequentialSolve::InterruptHandler, Clasp::Lookahead, and Clasp::DefaultUnfoundedCheck.
Implements Clasp::Constraint.
|
virtual |
Aborts an active propagation operation.
The function reset() is called whenever propagation on the current decision level is stopped before a fixpoint is reached. In particular, a solver calls reset() when a conflict is detected during propagation.
Reimplemented in Clasp::DefaultUnfoundedCheck.
PostPropagator* Clasp::PostPropagator::next |