mcframework.backends.ExecutionBackend#
- class mcframework.backends.ExecutionBackend[source]#
Bases:
ProtocolProtocol 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 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:
- sim
MonteCarloSimulation The simulation instance to run.
- n_simulations
int Number of simulation draws to perform.
- seed_seq
SeedSequenceorNone Seed sequence for reproducible random streams.
- progress_callback
callable()orNone Optional callback
f(completed, total)for progress reporting.- **simulation_kwargs
Any Additional keyword arguments passed to
single_simulation.
- sim
- Returns:
np.ndarrayArray of simulation results with shape
(n_simulations,).
- classmethod __new__(*args, **kwargs)#
- __init__(*args, **kwargs)#