OptimizationTrackerAttacher

Attach CSV / console trackers to a Solver per the host's SolverTrackingSpec.

Distinguishes plain solvers from RandomRestartSolver wrappers and instantiates the right tracker variant for each (CsvSolverStateTracker vs. NestedCsvSolverStateTracker, ConsoleSolverStateTracker vs. NestedConsoleSolverStateTracker). Creates the trace file's parent directory lazily so a tracking- disabled run leaves no empty run-NNN/ behind.

Each individual tracker attach is best-effort — a single failure (e.g. a read-only filesystem at the trace file's parent) doesn't abort the others or the run itself. Use TrackerAttachResult flags when you need to know what landed.

Substrate-level API — any UI shell can attach trackers consistently from a captured Solver reference + the host's current SolverTrackingSpec.

Types

Link copied to clipboard
data class TrackerAttachResult(val csvAttached: Boolean, val consoleAttached: Boolean)

Per-tracker success flags. Both fields are false when the corresponding tracker was not requested by the spec — i.e. "skipped" and "failed" are indistinguishable in the result. Use SolverTrackingSpec.enableCsvTrace / enableConsoleTrace to disambiguate if needed.

Functions

Link copied to clipboard
fun attach(solver: Solver, trackingSpec: SolverTrackingSpec, runDir: Path, solverSpec: SolverSpec? = null): OptimizationTrackerAttacher.TrackerAttachResult

Attach the requested trackers to solver.