The Learning Hospital

Experiments in combining Deep Reinforcement Learning (using PyTorch) and Hospital Simulation (using SimPy)

This page contains links to Jupyter Notebooks that experiment with creating hospital simulations (built using using SimPy), and using Deep Reinforcement Learning methods (built using PyTorch) to interact with and manage those simulated hospital environments.

A key aim is to make all simulation models compatible with a RL framework that is very similar to OpenAI Gym ( This includes:

* Using reset() to reset the model. This returns the first state observations.
* Using step() to pass an action to the model. This returns a tuple of new state, reward, is_terminal, info_dict.

The code is fully functional and may be run from the parent GitHub repository using the link to BinderHub. Performance will usually better on your own dedicated machine and the GitHub repository gives instructions for installing the necessary Python libraries.

Here is the GitHub repository:
If this work is of potential interest please contact me at


Solving the ambulance location problem with deep reinforcement learning