attachTo

fun SolverTrackingSpec.attachTo(solver: Solver, optimizationDir: Path, defaultFileName: () -> String): SolverTrackerHandles(source)

Attach every tracker requested by this SolverTrackingSpec to solver.

Dispatch summary:

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

solver

the live solver instance to attach trackers to

optimizationDir

directory under which the CSV trace file is written (must exist)

defaultFileName

invoked only when SolverTrackingSpec.csvFileName is null; should return a bare file stem (no extension, no path)