PlanningOptions struct
#include <gtopt/planning_options.hpp>
Global configuration parameters for the optimization model.
All fields are optional, allowing partial specification and merging across multiple JSON files. When a field is absent, the solver applies a built-in default (see PlanningOptionsLP for the resolved defaults).
Public functions
- void merge(PlanningOptions&& opts)
Public variables
- OptReal annual_discount_rate
- Annual discount rate for multi-stage CAPEX calculations [p.u./year]. Kept at top level — NOT a
ModelOptionsmirror; canonical home issimulation.annual_discount_rate. - std::optional<BuildMode> build_mode
- How
PlanningLP::create_systemsassembles per-cell SystemLPs. - CascadeOptions cascade_options
- Cascade solver configuration (sub-object).
- std::optional<ConstraintMode> constraint_mode
- GasOptions gas_options
- OptName input_directory
- Root directory for external input data files (CSV/Parquet).
- std::optional<DataFormat> input_format
- Preferred format for reading external files: parquet or csv.
- OptName log_directory
- Directory for log and trace files (default:
"logs"). Used for error LP dumps (both monolithic and SDDP) and SDDP iteration logs. - std::optional<CompressionCodec> lp_compression
- Compression codec for LP debug files.
- OptBool lp_debug
- When true, save LP debug files to the log directory. Monolithic solver: saves one LP file per (scene, phase) after building the model. SDDP solver: saves one LP file per (iteration, scene, phase) during the forward pass.
- OptInt lp_debug_phase_max
- Maximum phase UID for selective LP debug saving (inclusive).
- OptInt lp_debug_phase_min
- Minimum phase UID for selective LP debug saving (inclusive). When set together with lp_debug=true, only phases with uid >= lp_debug_phase_min are saved. Default: save all.
- OptInt lp_debug_scene_max
- Maximum scene UID for selective LP debug saving (inclusive).
- OptInt lp_debug_scene_min
- Minimum scene UID for selective LP debug saving (inclusive). When set together with lp_debug=true, only scenes with uid >= lp_debug_scene_min are saved. Default: save all.
- OptBool lp_error
- When true, write an error LP file when a cell is infeasible and keep the col/row name metadata needed to write it — independent of
lp_debug. Coordinated withlp_debug/lp_file: if all are off, no name metadata is generated, compressed, saved or loaded. - OptBool lp_fingerprint
- When true, write LP fingerprint JSON to the output directory. The fingerprint captures the structural template of the LP formulation (which types of variables and constraints exist) for regression detection. Output file:
lp_fingerprint_scene_{S}_phase_{P}.json. - LpMatrixOptions lp_matrix_options
- LP matrix assembly configuration (epsilon, naming, stats, etc.).
- OptBool lp_only
- When true, build all scene/phase LP matrices but skip solving. Both the monolithic and SDDP solvers exit immediately after LP matrix assembly — no solving occurs at all. Combine with
lp_debug=trueto save every scene/phase LP file. - std::optional<LpScalesLevel> lp_scales
- When true, write a machine-readable JSON scales sidecar next to every LP file written by
--lp-file(<stem>.scales.json, or<stem>_scene_S_phase_P.scales.jsonwhen several cells are written). It holds what the model file cannot: the objective scale, the per-block duration / probability / discount / cost_factor weights and the columns and rows whose scale factor is not 1. Seedocs/lp-scales.md.summarykeeps only the header, weights and numerics (a few KB);fulladds the scaled columns and row scales. Default: none (no sidecar, no extra cost). - std::optional<MethodType> method
- Planning solver type: monolithic (default), sddp, or cascade.
- ModelOptions model_options
- Power system model configuration (sub-object).
- MonolithicOptions monolithic_options
- Monolithic solver configuration (sub-object).
- std::optional<CompressionCodec> output_compression
- Compression codec for Parquet output (default: lz4). Supported: lz4, snappy, zstd, gzip, uncompressed. See
PlanningOptionsLP::default_output_compressionfor the rationale behind the default. - OptName output_directory
- Root directory for output result files.
- std::optional<DataFormat> output_format
- Format for output files: parquet (default) or csv.
- OptInt output_round_decimals
- Round the on-disk value columns to N decimal places before writing. Default
7(seedefault_output_round_decimalsin planning_options_lp.hpp; 1..7 store float32, >= 8 store double) — keeps the trailing mantissa bits zero soBYTE_STREAM_SPLIT + zstdcan compress the value stream 3-5× better. Set to a non-positive value (0or-1) to disable rounding and store the full IEEE-754 binary, e.g. when verifying bit-for-bit reproducibility of dispatch outputs. - OptBool output_usage_metrics
- Emit the per-block usage-accounting streams (default false).
- SanityOptions sanity_options
- Thresholds of the model-sanity warnings emitted by
validate_planning()(phantom rewards, profiles outside [0, 1], zero-capacity committed units, implausible line impedance, agreement reserve levels without a reservoir floor). Warnings only. - SddpOptions sddp_options
- SDDP solver configuration (sub-object).
- SolverOptions solver_options
- LP solver configuration (algorithm, tolerances, threads, etc.).
- OptBool use_uid_fname
- Use element UIDs instead of names in output filenames.
- Array<VariableScale> variable_scales
- Per-class/variable LP scale overrides.
- std::optional<OutputSelection> write_out
- Which output fields
OutputContextshould emit.
Variable documentation
std::optional<BuildMode> gtopt:: PlanningOptions:: build_mode
How PlanningLP::create_systems assembles per-cell SystemLPs.
parallel (default) dispatches (scene × phase) cells through an AdaptiveWorkPool. serial builds cells in-place in the calling thread with no pool / build-buffer / move overhead and is the honest apples-to-apples comparison against the pre-parallel code path. See BuildMode for the full contract.
std::optional<ConstraintMode> gtopt:: PlanningOptions:: constraint_mode
Controls error handling for user constraint resolution.
normal: warn and skip unresolved referencesstrict(default): fail on any unresolved reference
GasOptions gtopt:: PlanningOptions:: gas_options
Network-level gas properties of the gas-network elements (options.gas_options).
std::optional<CompressionCodec> gtopt:: PlanningOptions:: lp_compression
Compression codec for LP debug files.
Controls how LP debug files (lp_debug=true) are compressed.
- not set (default): let
gtopt_compress_lpdecide; falls back tozstd(inline libzstd), thengzip, then inline zlib when the script is not available. uncompressed: never compress; keep plain.lpfiles.gzip,zstd,lz4,bzip2,xz: request a specific codec. The value is passed as--codec <codec>togtopt_compress_lp; if the script or codec is unavailable the named binary is tried directly, thenzstd, thengzip, then inline zlib.
LpMatrixOptions gtopt:: PlanningOptions:: lp_matrix_options
LP matrix assembly configuration (epsilon, naming, stats, etc.).
Exposes the full LpMatrixOptions struct as a JSON sub-object so that users can set LP assembly parameters directly in the planning JSON:
{ "options": { "lp_matrix_options": { "eps": 1e-10, "compute_stats": true } } }
std::optional<MethodType> gtopt:: PlanningOptions:: method
Planning solver type: monolithic (default), sddp, or cascade.
This is the only supported way to select the solver. Example:
{ "options": { "method": "cascade" } }
ModelOptions gtopt:: PlanningOptions:: model_options
Power system model configuration (sub-object).
New preferred location for LP-construction options. Fields here are overridden by the corresponding flat fields in PlanningOptions when both are set (backward compatibility).
OptBool gtopt:: PlanningOptions:: output_usage_metrics
Emit the per-block usage-accounting streams (default false).
Output only — the LP is unchanged. Adds Generator/usage_on_sol (1 when the unit generates, else 0), Generator/usage_ramp_sol (|p_b − p_{b−1}| [MW] on chronological stages) and, for units with a Commitment, Commitment/usage_pmin_sol (committed floor [MW]) and Commitment/usage_at_pmin_sol (u when the unit sits at its floor). The gtopt_usage post-processor turns them (plus the standard generation / reserve / startup / battery streams) into operating hours, EOH, starts, reserve MW·h and BESS cycles. See docs/output-data.md "Usage accounting".
SanityOptions gtopt:: PlanningOptions:: sanity_options
Thresholds of the model-sanity warnings emitted by validate_planning() (phantom rewards, profiles outside [0, 1], zero-capacity committed units, implausible line impedance, agreement reserve levels without a reservoir floor). Warnings only.
{ "options": { "sanity_options": { "line_xr_max": 200 } } }
SolverOptions gtopt:: PlanningOptions:: solver_options
LP solver configuration (algorithm, tolerances, threads, etc.).
Exposes the full SolverOptions struct as a JSON sub-object so that users can set LP solver parameters — including the optional tolerance values — directly in the planning JSON:
{ "options": { "solver_options": { "algorithm": 3, "optimal_eps": 1e-8, "feasible_eps": 1e-8 } } }
Individual top-level fields (lp_algorithm, lp_threads, lp_presolve) are still respected for backward compatibility and take precedence over the corresponding solver_options sub-fields.
Array<VariableScale> gtopt:: PlanningOptions:: variable_scales
Per-class/variable LP scale overrides.
Provides a uniform, extensible mechanism for defining LP variable scale factors via JSON. Each entry maps a (class, variable, optional UID) triple to a scale factor where physical = LP × scale.
Per-element fields (Battery::energy_scale, Reservoir::energy_scale) and global options (scale_theta) take precedence over entries here.
JSON Example
{ "options": { "variable_scales": [ {"class_name": "Bus", "variable": "theta", "uid": -1, "scale": 0.001}, {"class_name": "Reservoir", "variable": "energy", "uid": -1, "scale": 1000.0}, {"class_name": "Battery", "variable": "energy", "uid": 1, "scale": 10.0} ] } }
std::optional<OutputSelection> gtopt:: PlanningOptions:: write_out
Which output fields OutputContext should emit.
OutputSelection = bitmask over OutputFlags (solution / dual / reduced_cost) plus an optional per-atom allow-list of element-class cnames. When unset, the solver emits all (primal, dual, and reduced cost across every element class) so that downstream tools — notably gtopt_marginal_units — can identify the marginal unit per (bus, scene, stage, block) from column reduced costs without re-running the LP.
CLI form: --write-out solution,dual,rc:Generator,Line. JSON form: "write_out": "sol,dual,rc:Generator,Line". Parsed via parse_output_selection().