ConsoleSolverStateTracker

class ConsoleSolverStateTracker(solver: Solver, formatStrategy: (SolverStateSnapshot) -> String = ::defaultFormat, lifecycleFormatStrategy: (SolverStatus) -> String? = ::defaultLifecycleFormat) : AbstractSolverStateTracker(source)

A self-terminating tracker that prints optimization progress directly to the console. Useful for real-time monitoring and debugging. Automatically handles lifecycle events to print clear visual boundaries between runs and errors.

  • @param solver The solver to track.

Parameters

formatStrategy

A function that formats a SolverStateSnapshot into a String. Defaults to defaultFormat.

lifecycleFormatStrategy

A function that formats a SolverStatus into a String. If it returns null, nothing is printed for that status. Defaults to defaultLifecycleFormat.

Constructors

Link copied to clipboard
constructor(solver: Solver, formatStrategy: (SolverStateSnapshot) -> String = ::defaultFormat, lifecycleFormatStrategy: (SolverStatus) -> String? = ::defaultLifecycleFormat)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
protected open override fun consume(snapshot: SolverStateSnapshot)

Defines how the concrete tracker handles the mathematical state payload.

Link copied to clipboard
protected open override fun onLifecycleEvent(status: SolverStatus)

Optional hook for subclasses to react to lifecycle changes (e.g., opening/closing files on INITIALIZED/COMPLETED).