Skip to content

API simulation

github-actions[bot] edited this page Mar 12, 2026 · 2 revisions

simulation Module

class adaptivetesting.simulation.Simulation(test: AdaptiveTest, test_result_output: ResultOutputFormat)

Bases: object

This class can be used for simulating CAT.

Args: : test (AdaptiveTest): instance of an adaptive test implementation (see implementations module) test_result_output (ResultOutputFormat): test results output format

save_test_results()

Saves the test results to the specified output format.

simulate(criterion: StoppingCriterion | list[StoppingCriterion] = StoppingCriterion.SE, value: float | list[float | int] = 0.4)

Runs the adaptive test simulation until the specified stopping criterion or criteria are met.

Args: : criterion (StoppingCriterion | list[StoppingCriterion]): : The stopping criterion or list of criteria to determine when the test should stop. Supported values are StoppingCriterion.SE (standard error) and StoppingCriterion.LENGTH (test length).
value (float | list[float | int]): : The threshold value(s) for the stopping criterion. For SE, this is the maximum allowed standard error. For LENGTH, this is the maximum number of items administered.

class adaptivetesting.simulation.SimulationPool(adaptive_tests: list[AdaptiveTest], test_result_output: ResultOutputFormat, criterion: StoppingCriterion | list[StoppingCriterion] = StoppingCriterion.SE, value: float = 0.4)

Bases: object

A pool manager for running multiple adaptive test simulations in parallel.

Args: : adaptive_tests (list[AdaptiveTest]): List of adaptive test instances to be simulated. test_result_output (ResultOutputFormat): Format for outputting test results. criterion (StoppingCriterion | list[StoppingCriterion]):

Stopping criterion or list of criteria for the simulations.


value (float): Value associated with the stopping criterion (default is 0.4).

start()

Starts the simulation by executing adaptive tests in parallel.

Depending on the operating system, uses either multithreading (on Windows) or multiprocessing (on other platforms) to run the simulation for each adaptive test. Progress is displayed using a progress bar.

adaptivetesting.simulation.setup_simulation_and_start(test: AdaptiveTest, test_result_output: ResultOutputFormat, criterion: StoppingCriterion | list[StoppingCriterion], value: float)

Sets up and runs a simulation for an adaptive test, then saves the results.

Args: : test (AdaptiveTest): The adaptive test instance to be simulated. test_result_output (ResultOutputFormat): The format or handler for outputting test results. criterion (StoppingCriterion | list[StoppingCriterion]):

The criterion used to determine when the simulation should stop.


value (float): : The value associated with the stopping criterion (e.g., maximum number of items, target standard error).

Clone this wiki locally