gtopt::MainOptions struct

All command-line options consumed by gtopt_main().

Every field is optional so that callers only set what they need and can use designated-initializer syntax:

gtopt_main(MainOptions{
  .planning_files = files,
  .use_single_bus = true,
  .print_stats    = true,
});

Public variables

std::optional<int> algorithm
LP solution algorithm override (0=default, 1=primal, 2=dual, 3=barrier). Mapped to solver_options.algorithm by apply_cli_options.
std::optional<bool> check_json
Warn about JSON fields not recognised by the schema.
std::optional<std::string> cut_directory
Directory for Benders cut files (default: "cuts")
std::optional<bool> fast_parsing
Use fast (non-strict) JSON parsing.
std::optional<std::string> input_directory
Override for the input data directory.
std::optional<std::string> input_format
Input format override ("parquet", "csv", …)
std::optional<std::string> json_file
Path stem for writing the merged planning JSON.
std::optional<std::string> log_directory
Directory for log and trace files (default: "logs")
std::optional<double> lp_coeff_ratio_threshold
LP coefficient ratio threshold for numerical conditioning diagnostics. When the global max/min |coefficient| ratio exceeds this value, a per-scene/phase breakdown is printed. (default: 1e7)
std::optional<std::string> lp_compression
Compression codec for LP debug files. "" = auto (let gtopt_compress_lp decide); "none" = no compression; "gzip", "zstd", "lz4", "bzip2", "xz" = specific codec.
std::optional<bool> lp_debug
Save debug LP files to the log directory (monolithic: one per scene/phase; SDDP: one per iteration/scene/phase)
std::optional<std::string> lp_file
Path stem for writing the LP model file.
std::optional<LpNamesLevel> lp_names_level
LP naming level: minimal, only_cols, cols_and_rows.
std::optional<bool> lp_only
Build all scene/phase LP matrices but skip solving entirely.
std::optional<double> matrix_eps
Epsilon tolerance for LP matrix coefficients.
std::optional<std::string> output_compression
Compression codec for parquet output ("gzip", "zstd", …)
std::optional<std::string> output_directory
Override for the output directory.
std::optional<std::string> output_format
Output format ("parquet", "csv")
std::vector<std::string> planning_files
Paths to planning JSON files (planning.json).
std::optional<bool> print_stats
Print pre- and post-solve system statistics.
std::optional<bool> recover
Enable recovery from a previous SDDP run.
std::optional<double> sddp_convergence_tol
SDDP relative convergence tolerance (default: 1e-4)
std::optional<std::string> sddp_cut_coeff_mode
SDDP cut coefficient source: "reduced_cost" (default) or "row_dual" (PLP-style explicit coupling constraint rows)
std::optional<std::string> sddp_elastic_mode
SDDP elastic filter mode: "cut" (default) or "backpropagate".
std::optional<double> sddp_elastic_penalty
Penalty coefficient for SDDP elastic slack variables (default: 1000)
std::optional<bool> sddp_hot_start
Enable SDDP hot-start from previously saved cuts.
std::optional<int> sddp_max_iterations
Maximum SDDP forward/backward iterations (default: 100)
std::optional<int> sddp_min_iterations
Minimum SDDP iterations before convergence (default: 2)
std::optional<int> sddp_num_apertures
Number of SDDP backward-pass apertures (0=disabled, -1=all)
std::vector<std::string> set_options
Repeatable --set key=value overrides.
std::optional<std::string> solver
LP solver backend name ("clp", "cbc", "cplex", "highs"). When empty, auto-detects from available plugins.
std::map<std::string, SolverOptions> solver_configs
Per-solver default SolverOptions loaded from .gtopt.conf.
std::optional<int> threads
Number of solver threads override (0=automatic). Mapped to solver_options.threads by apply_cli_options.
std::optional<std::string> trace_log
Path to a file for SPDLOG_TRACE output (enables trace-level logging). When set, a dedicated file sink is added to spdlog so that all trace-level messages are captured for later review.
std::optional<bool> use_kirchhoff
Enable Kirchhoff voltage-law constraints.
std::optional<bool> use_single_bus
Enable single-bus (copper-plate) mode.

Variable documentation

std::vector<std::string> gtopt::MainOptions::planning_files

Paths to planning JSON files (planning.json).

At least one file is required. When multiple files are given they are merged in order (later files override earlier ones). Each file may be:

  • a full path to a .json file,
  • a stem without extension (the .json suffix is appended), or
  • a directory name (resolved to dir/dir.json).

std::optional<bool> gtopt::MainOptions::recover

Enable recovery from a previous SDDP run.

When true, the JSON recovery_mode setting takes effect (default "full"). When false or unset, recovery_mode is forced to "none" regardless of the JSON configuration — i.e. recovery only happens when the user explicitly passes --recover on the command line.

std::vector<std::string> gtopt::MainOptions::set_options

Repeatable --set key=value overrides.

Each entry is a dotted.path=value string that maps to a field in the Planning options JSON structure. Values are auto-typed: true/false → bool, integers → int, decimals → double, otherwise → string. Applied as a JSON overlay merged into Planning after file parsing but before specific CLI flags.

Example: --set sddp_options.forward_solver_options.threads=8

std::map<std::string, SolverOptions> gtopt::MainOptions::solver_configs

Per-solver default SolverOptions loaded from .gtopt.conf.

Keys are solver names ("cplex", "highs", "clp"). Populated from [solver.cplex], [solver.highs], etc. sections in the config file. The matching entry is overlaid on top of the backend's optimal_options() before applying user-explicit solver_options.