PooledMemberEvaluatorFactory

class PooledMemberEvaluatorFactory(problemDefinition: ProblemDefinition, modelBuilder: ModelBuilderIfc, modelConfiguration: Map<String, String>? = null, baseRunParameters: ExperimentRunParametersIfc? = null, substreamBlockSize: Int = ConcurrentRunOptions.DEFAULT_SUBSTREAM_BLOCK_SIZE, solutionCacheFactory: () -> SolutionCacheIfc? = { MemorySolutionCache() }) : MemberEvaluatorFactoryIfc(source)

The standard member-evaluator provisioner: each member gets its own sequential SimulationProvider over a pooled, silenced model, with a private solution cache and a stream tape starting at the member's block offset.

Model pooling mirrors ParallelSimulationProvider: models are borrowed from a concurrent queue and built fresh only when the pool is empty, so the number of builds settles at the worker count rather than the member count. Because every simulation run positions its streams absolutely (reset plus advance, driven by the member's tape policy) and run parameters are restored after each request, a reused model behaves identically to a fresh one. A member that fails mid-run has its model discarded rather than returned to the pool.

Stream independence across members (and reproducibility regardless of scheduling) comes from deterministic block partitioning of the sub-stream tape: member k's tape starts at k times substreamBlockSize. On release the factory checks the tape's final position and logs a warning if the member consumed more than its block — that would mean overlap with the next member's block and calls for a larger block size.

The supplied model builder MUST return an independent, freshly built model on each call (the same contract as ParallelSimulationProvider).

Parameters

problemDefinition

the problem the member evaluators serve; validated for input/response compatibility against the first built model

modelBuilder

builds a fresh model per call; must yield independent instances

modelConfiguration

opaque configuration forwarded to the model builder

baseRunParameters

run parameters applied when building models; when null the builder's defaults apply

substreamBlockSize

the per-member sub-stream block; see ConcurrentRunOptions

solutionCacheFactory

creates each member's private solution cache; return null for no caching. The default creates a fresh in-memory cache per member, which makes "clear the cache between runs" structural: each member's cache is born empty and dies with the member.

Constructors

Link copied to clipboard
constructor(problemDefinition: ProblemDefinition, modelBuilder: ModelBuilderIfc, modelConfiguration: Map<String, String>? = null, baseRunParameters: ExperimentRunParametersIfc? = null, substreamBlockSize: Int = ConcurrentRunOptions.DEFAULT_SUBSTREAM_BLOCK_SIZE, solutionCacheFactory: () -> SolutionCacheIfc? = { MemorySolutionCache() })

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun createEvaluator(memberIndex: Int): EvaluatorIfc

Creates the private evaluator for the member with the given index. Called once per member, on the member's worker thread, before the member's solver is created.

Link copied to clipboard
open override fun release(memberIndex: Int, evaluator: EvaluatorIfc, reusable: Boolean)

Releases the member's evaluator resources after the member finished (successfully or not). Called exactly once per successful createEvaluator call, on the member's worker thread.