update_context.hpp file
Self-cached context for HasUpdateLP elements.
Each LP element that satisfies the HasUpdateLP concept (update_lp() mutates LP coefficients per SDDP iteration) reads a small amount of reservoir state — eini volume, efin volume — at update time. Routing those reads through sys.element<ReservoirLP>(...) couples update_lp to the current SystemLP's Collection<ReservoirLP>, blocking the Phase-2 collection-drop optimisation under LowMemoryMode::compress.
ReservoirRefCache captures, at add_to_lp time, exactly what update_lp needs:
default_volume— fallback value for un-solved phases.energy_scale— scale factor for warm-solution reads.eini_col/efin_col— current-stage column indices.rsv_uid— kept for diagnostics and identity.
physical_eini_from_cache and physical_efin_from_cache read the cached column indices directly from sys.linear_interface(). They never call sys.element<ReservoirLP> and never traverse prev_phase_sys. This is sufficient because:
- Non-daily_cycle reservoir — the LP's state-link constraint pins
eini_col == prev_phase_efin_col, so reading currenteini_colyields the same value as the predecessor's solved efin, with no cross-phase traversal. - Daily_cycle reservoir — there's no state link; the in-phase
efin == einiconstraint pins both columns together; reading currenteini_colyields the current phase's optimised volume.
In both cases, "read the eini column" is the right answer and there is no special-case for daily_cycle.
Namespaces
- namespace gtopt
Classes
- struct gtopt::ReservoirRefCache
- struct gtopt::RuleBoundState