SolverOptions struct
#include <gtopt/solver_options.hpp>
Configuration options for linear programming solvers.
The SolverOptions structure contains parameters that control how linear programming problems are solved, including algorithm selection, parallel processing settings, numerical tolerances, and logging preferences.
The three tolerance fields (optimal_eps, feasible_eps, barrier_eps) are optional: when they are std::nullopt the solver keeps its built-in default values instead of overriding them.
Public functions
- auto merge(const SolverOptions& other) -> void
- Merge another SolverOptions into this one (first-value-wins for optional fields).
- auto overlay(const SolverOptions& user) -> void
- Overlay user-supplied options on top of backend defaults.
Public variables
- LPAlgo algorithm
- The solution algorithm to use (default_algo = use backend optimal)
- std::optional<double> barrier_eps
- Convergence tolerance for barrier algorithm (nullopt = use solver default)
- std::optional<double> feasible_eps
- Feasibility tolerance for constraints (nullopt = use solver default)
- int log_level
- Verbosity level for solver output (0 = none)
- std::optional<SolverLogMode> log_mode
- Controls solver log file generation.
- int max_fallbacks
- Maximum algorithm fallback attempts on non-optimal solve.
- std::optional<double> optimal_eps
- Optimality tolerance for solution (nullopt = use solver default)
- bool presolve
- Whether to apply presolve optimizations (default: true)
- bool reuse_basis
- Enable basis-reuse optimizations for resolve on cloned LPs.
- std::optional<SolverScaling> scaling
- Solver-internal scaling strategy.
- int threads
- Number of parallel threads to use (0 = use backend optimal)
- std::optional<double> time_limit
- Time limit for individual LP solves in seconds. 0 = no limit (solver default). When non-zero, the solver will abort the current solve if the wall-clock time exceeds this value. The caller should check
is_optimal()after solve to detect timeouts.
Function documentation
void gtopt:: SolverOptions:: merge(const SolverOptions& other)
Merge another SolverOptions into this one (first-value-wins for optional fields).
Only the optional tolerance / limit fields are merged; the non-optional fields (algorithm, threads, presolve, log_level) are not changed by merge — they keep their already-set values.
void gtopt:: SolverOptions:: overlay(const SolverOptions& user)
Overlay user-supplied options on top of backend defaults.
Start from backend optimal defaults (this), then apply any user option that is not at its sentinel/default value. User settings always win over backend defaults.
Sentinels: algorithm=default_algo, threads=0, log_level=0, max_fallbacks=2, presolve=true, reuse_basis=false. Optional fields: has_value() means user specified.
Variable documentation
std::optional<SolverLogMode> gtopt:: SolverOptions:: log_mode
Controls solver log file generation.
nolog: No log files written (default).detailed: Separate log file per scene/phase/aperture, named<solver>_sc<N>_ph<N>[_ap<N>].log.
int gtopt:: SolverOptions:: max_fallbacks
Maximum algorithm fallback attempts on non-optimal solve.
When a solve returns non-optimal, the solver cycles through alternative algorithms (barrier → dual → primal → barrier) up to this many times. 0 = no fallback (fail immediately). Default: 2 (try all three algorithms).
bool gtopt:: SolverOptions:: reuse_basis
Enable basis-reuse optimizations for resolve on cloned LPs.
When true, set_solver_opts() overrides the algorithm to dual simplex and disables presolve — both critical for basis-reuse resolves. This is especially important when the original LP was solved with barrier: barrier solutions carry no simplex basis, so resolving a clone with barrier would restart from scratch, whereas dual simplex can pivot from the crossover basis in a few iterations.
On CLP, additional specialOptions bits are set to retain the factorization and work arrays from the cloned LP.
std::optional<SolverScaling> gtopt:: SolverOptions:: scaling
Solver-internal scaling strategy.
Controls how the LP solver scales the constraint matrix before solving. When nullopt, the solver keeps its built-in default.