gtopt::ReservoirSeepageLP class

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 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 object_type = ReservoirSeepage
Type of the wrapped object.

Public static variables

static constexpr LPClassName ClassName

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) -> constexpr auto noexcept
auto id() const -> constexpr auto noexcept
auto is_active(const StageLP& stage) const -> constexpr bool
Checks if object is active in given stage.
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto lp_label(this const Self& self, SystemContext& sc, const StageLP& stage, Args && ... args) -> constexpr auto
auto object() && -> constexpr ReservoirSeepage&& noexcept
auto object() & -> constexpr ReservoirSeepage& noexcept
Gets the wrapped object.
auto object() const && -> constexpr const ReservoirSeepage&& noexcept
auto object() const & -> constexpr const ReservoirSeepage& noexcept
auto reservoir_sid() const -> constexpr auto noexcept
auto seepage(this auto&& self) -> constexpr 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 set_id(Uid uid, Name name) -> constexpr auto& noexcept
Sets the object's identifier.
auto short_name(this const Self& self) -> constexpr auto noexcept
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args) -> constexpr auto
Generates a label for a variable in the optimization problem.
template<typename Self Self, typename SystemContext SystemContext, typename... Args>
auto state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args) -> constexpr auto
template<typename Self Self, typename ScenarioLP ScenarioLP, typename StageLP StageLP>
auto sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) -> constexpr auto noexcept
Generates a state variable key for the object.
template<typename Self Self, typename StageLP StageLP>
auto sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) -> constexpr auto noexcept
auto uid() const -> constexpr 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 -> constexpr auto noexcept

Typedef documentation

using gtopt::ReservoirSeepageLP::object_type = ReservoirSeepage

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.

constexpr auto gtopt::ReservoirSeepageLP::class_name(this const Self& self) noexcept

constexpr auto gtopt::ReservoirSeepageLP::id() const noexcept

Returns The object's complete identifier (uid + name)

constexpr bool gtopt::ReservoirSeepageLP::is_active(const StageLP& stage) const

Checks if object is active in given stage.

Parameters
stage The stage to check
Returns true if active in stage, false otherwise

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::lp_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::lp_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::lp_label(this const Self& self, SystemContext& sc, const StageLP& stage, Args && ... args)

constexpr ReservoirSeepage&& gtopt::ReservoirSeepageLP::object() && noexcept

constexpr ReservoirSeepage& gtopt::ReservoirSeepageLP::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

constexpr const ReservoirSeepage&& gtopt::ReservoirSeepageLP::object() const && noexcept

constexpr const ReservoirSeepage& gtopt::ReservoirSeepageLP::object() const & noexcept

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.

constexpr auto& gtopt::ReservoirSeepageLP::set_id(Uid uid, Name name) noexcept

Sets the object's identifier.

Parameters
uid Unique identifier
name Human-readable name
Returns Reference to self for chaining

constexpr auto gtopt::ReservoirSeepageLP::short_name(this const Self& self) noexcept

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, Args && ... args)

Generates a label for a variable in the optimization problem.

Parameters
self Reference to the object
sc System context
scenario Scenario context
stage Stage context
args Additional arguments to include in the label
Returns Label string

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirSeepageLP::state_col_label(this const Self& self, SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, const BlockLP& block, Args && ... args)

template<typename Self Self, typename ScenarioLP ScenarioLP, typename StageLP StageLP>
constexpr auto gtopt::ReservoirSeepageLP::sv_key(this const Self& self, const ScenarioLP& scenario, const StageLP& stage, std::string_view col_name) noexcept

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

template<typename Self Self, typename StageLP StageLP>
constexpr auto gtopt::ReservoirSeepageLP::sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) noexcept

constexpr auto gtopt::ReservoirSeepageLP::uid() const noexcept

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 based on the reservoir's current volume (vini from previous phase) and updates:

  • The coefficient on eini/efin columns: -slope * 0.5
  • 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.