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

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

#include <head_aggregate.hh>

Inheritance diagram for CppClingo::Ground::StateHdAggr:
CppClingo::Ground::State

Classes

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

Public Types

using AtomMap = BaseHdAggr::AtomMap
 A map from global variables (including the guards) to the aggregate representation.
 
using ElementMap = Util::ordered_map< ElementKey *, Util::small_vector< std::tuple< Symbol, size_t, size_t >, 1 > >
 A map from tuples to their head atoms and conditions.
 

Public Member Functions

 StateHdAggr (std::pmr::monotonic_buffer_resource &mbr, BaseVec bases, VariableVec global, GuardVec guards, AggregateFunction fun, size_t index, bool single_pass_body)
 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 single_pass_body () const -> bool
 Indicates that all necessary elements can be grounded in a single pass.
 
auto index () const -> size_t
 Get the update index for the aggregate.
 
auto indices () const -> std::vector< size_t >
 Get the update indices for the heads of the elements.
 
void enqueue (Queue &queue)
 Enqueue aggregate element rules.
 
void propagate (OutputStm &out, Queue &queue)
 Propagate enqueued aggregates.
 
auto insert_atom (EvalContext const &ctx) -> std::optional< std::pair< AtomMap::iterator, bool > >
 Insert an aggregate atom.
 
void insert_elem (EvalContext const &ctx, AtomMap::iterator it, StmHdAggrElem &elem)
 Insert an aggregate element.
 
void print (std::ostream &out, bool print_index)
 Print a non-ground representation of the aggregate.
 
void output (Logger &log, SymbolStore &store, OutputStm &out) override
 Output all previously output aggregates.
 
auto base () -> BaseHdAggr &
 Return the base of the aggregate.
 
- Public Member Functions inherited from CppClingo::Ground::State
virtual ~State ()=default
 Destructor.
 

Detailed Description

State storing all necessary information to ground head aggregates.

Member Typedef Documentation

◆ ElementMap

A map from tuples to their head atoms and conditions.

Head atoms must be either true or symbolic atoms. We use #sup to represent true. Whether an element is fact is stored in the key.

Member Function Documentation

◆ indices()

auto CppClingo::Ground::StateHdAggr::indices ( ) const -> std::vector< size_t >

Get the update indices for the heads of the elements.

Unoptimized and intended for debug printing.

◆ output()

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

Output all previously output aggregates.

Implements CppClingo::Ground::State.


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