gtopt::LowMemorySnapshot struct

Stores a FlatLinearProblem with persistent zstd compression.

The compressed buffer is created once during the first compress() call and kept as a persistent cache. decompress() expands the vectors; callers free them via clear_flat_lp_vectors() after loading into the backend. The flat LP is immutable after save_snapshot().

Public functions

void compress(CompressionCodec codec, FlatLpDedupRegistry* registry = nullptr, const std::string& dedup_key = {})
void decompress()
auto has_data() const -> bool noexcept
True when a snapshot has been saved (metadata present).
auto is_compressed() const -> bool noexcept
True when the flat LP vectors have been compressed away.

Public variables

CompressedBuffer compressed_lp
FlatLinearProblem flat_lp

Function documentation

void gtopt::LowMemorySnapshot::compress(CompressionCodec codec, FlatLpDedupRegistry* registry = nullptr, const std::string& dedup_key = {})

Compress the flat LP (first call only) and free expanded vectors. Subsequent calls just free the expanded vectors. With a non-null registry the buffer is deduplicated against the registry base for dedup_key (see FlatLpDedupRegistry).

void gtopt::LowMemorySnapshot::decompress()

Decompress the flat LP vectors from the compressed buffer. Keeps the compressed buffer intact (persistent cache).

Variable documentation

CompressedBuffer gtopt::LowMemorySnapshot::compressed_lp

Persistent compressed representation of the flat LP. Created once during the first compress() call; never re-compressed.