DecisionVariableLP class
#include <gtopt/decision_variable_lp.hpp>
Base classes
-
template<typename ObjectType>class ObjectLP<DecisionVariable>
- Wrapper class that adds LP capabilities to objects.
Public types
- using Element = DecisionVariable
- using object_type = DecisionVariable
- Type of the wrapped object.
Public static variables
- static LPClassName BlockStateClassName
- static std::string_view IncomingName
- static LPClassName StateClassName
- static std::string_view ValueName
- AMPL accessor name:
decision_variable("X").value.
Constructors, destructors, conversion operators
- DecisionVariableLP(const DecisionVariable& pdv, const InputContext& ic) explicit
Public functions
- auto add_cell_cols(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 class_name(this const Self& self) -> auto noexcept
- auto decision_variable(this auto&& 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() & -> DecisionVariable& noexcept
- Gets the wrapped object.
- auto scope() const -> ConstraintScope noexcept
- 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 value_cols_at(const ScenarioLP& scenario, const StageLP& stage) const -> auto&&
- auto value_cols_holder() const -> const STBIndexHolder<ColIndex>& noexcept
Typedef documentation
using gtopt:: DecisionVariableLP:: Element = DecisionVariable
#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:: DecisionVariableLP:: object_type = DecisionVariable
#include <gtopt/object_lp.hpp>
Type of the wrapped object.
Function documentation
bool gtopt:: DecisionVariableLP:: add_cell_cols(SystemContext& sc,
const SceneLP& scene,
const PhaseLP& phase,
LinearProblem& lp)
Cell-column pre-pass for the coarse phase / global scopes: builds the ONE column of this (scene, phase) cell and registers it with the AMPL resolver at every (scenario, stage, block) of the cell. No-op for block / stage scope (built per (scenario, stage) in add_to_lp).
Runs BEFORE the per-(scenario, stage) operational sweep (see add_cell_cols_to_lp in system_lp.cpp) so block- and stage-scoped user constraints can reference the coarse column — previously it was built after them by the planning pass, and those terms were dropped as 0. Takes a NON-const SystemContext& because a state variable registers a cross-phase StateVariable (a non-const registry mutation).
bool gtopt:: DecisionVariableLP:: add_to_lp(SystemContext& sc,
const ScenarioLP& scenario,
const StageLP& stage,
LinearProblem& lp)
Per-(scenario, stage, block) build. Takes a NON-const SystemContext& (like ReservoirLP) because a block_state variable registers the last-block column as a cross-phase StateVariable and defers a state link — both non-const registry mutations.
auto gtopt:: DecisionVariableLP:: class_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: DecisionVariableLP:: id() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's complete identifier (uid + name) |
|---|
bool gtopt:: DecisionVariableLP:: 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 |
DecisionVariable& gtopt:: DecisionVariableLP:: object() & noexcept
#include <gtopt/object_lp.hpp>
Gets the wrapped object.
| Returns | Reference to the wrapped object |
|---|
ConstraintScope gtopt:: DecisionVariableLP:: scope() const noexcept
Resolved time-granularity scope (block default). Read by UserModelLP and the planning-pass routing.
auto& gtopt:: DecisionVariableLP:: 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:: DecisionVariableLP:: short_name(this const Self& self) noexcept
#include <gtopt/object_lp.hpp>
auto gtopt:: DecisionVariableLP:: 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:: DecisionVariableLP:: sv_key(this const Self& self,
const StageLP& stage,
std::string_view col_name) noexcept
#include <gtopt/object_utils.hpp>
auto gtopt:: DecisionVariableLP:: uid() const noexcept
#include <gtopt/object_lp.hpp>
| Returns | The object's unique identifier |
|---|
const STBIndexHolder<ColIndex>& gtopt:: DecisionVariableLP:: value_cols_holder() const noexcept
Read-only access to the full per-(scenario, stage) per-block column map populated by add_to_lp. Additive accessor used by UserModelLP to re-emit a bundled variable's :sol / :cost under the model's own output/UserModel/<tag>/... namespace instead of DecisionVariable/.
Variable documentation
static LPClassName gtopt:: DecisionVariableLP:: BlockStateClassName
Dedicated StateVariable::Key::class_name for a block_state DecisionVariable's per-block storage state (the last block's column). Distinct from StateClassName (coarse state) and from engine state, so it round-trips through cut I/O without collision.
static std::string_view gtopt:: DecisionVariableLP:: IncomingName
AMPL accessor name for a block_state variable's cross-phase INCOMING value (the previous phase's end-of-phase value, pinned by the SDDP forward pass). prev(decision_variable("X").value) at the first block of a stage resolves to this column.
static LPClassName gtopt:: DecisionVariableLP:: StateClassName
Dedicated StateVariable::Key::class_name prefix for AMPL state columns (piece 5). Distinct from the element's own DecisionVariable class name AND from the engine state classes (reservoir efin's element class, the built-in α sddp_alpha_lp_class), so the previous-phase StateVariable::Key synthesized for an AMPL link round-trips through cut I/O without colliding with engine state. Guard 4 of the piece-5 review block.