Clingo
Loading...
Searching...
No Matches
CppClingo::Ground::StateBdAggr Class Reference

State storing all necessary information to ground body aggregates. More...

#include <body_aggregate.hh>

Inheritance diagram for CppClingo::Ground::StateBdAggr:
CppClingo::Ground::State

Classes

class  ElementKey
 Keys for aggregate elements storing their tuple and their aggregate index. More...
 

Public Types

using AtomMap = BaseBdAggr::AtomMap
 A map from global variables (including the guards) to the aggregate representation.
 
using ElementMap = Util::ordered_map< ElementKey *, Util::small_vector< size_t > >
 A map from tuples to their conditions.
 

Public Member Functions

 StateBdAggr (std::pmr::monotonic_buffer_resource &mbr, VariableVec global, GuardVec guards, AggregateFunction fun, size_t index, bool domain, bool monotone, bool single_pass_elems)
 Initialize an aggregate state.
 
auto global () const -> VariableVec const &
 Get the global variables in the aggregate.
 
auto symbols () -> SymbolVec &
 Get a buffer to store values for global variables.
 
auto guards () const -> GuardVec const &
 Get the non-ground guards of the aggregate.
 
auto fun () const -> AggregateFunction
 Get the aggregate function.
 
auto domain () const -> bool
 Indicates that all aggregate elements are domain.
 
auto monotone () const -> bool
 Indicates that the aggregate is monotone.
 
auto single_pass_elems () const -> bool
 Indicates that all necessary elements can be grounded in a single pass.
 
auto index () const -> size_t
 Get the update index.
 
auto propagate () -> bool
 Propagate enqueued aggregates.
 
auto insert_atom (EvalContext const &ctx) -> std::optional< std::pair< AtomMap::iterator, bool > >
 Insert an aggregate atom (stemming from an aggregate element).
 
auto insert_atom (Symbol const *tuple) -> AtomMap::iterator
 Insert a previously evaluated atom.
 
void insert_elem (EvalContext const &ctx, AtomMap::iterator it, StmBdAggrElem &elem)
 Insert an aggregate element.
 
void print (std::ostream &out, bool print_index)
 Print a non-ground representation of the aggregate.
 
auto base () -> BaseBdAggr &
 Get the underlying atom base.
 
void output (Logger &log, SymbolStore &store, OutputStm &out) override
 Output all previously output aggregates.
 
- Public Member Functions inherited from CppClingo::Ground::State
virtual ~State ()=default
 Destructor.
 

Detailed Description

State storing all necessary information to ground body aggregates.

Member Typedef Documentation

◆ ElementMap

A map from tuples to their conditions.

Each value in the map represents an aggregate element. The vector of condition ids is kept sorted and unique. A small vector is used because it should commonly have sizes of zero (a fact) or one (a single conditions).

Member Function Documentation

◆ domain()

auto CppClingo::Ground::StateBdAggr::domain ( ) const -> bool

Indicates that all aggregate elements are domain.

That is, all the bases of literals in conditions are domain and all negative literals are stratified.

Only considers the elements of the aggregate.

◆ insert_atom() [1/2]

auto CppClingo::Ground::StateBdAggr::insert_atom ( EvalContext const &  ctx) -> std::optional< std::pair< AtomMap::iterator, bool > >

Insert an aggregate atom (stemming from an aggregate element).

This function also enqueues freshly inserted atoms to cover the case that the aggregate matches the empty element set.

◆ insert_atom() [2/2]

auto CppClingo::Ground::StateBdAggr::insert_atom ( Symbol const *  tuple) -> AtomMap::iterator

Insert a previously evaluated atom.

This functions can be used to ensure the presence of an atom that has not yet been derived.

◆ monotone()

auto CppClingo::Ground::StateBdAggr::monotone ( ) const -> bool

Indicates that the aggregate is monotone.

Neither takes the sign of the aggregate nor its elements into account.

◆ output()

void CppClingo::Ground::StateBdAggr::output ( Logger log,
SymbolStore store,
OutputStm out 
)
overridevirtual

Output all previously output aggregates.

Implements CppClingo::Ground::State.

◆ single_pass_elems()

auto CppClingo::Ground::StateBdAggr::single_pass_elems ( ) const -> bool

Indicates that all necessary elements can be grounded in a single pass.

This does not take into account the body prefix of elements.


The documentation for this class was generated from the following file: