Run Summary Writer
Writer + builder for RunSummary.
All builders are pure functions over the inputs so callers can exercise the projection without filesystem access; write is the only filesystem-touching call.
The TOML encoder delegates to tomlkt with explicitNulls = false, so optional fields with null values are omitted from the encoded file rather than rendered as key = null lines. Round-trip decoding through decode is symmetric — a missing key takes the property's declared default.
Substrate-level API — usable by any UI shell (Swing, web, CLI, text) that wants to materialise an optimization run summary.
Functions
Round-trip decoder. Lets downstream tooling (a future "compare runs" view, batch result inspection, etc.) load a summary.toml back into the typed model without writing its own parser.
Serialise summary to a TOML string, prefixed with the DOCUMENT_HEADER banner. Field order matches the declaration order on RunSummary; per-field @TomlComment annotations are emitted as # lines above each key, making the file self-documenting for anyone cracking it open in a text editor.
Build a RunSummary from a successful run. solverInstance is the live Solver reference captured before the host cleared its handle — its Solver.configurationProperties are projected into the summary's solverConfiguration field for the [solverConfiguration] TOML block. runDir is the run- output directory path; its leaf name becomes the human- friendly RunSummary.runDirectory identifier.
Build a partial RunSummary for a run that did not complete successfully. latestBest is the best-so-far data the host captured from the last IterationCompleted event; it may be null if the run aborted before any iteration fired.