|
Clingo
|
Extensible ground representation of body aggregates. More...
#include <body_aggregate.hh>
Public Types | |
| using | Bound = std::variant< std::pair< Number, Number >, std::pair< Symbol, Symbol > > |
| The lower and upper bound for the value an aggregate can take. | |
Public Member Functions | |
| AtomBdAggr (AggregateFunction fun) | |
| Initialize for the given aggregate function. | |
| void | accumulate (AggregateFunction fun, SymbolSpan tup, bool fact) |
| Accumulate a tuple. | |
| auto | propagate (GuardVec const &guards, Symbol const *vals) -> std::pair< bool, bool > |
| Check if the aggregate matches the guards (first) and is a fact (second). | |
| auto | derived_idx () const -> size_t |
| Get the index of the aggregate. | |
| void | derived_idx (size_t idx) |
| Set the derived index of the aggregate. | |
| auto | state () const -> AtomBdAggrState |
| Get the derived state of the aggregate atom. | |
| void | state (AtomBdAggrState state) |
| Set the derived state of the aggregate atom. | |
| auto | enqueue () -> bool |
| Enqueue the atom for propagation. | |
| void | dequeue () |
| Dequeue the atom after propagation. | |
| void | add_elem (size_t idx) |
| Add a new element. | |
| auto | elems () const -> std::span< size_t const > |
| Get the aggregate elements. | |
| auto | todo () -> std::span< size_t const > |
| Get the aggregate elements to propagate. | |
| auto | uid () const -> std::optional< size_t > |
| Get the unique id of the aggregate. | |
| void | uid (size_t uid) |
| Set the unique id of the aggregate. | |
Extensible ground representation of body aggregates.
| using CppClingo::Ground::AtomBdAggr::Bound = std::variant<std::pair<Number, Number>, std::pair<Symbol, Symbol> > |
The lower and upper bound for the value an aggregate can take.
Aggregates operating on numbers do not use symbols to avoid storing unnecessary intermediate symbols.
| void CppClingo::Ground::AtomBdAggr::dequeue | ( | ) |
Dequeue the atom after propagation.
Also marks elements as propagated.
| auto CppClingo::Ground::AtomBdAggr::derived_idx | ( | ) | const -> size_t |
Get the index of the aggregate.
It must be derived first.
| void CppClingo::Ground::AtomBdAggr::derived_idx | ( | size_t | idx | ) |
Set the derived index of the aggregate.
It must be derived first.
| auto CppClingo::Ground::AtomBdAggr::propagate | ( | GuardVec const & | guards, |
| Symbol const * | vals | ||
| ) | -> std::pair< bool, bool > |
Check if the aggregate matches the guards (first) and is a fact (second).
Only the relation of the given non-ground guards is accessed; the values for the terms are stored in the aggregate atom.
| void CppClingo::Ground::AtomBdAggr::state | ( | AtomBdAggrState | state | ) |
Set the derived state of the aggregate atom.
It must only be derived once.