gtopt::ReservoirProductionFactorLP class

LP representation of a ReservoirProductionFactor element.

Stores per-(scenario,stage,block) row/column indices for the turbine conversion-rate constraint so that the coefficient can be updated when the reservoir volume changes during SDDP iterations.

Base classes

template<typename ObjectType ObjectType>
class ObjectLP<ReservoirProductionFactor>
Wrapper class that adds LP capabilities to objects.

Public types

struct CoeffIndex
Per-block conversion row and flow column indices for coefficient updates.
using BCoeffMap = flat_map<BlockUid, CoeffIndex>
using object_type = ReservoirProductionFactor
Type of the wrapped object.

Public static variables

static constexpr LPClassName ClassName

Public static functions

static auto add_to_output(OutputContext& out) -> bool

Constructors, destructors, conversion operators

ReservoirProductionFactorLP(const ReservoirProductionFactor& pre, InputContext& ic) explicit noexcept

Public functions

auto add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
Register this production factor element in the LP.
auto class_name(this const Self& self) -> constexpr auto noexcept
auto coeff_indices_at(ScenarioUid suid, StageUid tuid) const -> const BCoeffMap & -> auto
Access stored coefficient indices for a given (scenario, stage)
auto compute_production_factor(Real volume) const noexcept -> Real -> auto
Evaluate the piecewise-linear efficiency at the given volume.
auto has_coeff_indices(ScenarioUid suid, StageUid tuid) const -> bool -> auto
Check if coefficient indices are available for a given (scenario, stage)
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 mean_production_factor() const noexcept -> Real -> constexpr auto
Return the mean (fallback) efficiency value.
auto object() && -> constexpr ReservoirProductionFactor&& noexcept
auto object() & -> constexpr ReservoirProductionFactor& noexcept
Gets the wrapped object.
auto object() const && -> constexpr const ReservoirProductionFactor&& noexcept
auto object() const & -> constexpr const ReservoirProductionFactor& noexcept
auto production_factor(this auto&& self) -> constexpr auto&& noexcept
auto reservoir_sid() const -> constexpr auto noexcept
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 turbine_sid() const -> constexpr auto noexcept
auto uid() const -> constexpr auto noexcept
auto update_conversion_coeff(LinearInterface& li, ScenarioUid suid, StageUid tuid, Real volume) const -> int -> auto
Update the conversion-rate LP coefficient for a given volume.
auto update_lp(SystemLP& sys, const ScenarioLP& scenario, const StageLP& stage) const -> int
Update the conversion-rate LP coefficient based on reservoir volume.

Typedef documentation

using gtopt::ReservoirProductionFactorLP::object_type = ReservoirProductionFactor

Type of the wrapped object.

Function documentation

bool gtopt::ReservoirProductionFactorLP::add_to_lp(const SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp)

Register this production factor element in the LP.

Locates the turbine's conversion rows and the waterway's flow columns, stores their indices for later coefficient updates. The initial conversion-rate coefficient is set during TurbineLP::add_to_lp().

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

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

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

constexpr bool gtopt::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::lp_label(this const Self& self, SystemContext& sc, const StageLP& stage, Args && ... args)

constexpr ReservoirProductionFactor&& gtopt::ReservoirProductionFactorLP::object() && noexcept

constexpr ReservoirProductionFactor& gtopt::ReservoirProductionFactorLP::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

constexpr const ReservoirProductionFactor&& gtopt::ReservoirProductionFactorLP::object() const && noexcept

constexpr const ReservoirProductionFactor& gtopt::ReservoirProductionFactorLP::object() const & noexcept

constexpr auto& gtopt::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::short_name(this const Self& self) noexcept

template<typename Self Self, typename SystemContext SystemContext, typename... Args>
constexpr auto gtopt::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::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::ReservoirProductionFactorLP::sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) noexcept

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

Returns The object's unique identifier

auto gtopt::ReservoirProductionFactorLP::update_conversion_coeff(LinearInterface& li, ScenarioUid suid, StageUid tuid, Real volume) const -> int

Update the conversion-rate LP coefficient for a given volume.

Parameters
li The linear interface to modify
suid Scenario UID
tuid Stage UID
volume Current reservoir volume [hm³]
Returns Number of coefficients updated

Evaluates the piecewise-linear efficiency at volume and sets the coefficient to -efficiency for every (row, col) pair stored for the given (scenario, stage). The negative sign matches the turbine conversion-row convention: generation − conversion_rate × flow = 0.

int gtopt::ReservoirProductionFactorLP::update_lp(SystemLP& sys, const ScenarioLP& scenario, const StageLP& stage) const

Update the conversion-rate LP coefficient based on reservoir volume.

Returns Number of LP coefficients modified (0 if unchanged or skipped)

Determines the current reservoir volume from the previous LP solution (vavg = (vini + vfin) / 2), falling back to the JSON eini value when no previous solution is available (first stage of first phase).

Evaluates the piecewise-linear efficiency at that volume and sets the turbine conversion coefficient to -efficiency for every (row, col) pair stored for the given (scenario, stage).