Skip to content

Run simulation

Run Simulation

Example script to show how a simulation of the world can be run.

Example script to run a simulation.

Most of this script is the setting up of the simulation, and handling the wide variety of arguments that can be passed to it. See utils/running_stuff.py for more details.

The simulation is handled primarily by the RunManager class in run_manager.py, and the Simulator class in simulator.py.

set_random_seed(seed=999)

Sets global seeds for testing in numpy, random, and numbaised numpy.

Parameters:

Name Type Description Default
seed

(Default value = 999)

999
Source code in example_scripts/run_simulation_2.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
def set_random_seed(seed=999):
    """Sets global seeds for testing in numpy, random, and numbaised numpy.

    Args:
        seed: (Default value = 999)
    """

    @nb.njit(cache=True)
    def set_seed_numba(seed):
        """

        Args:
            seed: 
        """
        random.seed(seed)
        return np.random.seed(seed)

    np.random.seed(seed)
    set_seed_numba(seed)
    random.seed(seed)
    return