LpLabelStore struct
#include <gtopt/lp_label_store.hpp>
Name / label subsystem of a LinearInterface. Groups the name-to-index maps, the frozen flatten-time label metadata, the per-instance post-flatten metadata, the compressed backups and the string pool. Extracted verbatim from LinearInterface — every mutable qualifier and default initializer is preserved so the COW / clone semantics are bit-identical to the pre-extraction code.
Public variables
- std::shared_ptr<StrongIndexVector<ColIndex, std::string>> col_index_to_name
- std::shared_ptr<const std::vector<SparseColLabel>> col_labels_meta
- CompressedBuffer col_labels_meta_compressed
- std::size_t col_labels_meta_count
-
std::shared_ptr<col_
name_ map_ t> col_names - Column (variable) name → idx.
- std::size_t frozen_col_count
- std::size_t frozen_row_count
- std::vector<std::string> label_string_pool
- LpNameSpillStore* name_store
- std::vector<SparseColLabel> post_flatten_col_labels_meta
- std::vector<SparseRowLabel> post_flatten_row_labels_meta
- std::shared_ptr<StrongIndexVector<RowIndex, std::string>> row_index_to_name
- std::shared_ptr<const std::vector<SparseRowLabel>> row_labels_meta
- CompressedBuffer row_labels_meta_compressed
- std::size_t row_labels_meta_count
-
std::shared_ptr<row_
name_ map_ t> row_names - Row (constraint) name → idx.
- std::string spill_key
Variable documentation
std::shared_ptr<const std::vector<SparseColLabel>> gtopt:: LpLabelStore:: col_labels_meta
Label-only metadata for the frozen flatten-time portion of the LP — set ONCE by load_flat from flat_lp.col_labels_meta / row_labels_meta, then never resized. Indexed by the structural [0, flatten_col_count()) / [0, flatten_row_count()) half of the LP. Post-flatten additions (cuts, slacks, alpha, cascade elastic constraints) live in post_flatten_col_labels_meta / post_flatten_row_labels_meta instead.
Sharing model:
shared_ptr<T>soclone(CloneKind::shallow)hands the vector out to aperture clones via atomic incref — zero copy.- Because the vector is never resized post-
load_flat, no mutating site detaches it; clones and source share the same storage forever (no copy-on-write churn on the first post-flatten add).
Under LowMemoryMode::compress, release_backend compresses these vectors into col_labels_meta_compressed / row_labels_meta_compressed and clears the live copies. The decompressed strings live in label_string_pool — the pool is never cleared while col_labels_meta references it. mutable because the lazy decompression flow is triggered from const methods.
Immutable once installed: load_flat ALIASES the flat LP's FlatLpMeta (shared with the retained snapshot) instead of deep-copying it, and every update replaces the pointer. On the CEN 2y case the deep copy duplicated ~1.6 GiB of label metadata.
CompressedBuffer gtopt:: LpLabelStore:: col_labels_meta_compressed
Compressed backups of the metadata vectors — populated on release_backend under compress mode, drained on the first label-metadata read after reload.
Intentionally NOT shared_ptr-wrapped: compression / decompression only ever runs on the source LP (via release_backend and ensure_backend); clones never compress. The DecompressionGuard around the aperture pass ensures the source is in the decompressed state for the lifetime of any shallow clone, so the source uniquely owns these buffers throughout.
std::size_t gtopt:: LpLabelStore:: frozen_col_count
Structural (flatten-side) column / row counts installed by the last load_flat — the boundary between the frozen and the post-flatten halves of the label index space. Deliberately NOT derived from col_labels_meta->size(): under low-memory without LP names the frozen metadata is empty (dropped, spilled, or cleared on release_backend), and an empty-vector-derived boundary of 0 made every post-flatten add (alpha, each cut row) pad post_flatten_*_labels_meta with one entry per STRUCTURAL col/row — ~(ncols + nrows) labels retained per cell for the whole run (~9 MB/cell, ~16 GB on the 1728-cell y24 case), and mis-indexed post-flatten labels once a spill-store reload repopulated the frozen vectors.
std::vector<std::string> gtopt:: LpLabelStore:: label_string_pool
Stable string storage backing decompressed string_views in col_labels_meta / row_labels_meta. Reserved ahead of decompression so push_back doesn't invalidate the views.
LpNameSpillStore* gtopt:: LpLabelStore:: name_store
Non-owning back-pointer to the run-lifetime async metadata store and this cell's spill key. When set (names kept + non-monolithic), the structural label metadata was spilled to the store and dropped from the snapshot; generate_labels_from_maps reloads it from the store (cached) on demand. Null when spilling is disabled (the live label vectors are authoritative).
std::vector<SparseColLabel> gtopt:: LpLabelStore:: post_flatten_col_labels_meta
Label-only metadata for the post-flatten portion of the LP — extended by every add_col(SparseCol) / add_row(SparseRow) that runs after load_flat has installed the structural matrix. Hosts cut rows, alpha column, cascade elastic-target slacks + constraints, and any other dynamic addition.
Per-instance — never wrapped in shared_ptr, never shared with clones. A freshly-cloned LinearInterface starts with empty post-flatten vectors regardless of the source's history; the clone's own post-flatten additions land here independently of the source's, which is the correct semantics for aperture clones (each clone's elastic-filter slacks belong only to that clone).
Not compressed: the post-flatten vector is small in practice (alpha + a bounded set of cut rows / cascade elastic slacks) and is mutated frequently.
std::shared_ptr<row_ name_ map_ t> gtopt:: LpLabelStore:: row_names
Row (constraint) name → idx.
Name-to-index maps for duplicate detection and later lookup. Populated when names are enabled.