Implementing a Propagator¶
Class Paramita::Propagator¶
Interface for implementing external propagation.
A Propagator extends the behavior of a SAT solver by maintaining its own state alongside the solver state. The solver notifies the propagator of assignments and backtracking events, and the propagator may in turn:
- Propagate additional literals.
- Provide explanations (reason clauses) for propagated literals.
- Suggest branching decisions.
- Reject candidate models.
- Add external clauses to the solver.
Note:
Use EXTERNAL_PROPAGATOR_C_INTERFACE to register any subclass of this interface.
#include <Propagator.hpp>
Inherits the following classes: Paramita::Plugin
function on_assignment¶
Notifies the propagator of newly assigned literals.
The propagator should update its internal state to reflect the assignments.
Parameters:
litsThe literals assigned since the previous notification.
function on_new_decision_level¶
Notifies the propagator about a new decision level.
function on_backtrack¶
Notifies the propagator that the solver has backtracked.
The propagator should restore its internal state to match the given decision level.
Parameters:
new_levelThe decision level after backtracking.
function check_found_model¶
Checks whether a candidate model is acceptable.
The solver calls this method when it has found a model.
Parameters:
modelThe candidate model.
Returns:
true if the model is accepted, false otherwise.
function decide¶
Suggests the next branching literal.
Returning 0 indicates that the propagator does not provide a decision and the solver should use its own branching heuristic.
Returns:
The next decision literal, or 0 if none is suggested.
function get_reason_clause¶
Returns the reason clause for a propagated literal.
The returned clause must justify the propagation of propagated_lit.
Parameters:
propagated_litThe propagated literal.
Returns:
The reason clause.
function get_reason_clause¶
Returns the reason clause for a propagated literal.
The returned clause must justify the propagation of propagated_lit.
Parameters:
propagated_litThe propagated literal.
Returns:
The reason clause.
function has_external_clause¶
Indicates whether the propagator has an external clause to add.
Returns:
true if an external clause is available, false otherwise.
function get_external_clause¶
Returns an external clause to be added to the solver.
This method is called only if has_external_clause() returns true.
Returns:
The external clause.