BenchmarkResultSink

A destination that receives a benchmark experiment's results as each problem completes rather than in one call at the end.

Why this exists. BenchmarkExperiment.run() builds every problem's result in memory and returns one summary, so a study held its entire output in heap and wrote once. An interruption at hour 30 of a 32-hour run lost all of it — and the checkpointing the class documents works by splitting a study into several experiments over disjoint macro-replication ranges, which does nothing for a study that is a single experiment.

runProblem already completes a problem entirely — cells, confirmation and verification — before the next begins, so the checkpoint boundary exists in the control flow and needs no restructuring to use. Six problems become six checkpoints instead of one, and an interruption costs at most one problem.

Ordering. Exactly one beginExperiment, then zero or more problemCompleted in problem order, then one endExperiment. An interrupted run stops partway and never calls endExperiment, which is how completedProblems can tell an unfinished experiment from a finished one.

Threading. Every call arrives on the thread that invoked run(), serialized between problems. An implementation needs no synchronization of its own.

Inheritors

Functions

Link copied to clipboard
abstract fun beginExperiment(header: BenchmarkSummaryHeader, resume: Boolean = false): Int

Opens a record for the experiment and returns the id that keys every later call.

Link copied to clipboard
open fun completedProblems(expName: String): Set<String>

The names of problems already recorded for an unfinished experiment of this name, which a re-run may therefore skip.

Link copied to clipboard
abstract fun endExperiment(expId: Int, endTime: Instant, solverConfigurations: Map<String, Map<String, String>> = emptyMap())

Closes the experiment's record. After this the experiment counts as finished, and completedProblems stops reporting its problems as resumable.

Link copied to clipboard
abstract fun problemCompleted(expId: Int, result: ProblemBenchmarkResult, traces: Map<String, List<IterationTracePoint>> = emptyMap())

Receives one problem's completed result. Called after the problem's cells, confirmation and verification have all finished, so the result is final and will not be revisited.