LpSnapshotHolder class
#include <gtopt/lp_snapshot_holder.hpp>
Snapshot + codec holder for LinearInterface low-memory paths.
Pure encapsulation — no reference to m_low_memory_mode_ or the solver backend. The LinearInterface facade gates on the mode before calling into the holder.
Public functions
- void clear() noexcept
- auto codec() const -> CompressionCodec noexcept
- auto compress_if_uncompressed() -> bool
- void decompress_if_compressed()
- auto has_data() const -> bool noexcept
- auto is_compressed() const -> bool noexcept
- auto is_empty() const -> bool noexcept
- void set_codec(CompressionCodec c) noexcept
- void set_dedup(std::shared_ptr<FlatLpDedupRegistry> registry, std::string key) noexcept
- void set_flat_lp(FlatLinearProblem flat_lp) noexcept
- auto snapshot() const -> const LowMemorySnapshot& noexcept
- auto snapshot_mut() -> LowMemorySnapshot& noexcept
Function documentation
void gtopt:: LpSnapshotHolder:: clear() noexcept
S2 — drop the snapshot to its default-constructed state. Leaves the codec untouched (callers that want a full reset should also set_codec(CompressionCodec::zstd)).
bool gtopt:: LpSnapshotHolder:: compress_if_uncompressed()
| Returns | true iff this call performed the first compression (the snapshot transitioned from uncompressed to compressed); false for repeat calls. Callers that want to log the compression ratio inspect the return value to fire only on first-compress. |
|---|
S4 — compress the flat LP buffer using codec().
void gtopt:: LpSnapshotHolder:: decompress_if_compressed()
S3 — re-hydrate the flat LP from the compressed buffer. No-op when the snapshot is not compressed.
bool gtopt:: LpSnapshotHolder:: is_empty() const noexcept
S1 debug self-check. Returns true iff the holder is in the default-constructed state.
void gtopt:: LpSnapshotHolder:: set_dedup(std::shared_ptr<FlatLpDedupRegistry> registry,
std::string key) noexcept
Attach the cross-cell dedup registry and this cell's key (see FlatLpDedupRegistry). Used by the next first-compress only.
void gtopt:: LpSnapshotHolder:: set_flat_lp(FlatLinearProblem flat_lp) noexcept
Replace the snapshot's flat LP wholesale. Used by load_flat and freeze_for_cuts paths in LinearInterface.