Response Function Oracle
A SimulationOracleIfc over a response function instead of a discrete-event simulation model. Everything above the oracle seam — caching, common random numbers, solution merging, the solvers, and the concurrent execution substrate — is oracle-agnostic, so a cheap synthetic problem (noisy test function, static Monte Carlo model) evaluated through this class exercises exactly the same machinery as an expensive simulation.
Replication semantics mirror the simulation case and ksl.utilities.mcintegration's macro/micro vocabulary: an evaluation request asks for a number of REPLICATIONS at a design point; one replication is one statistical observation of the responses — the average of microRepSampleSize calls of the response function (micro replications). With the default of one micro replication per replication, an observation is a single raw evaluation; larger micro samples give observations the averaged, near-normal character of a simulation replication's within-replication average. The returned ResponseMap summarizes across replications (average, variance, count equal to the requested replications), exactly as the simulation providers summarize replication data. Note that the budget consumed per replication is then microRepSampleSize raw evaluations — studies should report both when the micro sample is not one.
Stream discipline follows the simulation model pattern: the oracle owns a stream provider, builds its response function against that provider at construction (so all of the function's streams exist before any positioning — the ResponseFunctionBuilderIfc contract), and positions ALL of the provider's streams the way SimulationProvider positions a reused model — absolutely, per point (reset to the streams' origins, then advance to the point's sub-stream block computed by the StreamTapePolicy) and one fresh sub-stream per replication. Micro replications within a replication draw consecutively on the replication's sub-stream, like events within a simulation replication. Independent points therefore draw from non-overlapping blocks, the CRN option makes the points of a request share a block (paired draws, per stream — a function with a dedicated stream per randomness source gets source-synchronized CRN), and a per-member initial tape position gives concurrently executing members disjoint randomness. Results depend only on the tape positions, never on request order or grouping.
Contract enforcement: if the response function requests a NEW stream from the provider during evaluation (violating construction-time acquisition), the oracle throws an IllegalStateException naming the violation rather than continuing with a stream that positioning never reached.
Failure mapping matches provider semantics per point: a micro replication that throws, omits a requested response, or produces a non-finite value maps that point to a failed Result; other points in the request are unaffected.
Not thread-safe, by design — the same contract as SimulationProvider. Concurrent execution gives each member its own oracle instance (fresh provider, fresh function, distinct tape offset).
Parameters
the identifier that evaluation requests must carry to be served by this oracle; plays the role of the model identifier of a simulation model
the names of the responses the response function produces; requests may ask for any subset (an empty request set means all of them)
builds this oracle's response function against the oracle's stream provider, acquiring all randomness at construction
the number of response-function evaluations averaged into one replication (one observation); the default of 1 makes an observation a single raw evaluation. Must be at least 1.
the provider this oracle owns and positions; defaults to a fresh provider so that identically configured oracles reproduce each other exactly
the persistent sub-stream tape; supply one with a non-zero initial position to give a concurrent member its own block of randomness
Constructors
Functions
Executes multiple simulations based on the provided evaluation request and maps each request to a corresponding ResponseMap. Each request is processed individually, and the results of the simulations are stored as a key-value pair in the returned map. If the input list is empty, an exception is thrown. This default implementation runs all the requests sequentially based on the order within the evaluation request.