ambulance_simulation.initialize_simulation#
- ambulance_simulation.initialize_simulation(SIMULATION_PARAMETERS: dict[str, Any], SIMULATION_DATA: dict[str, Any]) tuple[numpy.ndarray, dict[str, numpy.ndarray], list[ambulance.Ambulance], dict[str, dict[str, list[simpy.resources.resource.Resource | float]]], simpy.core.Environment, numpy.ndarray, collections.deque]#
Initializes all data and required objects of the simulation.
Note that the
SIMULATION_DATAdataframe will contain the data that is initialized.- Parameters:
SIMULATION_PARAMETERS (dict[str, Any]) – The simulation parameters. The parameters
DATA_DIRECTORY,TRAVEL_TIMES_FILE,DISTANCE_FILE,NODES_FILE,HOSPITAL_FILE,BASE_LOCATIONS_FILE,AMBULANCE_BASE_LOCATIONS_FILE,CHARGING_SCENARIO_FILE,LOAD_INPUT_DATAandPRINTare at least necessary. If no historical data is used, the parametersPROB_GO_TO_HOSPITAL,CRN_GENERATOR,SEED_VALUE,CALL_LAMBDA,PROCESS_TYPE,PROCESS_NUM_CALLS,PROCESS_TIME,AID_PARAMETERS,DROP_OFF_PARAMETERSare also necessary. If historical data is used, the parametersINTERARRIVAL_TIMES_FILE,ON_SITE_AID_TIMES_FILE,DROP_OFF_TIMES_FILE,LOCATION_IDS_FILEandTO_HOSPITAL_FILEare also necessary. Note that methods that are called within this method may require more parameters. Seemain.pyfor parameter explanations.SIMULATION_DATA (dict[str, Any]) – The simulation data.
DATA_COLUMNS_PATIENTandDATA_COLUMNS_AMBULANCEare at least necessary. Seemain.pyfor explanations. Note that methods that are called within this method may require more data.
- Raises:
Exception – If invalid input parameters are detected.
- Returns:
location_IDs (np.ndarray) – Contains the initial location IDs of the patients.
simulation_times (dict[str, np.ndarray]) – Contains the interarrival times, the on-site aid times and the drop-off times.
ambulances (list[Ambulance]) – A list of initialized ambulances.
charging_stations (dict[str, dict[str, list[sp.resources.resource.Resource | float]]]) – The charging stations resources at all bases and all hospitals together with their charging speeds.
env (sp.core.Environment) – The SimPy environment.
to_hospital_bool (np.ndarray) – Specifies for each patient whether transportation to the hospital is required or not.
patient_queue (collections.deque) – The patient queue.