gtopt::StateVarLink struct

Describes one state-variable linkage between consecutive phases.

A state variable has a source column in phase t (e.g. efin, capainst) and a dependent column in phase t+1 (e.g. eini, capainst_ini). The source column's physical bounds are captured at initialisation time so the elastic filter can relax to the correct domain.

Public variables

LPClassName class_name
std::string_view col_name
e.g. "efin", "sini"
ColIndex dependent_col
Dependent column in target phase's LP.
std::string_view name
ScenarioUid scenario_uid
double scost
ColIndex source_col
Source column in source phase's LP.
double source_low
Physical lower bound of source column.
PhaseIndex source_phase_index
Phase where the source column lives.
double source_upp
StageUid stage_uid
const StateVariable* state_var
PhaseIndex target_phase_index
Phase where the dependent column lives.
double trial_value
Trial value from the last forward pass.
Uid uid
double var_scale

Variable documentation

LPClassName gtopt::StateVarLink::class_name

Identity of the state-variable element, for diagnostic logs. Captured once at link collection time from the simulation registry Key. The string_views reference the same stable storage as the map keys, so they outlive the link for the whole solver lifetime. LP class identity stored by value. Mirrors StateVariable::Key::class_name — copied from the source Key at link-collection time. Zero-runtime access to both PascalCase full_name() and snake_case short_name().

std::string_view gtopt::StateVarLink::name

Human-readable element name (e.g. "LMAULE", "RALCO"). Resolved from SimulationLP::m_ampl_element_names_ at link-collection time via a reverse scan of the (class_name, name) → uid map. Empty when the element was never registered in the AMPL name map — in that case diagnostic logs fall back to the numeric uid.

ScenarioUid gtopt::StateVarLink::scenario_uid

Scenario / stage identity of the producing state variable. The same element uid + col_name is registered once per (scenario, stage) within a scene, so these are needed to map a link to its counterpart in the aperture-system state-variable registry (aperture-system cut path).

double gtopt::StateVarLink::scost

Per-variable state cost for elastic penalty [$/physical_unit / scale_obj]. When > 0, overrides the global penalty for this link. Pre-divided by scale_objective during link construction for consistency with the global penalty (which is also pre-divided by scale_objective).

double gtopt::StateVarLink::source_upp

Physical upper bound of source column

const StateVariable* gtopt::StateVarLink::state_var

Back-pointer to the StateVariable this link represents.

The StateVariable lives in SimulationLP::m_global_variable_map_ (a flat_map populated once at LP build time, never reshuffled), so its address is stable for the lifetime of the solver run — the same lifetime that already couples source and dependent LP columns.

Used by the SDDP solve passes to read/write runtime values (col_sol, reduced_cost) directly on the state variable, avoiding full per-LP std::vector<double> snapshots. Nullable for test fixtures that exercise cut builders in isolation.

Uid gtopt::StateVarLink::uid

Element UID

double gtopt::StateVarLink::var_scale

Variable scale factor: physical = LP × var_scale. Used by the elastic filter to scale the penalty per LP unit.