lp_replay_buffer.hpp file
LpReplayBuffer — replay state for LowMemoryMode reconstruct.
LpReplayBuffer owns the 5 replay-on-reconstruct fields that previously lived directly on LinearInterface:
m_dynamic_cols_— columns added afterload_flat(typically α).m_dynamic_rows_— structural rows added afterload_flat(e.g. cascade elastic-target constraints).m_active_cuts_— net active Benders cuts.m_pending_col_bounds_— overrides applied viaset_col_low_raw/set_col_upp_rawafterload_flatso they survive the release→reconstruct cycle.m_replaying_— defence-in-depth flag set insideapply_post_load_replay's bulk replay so the auto-record path onadd_col/add_rowshort-circuits.
Extraction is Phase 2a of the LinearInterface split.
Lifecycle:
- Default-constructed: all empty / false.
- Every dynamic addition is mirrored here regardless of mode — including under
off, becausesystem_lp.cpp:560saves a snapshot for every cell andsddp_aperture.cppusesclone_from_flat(with_replay=true)to build the per-aperture clones. That path needs the buffer as the SOLE source of post-snapshot cuts and dynamic cols (without it, aperture clones drop every Benders cut — the large hydrothermal case regression 2026-05-11). Undercompress(and the legacysnapshotalias) the buffer additionally feedsLinearInterface::apply_post_load_replay()when the backend is reloaded.
Invariants (asserted in debug, see validate_consistency()):
- R1. Default-constructed
LpReplayBuffer{}reports all vectors empty,replaying() == false, and zero pending col bounds. - R2.
record_*_if_tracked(...)always records. The_if_trackedsuffix is retained for grep-friendliness with older code; theLowMemoryMode modeparameter was dropped 2026-05-13 (every caller passes the same effective value, and the rebuild mode that motivated mode-gating is gone). - R3.
take_dynamic_cols()/take_active_cuts()move-out the internal vector and leave the buffer in the default-constructed state for that field. - R4.
update_dynamic_col_lowb(...)/update_dynamic_col_bounds(...)returntrueiff a matching(class_name, variable_name)entry was found and updated. Linear search — replay buffers stay tiny (≤ a few alpha cols). - R5.
record_cut_deletion(deleted, base_numrows)is a no-op whenactive_cutsis empty. Otherwise it removes the cuts at the supplied global row indices (offset bybase_numrowsto get them_active_cuts_index). - R6.
set_replaying(true)/set_replaying(false)flip the flag idempotently. An RAII helperReplayGuardis provided for scope-bound use insideapply_post_load_replay.
Namespaces
- namespace gtopt
Classes
- class gtopt::LpReplayBuffer
- Replay state for
LinearInterfacelow-memory reconstruct. - class gtopt::LpReplayBuffer::ReplayGuard