attach To
Attach every tracker requested by this SolverTrackingSpec to solver.
Dispatch summary:
When SolverTrackingSpec.enableCsvTrace is
true, one CSV tracker is attached:a CsvSolverStateTracker when solver is a plain ksl.simopt.solvers.Solver;
a NestedCsvSolverStateTracker when solver is a RandomRestartSolver — its
restartingSolverbecomes the micro solver so the CSV interleaves MACRO + MICRO rows. The single-vs-nested choice is made at attachment time and is not persisted in the spec.When SolverTrackingSpec.enableConsoleTrace is
true, a ConsoleSolverStateTracker is additionally attached. The substrate has no nested-console variant, so the console tracker listens to the outer (macro) solver in the restart case — its per-iteration output is still useful as a heartbeat, just less granular than the CSV.
Every attached tracker has its experimentName set to SolverTrackingSpec.experimentLabel before startTracking() is called, so the value is stamped on every emitted row in the tracker's ExperimentName column.
The CSV file name is <stem>.csv under optimizationDir, where stem is SolverTrackingSpec.csvFileName when non-null and the result of defaultFileName otherwise. Typical callers pass { "${solver.name}_trace" } for the fallback.
optimizationDir must exist when this function is called; the caller is responsible for Files.createDirectories(...) upstream.
Return
a SolverTrackerHandles holding references to every attached tracker so the caller can detach them via SolverTrackerHandles.stopAll at the end of the run
Parameters
the live solver instance to attach trackers to
directory under which the CSV trace file is written (must exist)
invoked only when SolverTrackingSpec.csvFileName is null; should return a bare file stem (no extension, no path)