pub struct DiagnosticsState {
pub config: DiagnosticsConfig,
/* private fields */
}Expand description
Live state threaded through the solve via Rc. The IPM mutates
current_iter and solves_this_iter; the dump sites read them.
All fields use atomics so the type is Send + Sync even though
the solver itself is single-threaded — keeps the door open for
future parallel inner solvers without an ABI rewrite.
Fields§
§config: DiagnosticsConfigImplementations§
Source§impl DiagnosticsState
impl DiagnosticsState
Sourcepub fn new(config: DiagnosticsConfig) -> Result<Self>
pub fn new(config: DiagnosticsConfig) -> Result<Self>
Create a state and mkdir -p the dump directory. Failure to
create the directory bubbles up so the CLI can exit with a
clear error before the solve even starts.
Sourcepub fn want(&self, cat: DiagCategory) -> bool
pub fn want(&self, cat: DiagCategory) -> bool
True if the caller should dump cat at the current iter.
Sourcepub fn bump_iter(&self)
pub fn bump_iter(&self)
Advance the outer-iteration counter and reset the per-iter
solve index. Called by IpoptAlgorithm::optimize at the top
of each outer iteration.
Sourcepub fn next_solve_index(&self) -> i32
pub fn next_solve_index(&self) -> i32
Reserve the next per-iter solve index. Returned value is
1-based to match the filenames (kkt_solve_001.jsonl).
Sourcepub fn enter_restoration(&self)
pub fn enter_restoration(&self)
Mark the start of a restoration sub-IPM run. parent_iter is
the outer iter that triggered restoration; dumps from the
resto sub-solve land under resto/parent_iter_NNN/iter_MMM/.
pub fn exit_restoration(&self)
pub fn current_iter(&self) -> i32
Sourcepub fn iter_dir(&self) -> Option<PathBuf>
pub fn iter_dir(&self) -> Option<PathBuf>
Resolve the directory a category’s dump file should live in,
creating it if necessary. Returns None if the directory
cannot be created (e.g., filesystem full) — callers should
silently skip the dump in that case rather than fail the
solve.
Sourcepub fn open_writer(&self, filename: &str) -> Option<BufWriter<File>>
pub fn open_writer(&self, filename: &str) -> Option<BufWriter<File>>
Open a writer for <iter_dir>/<filename>. Caller picks the
filename so callers that produce multi-solve traces can use
next_solve_index to disambiguate.
Sourcepub fn write_top_level(&self, filename: &str, contents: &str) -> Result<()>
pub fn write_top_level(&self, filename: &str, contents: &str) -> Result<()>
Write a one-shot top-level file (manifest, timing summary).
Always lands directly under dump_dir, never under an iter
sub-directory.