ElementRef struct
#include <gtopt/constraint_expr.hpp>
Reference to a gtopt element and one of its LP attributes.
Examples:
- generator("TORO").generation → {element_type="generator", element_id="TORO", attribute="generation"}
- demand("uid:5").load → {element_type="demand", element_id="uid:5", attribute="load"}
Public variables
- std::string attribute
- LP attribute: "generation", "load", etc.
- std::string element_id
- name or "uid:N" reference
- std::string element_type
- "generator", "demand", "line", etc.
- bool prev_wrapped
- bool state_wrapped
Variable documentation
bool gtopt:: ElementRef:: prev_wrapped
True when the user wrote prev(<element_ref>) — a lagged reference to the variable's value in the PREVIOUS block within the stage. At the first block of a stage the lag resolves to the cross-phase INCOMING column (a block_state DecisionVariable's value_in), i.e. the previous phase's end-of-phase value pinned by the SDDP forward pass. This is what lets a user constraint express a per-block storage balance vol[b] = prev(vol) + inflow - release.
bool gtopt:: ElementRef:: state_wrapped
True when the user wrote state(<element_ref>) (Phase 1e). In Phase 1 the resolver treats wrapped and unwrapped refs identically; Phase 2 will require this flag to be set whenever the resolved column has AmplVariableKind::StateBacked.