Concurrent Solver Runner
The engine for concurrent solver execution: runs the member solvers of a concurrent run (parallel random restarts, a solver portfolio) on a bounded dispatcher, each with its own factory-provisioned evaluation resources, and hands their results back in deterministic member order.
Execution model:
launchAll starts every member as a coroutine on a dispatcher bounded by the worker count; excess members queue and run as workers free up. Non-blocking.
awaitMember blocks until the given member completes and returns its result. Owners that report per-member progress await members in submission order, which makes tracker output and best-solution evolution deterministic regardless of which member happens to finish first.
requestStop forwards a graceful stop to every in-flight member solver (each checks its stop flag between its own iterations) and prevents queued members from starting. Safe to call from any thread; idempotent.
Determinism contract: every member's inputs (starting point, stream block, solver streams) are fixed at launch time and independent of scheduling, and results are consumed in member order — so for a fixed seed setup the run's results do not depend on the worker count or thread timing.
Failure discipline mirrors the parallel evaluation provider: a member that throws yields a failed SolverMemberResult carrying the problem's bad solution; sibling members are unaffected. Cooperative cancellation exceptions propagate.
Thread-safety expectations on shared problem objects: members share the (read-only) problem definition. Its configuration must not be mutated while a run is in flight, and any custom penalty functions attached to the problem's constraints must be stateless (pure functions of their arguments, like the library-provided ones) — members evaluate penalized objective values concurrently, so a penalty function that keeps internal mutable state would race.
Parameters
the problem all members solve; supplies the bad solution for failed or never-started members
the members to run, in order; labels must be unique
provisions each member's private evaluation resources
the maximum number of members running at the same time; null uses the smaller of the member count and the available processors
Constructors
Properties
Functions
Blocks until every member completes and returns all results in member order.
Blocks until the member with the given index completes and returns its result. The await establishes the happens-before ordering that makes the member's solver state safe to read from the calling thread.
Requests a graceful stop of the whole run: members that have not started will not start, and every in-flight member solver is signaled via its stopIterations mechanism, so it exits after its current iteration. Idempotent; safe from any thread.