source/sddp_cut_parquet.cpp file

Apache Parquet save / load for SDDP cuts.

The single canonical on-disk format for SDDP cuts. Uses a typed Arrow schema with a list<struct<cls,var,uid,val>> column for cut coefficients — eliminating the variable-schema CSV tail and the {:.17g} text-formatting dance. Bit-exactness comes free from float64 storage in Parquet. The legacy CSV and JSON cut writers were retired in 2026-05.

On-disk schema (v4, 2026-06): type: int8 (CutType enum's underlying uint8_t) phase: int32 scene: int32 iteration: int32 (direct, no longer extracted from a name field) extra: int32 (4th element of IterationContext — multi-cut sibling discriminator, sentinel -1 = unset) rhs: float64 coeffs: list<struct<cls: utf8, var: utf8, uid: int32, val: float64>>

Each coefficient identifies its state variable by the TYPED triple (cls class name, var column name, uid). All three are needed: uid is namespaced by (class, var), not globally unique (e.g. Reservoir:efin:1 and Sddp:alpha:1 coexist). The low-cardinality cls/var columns dictionary-compress to ~nothing. Schema v4 replaced the v2/v3 packed key: utf8 = "cls:var:uid" string, which forced a split + std::from_chars re-parse on every load. Cut files are internal, single-version temporaries (written and read by the same binary within one run / cascade), so NO legacy v2/v3 read path is kept.

The legacy schema-v2 name: utf8 column was dropped in 2026-05; cut identity now lives in the structured CutKey {type, scene_uid, phase_uid, iteration_index, extra} 5-tuple. LP row labels are still generated at install time by LabelMaker::make_row_label from the SparseRow metadata (class_name / constraint_name / uid / context), but those are an LP-display concern and never serialised back to the cut file.

File metadata: KeyValueMetadata{version = "3", scale_objective = "<.17g>"}.

Append mode: Parquet has no row-level append, so save_cuts_parquet(..., append_mode=true) writes a sibling file <stem>.append-<stamp>.parquet in the same directory. load_cuts_parquet globs <stem>.parquet and every <stem>.append-*.parquet and merges them.

Namespaces

namespace gtopt

Defines

#define SPDLOG_ACTIVE_LEVEL