mcframework.backends.SequentialBackend#

class mcframework.backends.SequentialBackend[source]#

Bases: object

Sequential (single-threaded) execution backend.

Executes simulation draws one at a time on the main thread. Suitable for small simulations or debugging.

Examples

>>> backend = SequentialBackend()
>>> results = backend.run(sim, n_simulations=1000, seed_seq=None, progress_callback=None)

Methods

run

Run simulations sequentially on a single thread.

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 simulations sequentially on a single thread.

Parameters:
simMonteCarloSimulation

The simulation instance to run.

n_simulationsint

Number of simulation draws to perform.

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)#