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
- auto merge(PlanningOptions&& opts) -> void
- auto migrate_flat_to_model_options() -> void
Public variables
- OptReal annual_discount_rate
- Annual discount rate for multi-stage CAPEX calculations [p.u./year].
- CascadeOptions cascade_options
- Cascade solver configuration (sub-object)
- std::optional<ConstraintMode> constraint_mode
- OptReal demand_fail_cost
- Penalty cost for unserved demand (load shedding) [$/MWh].
- OptReal hydro_fail_cost
- Default penalty cost for unmet hydro rights [$/m3]. Applied to FlowRight and VolumeRight deficit variables when the per-element
fail_costis not set. Default: 5.0 $/m3. For FlowRight, multiplied by block duration × flow_conversion_rate to convert from $/m3 to the flow variable's units. - OptReal hydro_use_value
- Default value of exercising hydro rights [$/m3]. Applied as negative objective coefficient (benefit) on FlowRight and VolumeRight flow variables when the per-element
use_valueis not set. Default: 1.0 $/m3. For FlowRight, multiplied by block duration × flow_conversion_rate to convert from $/m3 to the flow variable's units. - 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.
- OptReal kirchhoff_threshold
- Minimum bus voltage [kV] below which Kirchhoff is not applied [kV].
- OptName log_directory
- Directory for log and trace files (default:
"logs"). Used for error LP dumps (both monolithic and SDDP) and SDDP iteration logs. - OptInt loss_segments
- Default number of piecewise-linear segments for quadratic line losses (default: 1, meaning linear model only)
- 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.
- 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<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: gzip (default), zstd, uncompressed.
- OptName output_directory
- Root directory for output result files.
- std::optional<DataFormat> output_format
- Format for output files: parquet (default) or csv.
- OptReal reserve_fail_cost
- Penalty cost for unserved spinning-reserve requirement [$/MWh].
- OptReal scale_objective
- Divisor applied to all objective coefficients for numerical stability [dimensionless].
- OptReal scale_theta
- Scaling factor for voltage-angle variables [dimensionless].
- SddpOptions sddp_options
- SDDP solver configuration (sub-object)
- SolverOptions solver_options
- LP solver configuration (algorithm, tolerances, threads, etc.)
- OptBool use_kirchhoff
- Whether to apply DC Kirchhoff voltage-law constraints (default: false)
- OptBool use_line_losses
- Whether to model resistive line losses (default: true)
- OptBool use_single_bus
- Whether to collapse the network to a single bus (copper-plate model)
- OptBool use_uid_fname
- Use element UIDs instead of names in output filenames.
- Array<VariableScale> variable_scales
- Per-class/variable LP scale overrides.
Function documentation
void gtopt:: PlanningOptions:: migrate_flat_to_model_options()
Migrate deprecated flat model fields into model_options. Called by PlanningOptionsLP constructor to ensure model_options is populated regardless of how PlanningOptions was constructed (JSON parsing or programmatic initialization).
Variable documentation
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
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).
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} ] } }