decision_variable_lp.cpp file
LP build path for DecisionVariable elements.
One LP column per (scenario, stage, block) per DecisionVariable object (the default block scope). The column defaults to non-negative ([0, DblMax]) so it never emits a free (unbounded-below) column that would break GPU first-order solvers; an explicit lower_bound opts out, and an α-rebased column (obj_constant set) auto-stays free below. An optional cost adds the column to the LP objective via CostHelper::block_ecost so the units match the other gtopt LP elements. Registered with the AMPL resolver under decision_variable("X").value so UserConstraint expressions can reference it directly.
── Coarse scope (piece 4/5) ────────────────────────────────────────────── A scope of stage collapses the per-block fan-out to one column per (scenario, stage); phase / global collapse it further to ONE column per (scene, phase) cell, built in the planning passes (add_to_phase_lp / add_to_global_lp) instead of the operational per-(scenario, stage) sweep.
── AMPL state variable (piece 5) ───────────────────────────────────────── state: true registers a coarse (stage / phase / global) column as a cross-phase StateVariable via SystemContext::add_state_col and, when link: true, defers a link from this phase's column to the previous phase's same-variable column (defer_state_link). It then RIDES the generic SDDP backward pass — coupled across phases and present in every optimality / feasibility cut — with NO engine change. Guards:
state: truerequireslink: true(hard error otherwise).state: truemust NOT beblock-scoped (hard error otherwise).- the StateVariable key uses a DEDICATED class name (
StateClassName) so its identity round-trips through cut I/O without colliding with engine state (reservoir efin element class, the built-in α class).
── Integer variables ───────────────────────────────────────────────────── integer: true routes every value column through SystemContext::add_integer_col (the integer-variable choke-point), with scope Block (per-block column, group = block uid), Stage (stage scope) or Phase (the coarse cell column). Domain: Binary for bounds exactly [0, 1], else Integer; Relaxed (continuous) when relax || phase.is_continuous() — the same precedence as Commitment.relax (--no-mip reaches it via continuous_phases = all). A coarse state column may be integer: it is registered as BOTH a state and an integer variable (orthogonal registries, like expmod). For a block_state variable only the per-block volume columns are integer; the INCOMING value_in column is a pinned/fixed copy of a state and stays continuous.
Namespaces
- namespace gtopt