ReservoirSeepageLP class
#include <gtopt/reservoir_seepage_lp.hpp>
LP wrapper for ReservoirSeepage systems.
Provides methods for LP formulation of seepage constraints while maintaining connections to waterways and reservoirs.
Per-stage slope/constant schedules are applied directly as LP matrix coefficients during add_to_lp() for each stage. When the ReservoirSeepage also has piecewise-linear segments, update_lp() is called by the SDDP solver (or monolithic solver between phases) to re-evaluate the seepage function at the current reservoir volume and override the constraint coefficients.
Base classes
-
template<typename ObjectType>class ObjectLP<ReservoirSeepage>
- Wrapper class that adds LP capabilities to objects.
Public types
- struct ReservoirSeepageState
- Tracks the volume columns and current LP state for coefficient updates.
- using Element = ReservoirSeepage
- using object_type = ReservoirSeepage
- Type of the wrapped object.
Public static variables
- static std::string_view SeepageName
Constructors, destructors, conversion operators
- ReservoirSeepageLP(const ReservoirSeepage& pseepage, InputContext& ic) explicit
Public functions
- auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- auto add_to_output(OutputContext& out) const -> bool
- auto class_name(this const Self& self) -> auto noexcept
- auto id() const -> auto noexcept
- auto is_active(const StageLP& stage) const -> bool
- Checks if object is active in given stage.
- auto object() & -> ReservoirSeepage& noexcept
- Gets the wrapped object.
- auto reservoir_sid() const -> auto noexcept
- auto seepage(this auto&& self) -> auto&& noexcept
- auto seepage_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- Get seepage variable columns for a scenario/stage combination.
- auto seepage_rows_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
- 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_lp(SystemLP& sys, const ScenarioLP& scenario, const StageLP& stage) -> int
- Update reservoir-dependent LP coefficients for this seepage.
- auto waterway_sid() const -> auto noexcept
Typedef documentation
using gtopt:: ReservoirSeepageLP:: Element = ReservoirSeepage
#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:: ReservoirSeepageLP:: object_type = ReservoirSeepage
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
gtopt:: ReservoirSeepageLP:: ReservoirSeepageLP(const ReservoirSeepage& pseepage,
InputContext& ic) explicit
Constructs a ReservoirSeepageLP from a ReservoirSeepage and input context. Initialises per-stage slope/constant schedules from the seepage object's slope and constant FieldSched fields.
auto gtopt:: ReservoirSeepageLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ReservoirSeepageLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: ReservoirSeepageLP:: 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 |
ReservoirSeepage& gtopt:: ReservoirSeepageLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
const auto& gtopt:: ReservoirSeepageLP:: seepage_cols_at(const ScenarioLP& scenario,
const StageLP& stage) const
Get seepage variable columns for a scenario/stage combination.
Returns the column indices for the seepage flow variables. These reference the waterway flow columns associated with this seepage.
const auto& gtopt:: ReservoirSeepageLP:: seepage_rows_at(const ScenarioLP& scenario,
const StageLP& stage) const
Public accessor for the per-block row indices. Mirrors seepage_cols_at; surfaced for diagnostic / unit-test access to the seepage constraint's row bounds (e.g. to confirm segment-driven RHS updates landed via update_lp).
auto& gtopt:: ReservoirSeepageLP:: 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:: ReservoirSeepageLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: ReservoirSeepageLP:: 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:: ReservoirSeepageLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: ReservoirSeepageLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|
int gtopt:: ReservoirSeepageLP:: update_lp(SystemLP& sys,
const ScenarioLP& scenario,
const StageLP& stage)
Update reservoir-dependent LP coefficients for this seepage.
| Returns | Number of LP coefficients/bounds modified (0 if unchanged) |
|---|
When the ReservoirSeepage has piecewise-linear segments, selects the active segment from the end-of-stage volume (vfin) — vfin is the SDDP cut anchor and the LP's free decision variable, so anchoring the segment choice to it keeps the linearised seepage curve consistent with the regime where the LP is operating. Updates:
- The coefficient on the efin column: -slope_i (efin-only form, so q_filt = constant_i + slope_i * efin → 0 when vfin = 0 in Tramo 1).
- The RHS (row bounds): intercept = constant_i - slope_i * volume_i
Only dispatches set_coeff/set_rhs calls when the new value differs from the previously stored value.