SDDPCutStore class
#include <gtopt/sddp_cut_store.hpp>
Thread-safe storage for SDDP Benders cuts (combined + per-scene).
This class owns the cut vectors that were previously data members of SDDPMethod: m_stored_cuts_, m_cuts_mutex_, m_scene_cuts_, and m_scene_cuts_before_. All mutating operations are provided as methods that receive external dependencies (PlanningLP, SDDPOptions, etc.) as parameters.
Constructors, destructors, conversion operators
- SDDPCutStore() defaulted
Public functions
- auto apply_cut_sharing_for_iteration(std::size_t cuts_before, IterationIndex iteration, const SDDPOptions& options, PlanningLP& planning_lp, const LabelMaker& label_maker) -> void
- Apply cut-sharing across scenes for all phases in this iteration.
- auto build_combined_cuts(const PlanningLP& planning_lp) const -> std::vector<StoredCut>
- Build combined stored cuts from per-scene vectors.
- auto cap_stored_cuts(const SDDPOptions& options, const PlanningLP& planning_lp) -> void
- Cap per-scene stored cuts to max_stored_cuts (oldest dropped).
- auto clear() -> void noexcept
- Clear all stored cut metadata (combined + per-scene).
- auto cuts_mutex() const -> auto& noexcept
- Mutex protecting m_stored_cuts_.
- auto forget_first_cuts(int count, PlanningLP& planning_lp) -> void
- Remove the first
countcuts from stored cuts and from the LP. - auto num_stored_cuts(bool single_cut_storage) const -> int noexcept
- auto prune_inactive_cuts(const SDDPOptions& options, PlanningLP& planning_lp, const StrongIndexVector<SceneIndex, StrongIndexVector<PhaseIndex, PhaseStateInfo>>& scene_phase_states) -> void
- Prune inactive cuts from all (scene, phase) LPs.
- auto resize_scenes(Index num_scenes) -> void
- Resize per-scene storage to the given number of scenes.
-
auto save_cuts_for_iteration(IterationIndex iter,
std::span<const uint8_
t> scene_feasible, const SDDPOptions& options, PlanningLP& planning_lp, const LabelMaker& label_maker, const StrongIndexVector<SceneIndex, StrongIndexVector<PhaseIndex, PhaseStateInfo>>& scene_phase_states, int current_iteration) -> void - Save cuts (combined + per-scene) after an iteration.
- auto scene_cuts() const -> const auto& noexcept
- Per-scene cut storage.
- auto scene_cuts() -> auto& noexcept
- Mutable per-scene cuts (for direct iteration access).
- auto scene_cuts_before() const -> const auto& noexcept
- auto scene_cuts_before() -> auto& noexcept
- Per-scene cut count snapshot before backward pass.
- auto store_cut(SceneIndex scene, PhaseIndex src_phase, const SparseRow& cut, CutType type, RowIndex row, bool single_cut_storage, SceneUid scene_uid_val, PhaseUid phase_uid_val) -> void
- Store a cut for sharing and persistence (thread-safe).
- auto stored_cuts() const -> const auto& noexcept
- All stored cuts (combined storage).
- auto stored_cuts() -> auto& noexcept
- Mutable reference to combined storage (for resize in iteration).
- auto update_stored_cut_duals(const PlanningLP& planning_lp) -> void
- Update dual values of stored cuts from the current LP solution.
Function documentation
int gtopt:: SDDPCutStore:: num_stored_cuts(bool single_cut_storage) const noexcept
Number of stored cuts (thread-safe). In single_cut_storage mode, counts across all per-scene vectors.