PhaseGridRecorder class
#include <gtopt/sddp_common.hpp>
Public functions
Function documentation
void gtopt:: PhaseGridRecorder:: record(IterationUid iteration_uid,
SceneUid scene_uid,
PhaseUid phase_uid,
GridCell state)
Record a phase activity. Higher-priority states overwrite lower ones.
All three identifiers are stored as UIDs — the recorder never performs arithmetic on them and never assumes a particular numeric layout. Internally, per-row activity is held in a std::map<PhaseUid, char> keyed by PhaseUid; to_json() emits the inner map in sorted-UID order, so the resulting "cells" string positions correspond to the natural PhaseUid ordering (typically 1-based contiguous, but the recorder no longer depends on that — it only requires that PhaseUid::operator< gives the desired column order).
std::string gtopt:: PhaseGridRecorder:: to_json() const
Return a snapshot of the grid as a JSON fragment (no trailing comma). Format: "phase_grid": {"rows": [{"i":0,"s":0,"cells":"FF.FB..."}, ...]} Cells are emitted in PhaseUid-sorted order, with '.' filling any missing UID slot in [first_uid, last_uid] so the position of each character corresponds to its PhaseUid offset from the minimum UID seen for the row.