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

Extensible ground representation of head aggregates. More...

#include <head_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

 AtomHdAggr (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) -> bool
 Check if the aggregate matches the guards.
 
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.
 

Detailed Description

Extensible ground representation of head aggregates.

Elements can be added to this representation and it can be enqueued for later propagation. Propagation adjust the stored bounds capturing an interval of possible values the aggregate can take.

Member Typedef Documentation

◆ Bound

using CppClingo::Ground::AtomHdAggr::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.

Member Function Documentation

◆ dequeue()

void CppClingo::Ground::AtomHdAggr::dequeue ( )

Dequeue the atom after propagation.

Also marks elements as propagated.

◆ propagate()

auto CppClingo::Ground::AtomHdAggr::propagate ( GuardVec const &  guards,
Symbol const *  vals 
) -> bool

Check if the aggregate matches the guards.

Only the relation of the given non-ground guards is accessed; the values for the terms are stored in the aggregate atom.


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