Object to initialize a user-defined propagator before each solving step.
More...
#include <propagate.hh>
Object to initialize a user-defined propagator before each solving step.
Each symbolic or theory atom is uniquely associated with an aspif atom in form of a positive integer (Clingo::ProgramLiteral). Aspif literals additionally are signed to represent default negation. Furthermore, there are non-zero integer solver literals (SolverLiteral). There is a surjective mapping from program atoms to solver literals.
All methods called during propagation use solver literals whereas Clingo::Atom::literal() and Clingo::TheoryAtom::literal() return program literals. The function Clingo::PropagateInit::solver_literal() can be used to map program literals or condition ids to solver literals.
◆ PropagateInit()
Constructor from the underlying C representation.
- Parameters
-
init | the C representation of the initialization object |
◆ add_clause() [1/2]
Add a clause to the solver.
If the clause could not be added to the solver, there is a top-level conflict and the underlying problem is unsatisfiable. The function returns false in this case.
- Parameters
-
literals | the literals of the clause to add |
- Returns
- whether the clause was added without conflict
◆ add_clause() [2/2]
Add a clause to the solver.
If the clause could not be added to the solver, there is a top-level conflict and the underlying problem is unsatisfiable. The function returns false in this case.
- Parameters
-
literals | the literals of the clause to add |
- Returns
- whether the clause was added without conflict
◆ add_literal()
Add a literal to the solver.
The literal can be frozen to exempt it from being eliminated during preprocessing.
- Parameters
-
freeze | whether to freeze the literal |
- Returns
- the added literal
◆ add_minimize()
Add a weighted literal to minimize to the solver.
- Parameters
-
literal | the literal to minimize |
weight | the weight of the literal |
priority | the priority of the literal |
◆ add_watch()
Add a watch for the given solver literal.
The Clingo::Propagator::propagate() is called whenever the watched literal is assigned a truth value.
Literals can be added to the given thread or all threads if no thread id is given.
- Parameters
-
literal | the literal to watch |
thread_id | the id of the thread to add the watch to |
◆ add_weight_constraint()
Add a weight constraint to the solver.
- Parameters
-
literal | the literal associated with the constraint |
literals | the weighted literals of the constraint |
bound | the bound of the constraint |
type | the type of the weight constraint |
compare_equal | if true compare equal instead of less than equal |
- Returns
- whether the constraint was added without conflict
◆ assignment()
Get the assignment of the current solver.
- Returns
- the assignment of the current solver
◆ base()
auto Clingo::PropagateInit::base |
( |
| ) |
const -> Base |
|
inline |
Get the base object associated with the propagator.
- Returns
- the base object associated with the propagator
◆ check_mode() [1/2]
Get the check mode of the propagator.
- Returns
- the check mode of the propagator
◆ check_mode() [2/2]
Set the check mode of the propagator.
- Parameters
-
mode | the new check mode of the propagator |
◆ freeze_literal()
Freeze the given literal in the solver.
Frozen literals are not eliminated during preprocessing.
- Parameters
-
literal | the literal to freeze |
◆ library()
auto Clingo::PropagateInit::library |
( |
| ) |
const -> Library |
|
inline |
Get the library object associated with the propagator.
- Returns
- the library object associated with the propagator
◆ number_of_threads()
auto Clingo::PropagateInit::number_of_threads |
( |
| ) |
const -> ProgramId |
|
inline |
Get the number of threads used in subsequent solving.
- Returns
- the number of threads used in subsequent solving
◆ propagate()
auto Clingo::PropagateInit::propagate |
( |
| ) |
const -> bool |
|
inline |
Propagate consequences of the underlying problem.
This function can be called to propagte consequences of previously added clauses and weight constraints.
- Returns
- whether propagation succeeded without conflict
◆ remove_watch()
Remove a watch for the given solver literal.
If no thread id is given, the watch is removed from all threads.
- Parameters
-
literal | the literal to remove the watch for |
thread_id | the id of the thread to remove the watch from |
◆ solver_literal()
Map a program literal to a solver literal.
- Parameters
-
literal | the program literal to map |
- Returns
- the corresponding solver literal
◆ undo_mode() [1/2]
Get the undo mode of the propagator.
- Returns
- the undo mode of the propagator
◆ undo_mode() [2/2]
Set the undo mode of the propagator.
- Parameters
-
mode | the new undo mode of the propagator |
The documentation for this class was generated from the following file: