gtopt::SumPredicate struct

A predicate that filters a sum(...) aggregation (F4).

Evaluated against the metadata registry populated by each element's add_to_lp via SystemContext::register_ampl_element_metadata. Strings and numbers are both supported; In holds a set-of-literals in {a, b, c} form (values stored as strings for now).

Predicates are conjoined (AND) — disjunctions are deferred to v2.

Public types

enum class Op: std::uint8_t { Eq, Ne, Lt, Le, Gt, Ge, In }

Public variables

std::string attr
metadata key, e.g. "type", "bus", "cap"
std::optional<double> number_value
Op op
std::vector<std::string> set_values
std::optional<std::string> string_value

Enum documentation

enum class gtopt::SumPredicate::Op: std::uint8_t

Enumerators
Eq

= or ==

Ne

!= or <>

Lt

<

Le

<=

Gt

>

Ge

>=

In

in {...}

Variable documentation

std::optional<std::string> gtopt::SumPredicate::string_value

For scalar comparisons either string or number is set; for In the set holds the allowed string literals.