FlowLP class
#include <gtopt/flow_lp.hpp>
Base classes
-
template<typename ObjectType>class ObjectLP<Flow>
- Wrapper class that adds LP capabilities to objects.
Public types
- using Element = Flow
- using object_type = Flow
- Type of the wrapped object.
Public static variables
- static std::string_view ArBalanceName
- AR(1) recursion row name:
q_b − phi·lag = mu_b − phi·mu_ref. - static std::string_view FlowName
- static std::string_view InflowLagName
- Dependent lag column name (cross-phase incoming inflow state).
- static std::string_view InflowName
Constructors, destructors, conversion operators
- FlowLP(const Flow& pflow, const InputContext& ic) explicit
Public functions
- auto add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- auto add_to_output(OutputContext& out) const -> bool
- auto aperture_value(ScenarioUid scenario_uid, StageUid stage_uid, BlockUid block_uid) const -> std::optional<double>
- Return the discharge value for a given scenario/stage/block.
- auto class_name(this const Self& self) -> auto noexcept
- auto flow(this auto&& self) -> auto&& noexcept
- auto flow_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> auto&&
- auto has_ar_rows(ScenarioUid scenario_uid, StageUid stage_uid) const -> bool noexcept
- auto has_junction() const -> bool noexcept
- auto id() const -> auto noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto is_input() const -> bool noexcept
- auto junction_sid() const -> auto
- auto lookup_flow_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
- auto object() & -> Flow& noexcept
- Gets the wrapped object.
- auto set_id(Uid uid, Name name) -> auto& noexcept
- Sets the object's identifier.
- auto short_name(this const Self& self) -> auto noexcept
- auto sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) -> auto noexcept
- Generates a state variable key for the object.
- auto sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) -> auto noexcept
- auto uid() const -> auto noexcept
- auto update_aperture(LinearInterface& li, const ScenarioLP& base_scenario, const std::function<std::optional<double>(StageUid, BlockUid)>& value_fn, const StageLP& stage) const -> bool
- Update flow column bounds in a cloned LP for an aperture scenario.
Typedef documentation
using gtopt:: FlowLP:: Element = Flow
#include <gtopt/object_lp.hpp>
Alias for the wrapped data-struct type. Lets generic code reach the canonical LPClassName constant via T::Element::class_name where T is any LP wrapper inheriting from ObjectLP. Single source of truth for the class-name constant lives on the data struct (Bus::class_name, Reservoir::class_name, …); the LP wrappers no longer carry a duplicate ClassName member.
using gtopt:: FlowLP:: object_type = Flow
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
std::optional<double> gtopt:: FlowLP:: aperture_value(ScenarioUid scenario_uid,
StageUid stage_uid,
BlockUid block_uid) const
Return the discharge value for a given scenario/stage/block.
| Parameters | |
|---|---|
| scenario_uid | Scenario UID to look up |
| stage_uid | Stage UID to look up |
| block_uid | Block UID to look up |
| Returns | Optional discharge value if present |
auto gtopt:: FlowLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
bool gtopt:: FlowLP:: has_ar_rows(ScenarioUid scenario_uid,
StageUid stage_uid) const noexcept
True when this flow carries AR(1) recursion rows for the given (scenario, stage) — i.e. update_aperture rewrites the AR-row RHS (a ROW write) instead of pinning column bounds. Consumed by the dual-shared aperture row-touch gate (solve_apertures_for_phase): Lemma AP2's shared-intercept arithmetic prices column-bound deltas only, so an AR-mode flow must disable cut synthesis for the chunk (docs/formulation/sddp-cut-validity.md §6, "Implementation
guards").
auto gtopt:: FlowLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: FlowLP:: is_active(const StageLP& stage) const
#include <gtopt/object_lp.hpp>
Checks if object is active in given stage.
| Parameters | |
|---|---|
| stage | The stage to check |
| Returns | true if active in stage, false otherwise |
std::optional<ColIndex> gtopt:: FlowLP:: lookup_flow_col(const ScenarioLP& scenario,
const StageLP& stage,
BlockUid buid) const noexcept
Tolerant lookup over flow_cols — see lookup_inner (index_holder.hpp). Consumers (turbine_lp, etc.) use this to skip blocks where the producer elided the column, instead of throwing flat_map::at.
Flow& gtopt:: FlowLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
auto& gtopt:: FlowLP:: set_id(Uid uid,
Name name) noexcept
#include <gtopt/object_lp.hpp>
Sets the object's identifier.
| Parameters | |
|---|---|
| uid | Unique identifier |
| name | Human-readable name |
| Returns | Reference to self for chaining |
auto gtopt:: FlowLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: FlowLP:: sv_key(this const Self& self,
const ScenarioLP& scenario,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
Generates a state variable key for the object.
| Parameters | |
|---|---|
| self | Reference to the object |
| scenario | Scenario context |
| stage | Stage context |
| col_name | The column name for the state variable |
| Returns | StateVariable::Key |
auto gtopt:: FlowLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: FlowLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|
bool gtopt:: FlowLP:: update_aperture(LinearInterface& li,
const ScenarioLP& base_scenario,
const std::function<std::optional<double>(StageUid, BlockUid)>& value_fn,
const StageLP& stage) const
Update flow column bounds in a cloned LP for an aperture scenario.
| Parameters | |
|---|---|
| li | The cloned LinearInterface to modify (in-place). |
| base_scenario | The scenario used when the LP was originally built. |
| value_fn | (StageUid, BlockUid) -> optional<double> provider. |
| stage | The stage for which to update the bounds. |
| Returns | true on success. |
During the SDDP backward pass with apertures, the flow columns that were originally fixed to the base scenario's discharge values are updated to reflect the aperture scenario's discharge values. The value_fn callable provides the new discharge value for each (stage, block) pair.
Variable documentation
static std::string_view gtopt:: FlowLP:: InflowName
StateVariable column name for the outgoing (lagged) inflow state registered on the last block's flow column when Flow.inflow_model is set. Consumed by the next phase's dependent inflow_lag column via PendingStateLink — the exact efin → eini machinery. Static storage: referenced by StateVariable::Key::col_name (a string_view) for the solver lifetime.