Agent based simulation to optimise emergency departments