mcframework.backends.ExecutionBackend#

class mcframework.backends.ExecutionBackend[source]#

Bases: Protocol

Protocol defining the interface for execution backends.

Backends are responsible for executing simulation draws and returning results. They handle the details of sequential vs parallel execution, thread vs process pools, and progress reporting.

Methods

run

Run simulation draws and return results.

run(sim: MonteCarloSimulation, n_simulations: int, seed_seq: np.random.SeedSequence | None, progress_callback: Callable[[int, int], None] | None, **simulation_kwargs: Any) np.ndarray[source]#

Run simulation draws and return results.

Parameters:
simMonteCarloSimulation

The simulation instance to run.

n_simulationsint

Number of simulation draws to perform.

seed_seqSeedSequence or None

Seed sequence for reproducible random streams.

progress_callbackcallable() or None

Optional callback f(completed, total) for progress reporting.

**simulation_kwargsAny

Additional keyword arguments passed to single_simulation.

Returns:
np.ndarray

Array of simulation results with shape (n_simulations,).

classmethod __new__(*args, **kwargs)#
__init__(*args, **kwargs)#