gtopt::WaterwayLP class

Base classes

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

Public types

using Element = Waterway
using object_type = Waterway
Type of the wrapped object.

Public static variables

static std::string_view FlowName
static std::string_view FminSoftName
static std::string_view FminUnservedName

Constructors, destructors, conversion operators

WaterwayLP(const Waterway& pwaterway, const 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 flow_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> const auto&
auto has_junction_b() 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 junction_a_sid() const -> auto noexcept
auto junction_b_sid() const -> JunctionLPSId
auto lookup_flow_col(const ScenarioLP& scenario, const StageLP& stage, BlockUid buid) const -> std::optional<ColIndex> noexcept
auto object() & -> Waterway& 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 waterway(this auto&& self) -> auto&& noexcept

Parameter accessors for user constraint resolution.

Per-(stage, block) and per-stage Waterway schedules. Returned by the ampl_dispatch_registry shims so PAMPL constraints can reference waterway('X').<field> as a constant scalar.

auto param_fmin(StageUid s, BlockUid b) const -> auto
auto param_fmax(StageUid s, BlockUid b) const -> auto
auto param_capacity(StageUid s) const -> auto
auto param_lossfactor(StageUid s) const -> auto
auto param_fcost(StageUid s) const -> auto

Typedef documentation

using gtopt::WaterwayLP::Element = Waterway

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::WaterwayLP::object_type = Waterway

Type of the wrapped object.

Function documentation

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

bool gtopt::WaterwayLP::has_junction_b() const noexcept

Returns Whether the waterway credits a downstream junction. False means outflow mode: the carried flow drains out of the system at junction_a, no synthetic ocean / sink junction needed.

auto gtopt::WaterwayLP::id() const noexcept

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

bool gtopt::WaterwayLP::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

std::optional<ColIndex> gtopt::WaterwayLP::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, pump_lp, etc.) use this to skip the matching constraint row when the P1 zero-bound skip (waterway_lp.cpp:72) elided the flow column, instead of throwing flat_map::at.

Waterway& gtopt::WaterwayLP::object() & noexcept

Gets the wrapped object.

Returns Reference to the wrapped object

auto& gtopt::WaterwayLP::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

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

auto gtopt::WaterwayLP::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

auto gtopt::WaterwayLP::sv_key(this const Self& self, const StageLP& stage, std::string_view col_name) noexcept

auto gtopt::WaterwayLP::uid() const noexcept

Returns The object's unique identifier

Variable documentation

static std::string_view gtopt::WaterwayLP::FminUnservedName

soft-fmin slack column ("unserved" forced flow) + its row, used when fmin_fcost is set (mirrors GeneratorLP's UnservedName/PminSoftName).