FunctionMemberEvaluatorFactory

class FunctionMemberEvaluatorFactory(problemDefinition: ProblemDefinition, responseFunctionBuilder: ResponseFunctionBuilderIfc, microRepSampleSize: Int = 1, substreamBlockSize: Int = ConcurrentRunOptions.DEFAULT_SUBSTREAM_BLOCK_SIZE, solutionCacheFactory: () -> SolutionCacheIfc? = { MemorySolutionCache() }) : MemberEvaluatorFactoryIfc(source)

Provisions per-member evaluators over a response function — the synthetic and static Monte Carlo counterpart of ksl.simopt.solvers.concurrent.PooledMemberEvaluatorFactory. Each member gets its own ResponseFunctionOracle with a private solution cache and a stream tape starting at the member's block offset, so concurrently running members draw from non-overlapping regions of the sub-stream tape regardless of scheduling.

There is nothing expensive to pool (no built models), so every member simply receives fresh resources: a fresh, identically seeded stream provider, a fresh response function built against it (the ResponseFunctionBuilderIfc contract — the same fresh-instance-per-member pattern as a model builder), and a tape at the member's block offset. On release the factory checks the member's tape consumption and logs a warning if the member exceeded its block — that would mean overlap with the next member's block and calls for a larger block size.

The builder is shared across members and invoked concurrently on worker threads, so it must be safe for concurrent calls; the instances it returns are member-private.

Parameters

problemDefinition

the problem the member evaluators serve; the oracle serves the problem's model identifier and its full response-name set

responseFunctionBuilder

builds each member's fresh response function against that member's provider, acquiring all randomness at construction

microRepSampleSize

the number of response-function evaluations averaged into one replication (observation); the default of 1 makes an observation a single raw evaluation — see ResponseFunctionOracle

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.

Constructors

Link copied to clipboard
constructor(problemDefinition: ProblemDefinition, responseFunctionBuilder: ResponseFunctionBuilderIfc, microRepSampleSize: Int = 1, 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.