ResponseFunctionIfc

One observation of every response at a design point. Implementations are small components in the standard KSL style: they acquire ALL of their randomness at construction time from the stream provider they are built against (typically as random variables with explicit stream numbers, exactly like a simulation model's random variables), and each call to the replication function makes one noisy observation by drawing from those pre-acquired streams.

The construction-time acquisition rule is the reproducibility contract: the oracle that runs the function positions every stream of the provider (reset plus sub-stream advances) before observations are made, which only reaches streams that already exist. Requesting a new stream from the provider during a replication is a contract violation — the oracle detects it and fails loudly rather than silently breaking common random numbers. Apart from consuming its own streams, an implementation must be pure: no other mutable state, so that repeated calls with identically positioned streams reproduce exactly.

Instances are created per concurrent member via ResponseFunctionBuilderIfc — the same fresh-instance-per-member pattern that ksl.simulation.ModelBuilderIfc provides for simulation models. An instance is used by one member at a time (thread-confined).

The ResponseFunctionOracle adapts an implementation to the SimulationOracleIfc seam so that solvers can optimize over it exactly as they optimize over a discrete-event simulation model.

Functions

Link copied to clipboard
abstract fun replication(inputs: Map<String, Double>): Map<String, Double>

Makes one observation of the response function at the supplied design point, drawing all randomness from the streams acquired at construction.