Run Result
Terminal outcome of a simulation run, returned by RunHandle.result.await().
All variants are normal completions of the underlying kotlinx.coroutines.Deferred — await() never throws. Consumers use a when expression to branch on the outcome rather than try/catch:
when (val r = handle.result.await()) {
is RunResult.Completed -> showResults(r.snapshot)
is RunResult.BatchCompleted -> showBatchResults(r.snapshots)
is RunResult.OptimizationCompleted -> showOptResults(r.bestSolution, r.iterationHistory)
is RunResult.Cancelled -> showCancelled(r.reason)
is RunResult.Failed -> showError(r.error)
}The last event on RunHandle.events mirrors this outcome: RunEvent.RunCompleted, RunEvent.RunCancelled, or RunEvent.RunFailed.
Inheritors
Types
A scenario sweep or designed experiment finished. Every successfully completed scenario or design point contributes one SimulationSnapshot.ExperimentCompleted to snapshots; the list is non-empty on a clean run.
The run was stopped by an explicit call to RunHandle.cancel.
A single-model run finished normally (all requested replications ran, or the model ended itself via endSimulation()).
The run was terminated by an unexpected exception during replication execution.
A simulation-optimization run finished. Carries the solver's best solution and the full per-iteration history for convergence analysis.