Done sets the length of your simulation. In reinforcement learning terminology, the length of your simulation is also known as an "episode" (more details here).

By default, Pathmind automatically ends an episode when your simulation is finished. In AnyLogic terminology, this is when getEngine().getState() == Engine.State.FINISHED.

Here are a couple of ways in which you can end a simulation.

Model Time

You can opt to set a "stop" time in your simulation properties. In the example below, the simulation is set to run for one year.


You can also end your simulation when a goal is reached. To do so, call finishSimulation(); anywhere in your AnyLogic model whenever the objective is met.

Never Ending

In some cases, you may want your simulation to run indefinitely. To do so, set your "stop" time to "never". Pathmind will automatically end the episode after 20,000 steps (i.e. actions triggered) in this scenario.


Shorter episodes tend to be better as they provide faster feedback, which helps the reinforcement learning algorithm learn. We strongly recommend limiting episodes to less than 5,000 steps at most.

Follow these instructions to audit your episode length.

Did this answer your question?