gtopt::CascadePlanningMethod class

Multi-level solver with configurable LP formulations per level.

Each level can specify LP construction options, solver parameters, and transition rules. The solver automatically rebuilds the PlanningLP when a level's LP options differ from the previous level.

Base classes

class PlanningMethod
Abstract interface for planning problem solvers.

Constructors, destructors, conversion operators

CascadePlanningMethod(SDDPOptions base_opts, CascadeOptions cascade_opts) explicit noexcept

Public functions

auto all_results() const -> const auto& noexcept
Access all iteration results across all cascade levels.
auto level_stats() const -> const auto& noexcept
Access per-level statistics (populated after solve).
auto owned_lps_count() const -> std::size_t noexcept
auto solve(PlanningLP& planning_lp, const SolverOptions& opts) -> std::expected<int, Error> override
Solve the planning problem.

Protected functions

auto build_level_sddp_opts(const std::optional<CascadeLevelMethod>& level_solver, int remaining_budget) const -> SDDPOptions
auto validate_nonanticipative_levels(const SimulationLP& sim, int remaining_budget) const -> std::optional<Error>

Function documentation

std::size_t gtopt::CascadePlanningMethod::owned_lps_count() const noexcept

Number of PlanningLPs owned by the cascade solver. One entry is added per level that required a fresh LP build; level 0 is skipped when the caller-supplied PlanningLP is reused (no model-option overrides from cascade globals or level 0).

std::expected<int, Error> gtopt::CascadePlanningMethod::solve(PlanningLP& planning_lp, const SolverOptions& opts) override

Solve the planning problem.

Parameters
planning_lp The LP model to solve (modified in place)
opts Solver options for individual LP subproblems
Returns Number of scenes processed, or an error

SDDPOptions gtopt::CascadePlanningMethod::build_level_sddp_opts(const std::optional<CascadeLevelMethod>& level_solver, int remaining_budget) const protected

Parameters
level_solver Per-level solver configuration (may be absent).
remaining_budget Global iteration budget remaining (-1 = no cap).

Build SDDPOptions for a level, overriding base with level solver opts. protected (not private) so unit-test subclasses can wrap it via a public test_build_level_sddp_opts shim and pin the 3-layer priority chain (base → cascade-global → per-level) — see test/source/test_cascade_method.cppTestableCascade.

std::optional<Error> gtopt::CascadePlanningMethod::validate_nonanticipative_levels(const SimulationLP& sim, int remaining_budget) const protected

Audit every active level against a nonanticipative scene merge of sim: the level's effective SDDP options (validate_nonanticipative_sddp) and its cut transition. nullopt when nothing conflicts (or there is no merge).