UserModelLP class
#include <gtopt/user_model_lp.hpp>
Base classes
-
template<typename ObjectType>class ObjectLP<UserModel>
- Wrapper class that adds LP capabilities to objects.
Public types
- using Element = UserModel
- using object_type = UserModel
- Type of the wrapped object.
Public static variables
Constructors, destructors, conversion operators
- UserModelLP(const UserModel& um, InputContext& ic) explicit
Public functions
- auto add_cell_cols(SystemContext& sc, const SceneLP& scene, const PhaseLP& phase, LinearProblem& lp) -> bool
- auto add_to_global_lp(SystemContext& sc, const SceneLP& scene, const PhaseLP& phase, LinearProblem& lp) -> bool
- auto add_to_lp(SystemContext& sc, const ScenarioLP& scenario, const StageLP& stage, LinearProblem& lp) -> bool
- auto add_to_output(OutputContext& out) const -> bool
- auto add_to_phase_lp(SystemContext& sc, const SceneLP& scene, const PhaseLP& phase, LinearProblem& lp) -> 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() & -> UserModel& 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 user_model(this auto&& self) -> auto&& noexcept
Typedef documentation
using gtopt:: UserModelLP:: Element = UserModel
#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:: UserModelLP:: object_type = UserModel
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
bool gtopt:: UserModelLP:: add_cell_cols(SystemContext& sc,
const SceneLP& scene,
const PhaseLP& phase,
LinearProblem& lp)
Cell-column pre-pass: builds the single (scene, phase) column of every bundled phase / global-scoped variable BEFORE the operational sweep, so block/stage-scoped constraints (bundled or standalone) can reference it. Mirrors DecisionVariableLP::add_cell_cols.
bool gtopt:: UserModelLP:: add_to_global_lp(SystemContext& sc,
const SceneLP& scene,
const PhaseLP& phase,
LinearProblem& lp)
Planning-level global-scope build (one un-indexed row/col per cell) for any bundled var/constraint declared with scope: global. Non-const SystemContext& for the same state-registration reason.
bool gtopt:: UserModelLP:: add_to_lp(SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
Operational build: drives every internal DecisionVariableLP then every internal UserConstraintLP for one (scenario, stage) pair (block/stage scope). Coarse (phase/global) scopes are no-ops here — they route through the planning passes below, exactly like the standalone elements. Non-const SystemContext& (like ReservoirLP / DecisionVariableLP) because a bundled block_state variable registers a cross-phase state.
bool gtopt:: UserModelLP:: add_to_output(OutputContext& out) const
Captures the bundled NAMED cols (:sol/:cost) and rows (:dual/:slack) under output/UserModel/<tag>/<name>_{sol,cost, dual,slack}. Aux cols/rows created by abs/min/max lowering are internal LP detail and are NOT captured (see the policy note in the cpp).
bool gtopt:: UserModelLP:: add_to_phase_lp(SystemContext& sc,
const SceneLP& scene,
const PhaseLP& phase,
LinearProblem& lp)
Planning-level phase-scope build (one row per (scene, phase) cell) for any bundled var/constraint declared with scope: phase. Non-const SystemContext& because a bundled state variable registers a cross-phase StateVariable (a non-const registry mutation).
auto gtopt:: UserModelLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: UserModelLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: UserModelLP:: 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 |
UserModel& gtopt:: UserModelLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
auto& gtopt:: UserModelLP:: 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:: UserModelLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: UserModelLP:: 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:: UserModelLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: UserModelLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|