Monte Carlo Simulations in Pathfinder

Pathfinder 2018.3 will include basic monte carlo simulation tools to automate multiple simulations where the initial positions and properties of occupants are randomized. This post demonstrates this capability.


Pathfinder uses profiles to assign parameters to occupants. A typical use of profiles is to define walking speeds by age and gender, for examples see Fruin (Pedestrian Planning and Design, 1987) and International Maritime Organization (Revised Guidelines for Evacuation Analysis for New and Existing Passenger Ships, 2016). Other common Pathfinder parameters that are given statistical distributions include occupant size and initial orientation. In Pathfinder the specific values for each occupant are defined when the occupant is created. The user can manually generate new random values by selecting occupants and clicking Randomize

Occupant positions within a room are also defined when occupants are created. The user can manually generate new random positions for occupants by selecting a room and clicking Randomize Occupants’ Positions.

Monte Carlo Simulation Using Scripts

Pathfinder 2018.3 will include scripts to simplify monte carlo simulation. The main script opens the Pathfinder file, runs the Randomize and Randomize Occupants’ Positions functions, and writes a new Pathfinder input file with the randomized data. It repeats this the specified number of times.

You can either watch the following video, created by Charlie Thornton, that describes the process or follow the steps listed below. Note that in the video the script name is xFactorChi.bat. In the Pathfinder release, this name has been changed to montecarlo_createcases.bat

To prepare to run the scripts, install gnuplot. This is for convenience only. The scripts create gnuplot command files and you can make plots by running gnuplot with the command files as input. However, the plot data is available in the command files so you directly access the data and plot using a different package.

To run the scripts:

  • Go to the folder with the Pathfinder model. The Pathfinder model is just a normal Pathfinder model with the relevant profile parameters defined by statistical distributions. 
  • Open a command window in that folder and run the montecarlo_createcases.bat file, giving the Pathfinder model name and the number of monte carlo runs you want to perform. The montecarlo_createcases.bat file is located in the Pathfinder install folder, so you would typically type the text shown below. The text within the quotes executes the batch file, while gs.pth is the Pathfinder file and 20 is the number of monte carlo simulations. Change the Pathfinder file name and number of simulations to match your situation.

  • When the batch file finishes execution, there will be a new variations folder (gs_variations) that contains the monte carlo cases and two new batch files.
  • Go to the variations folder and double-click _run.bat. This will start Pathfinder which will run all the cases.
  • When Pathfinder has finished running the cases, double-click _make_plots.bat. This will create two plot files Completion Times for All Occupants (s).plt and Travel Distances for All Occupants (m).plt. These two files are the gnuplot command files. They contain the plot data that has been extracted from the summary files for each run.
  • To run gnuplot, double-click on a plt file. You can save the plot by clicking Save graph as EMF

Download Input Files

You can download the input files used in this post.


We invite comments on improvements we can make to this basic capability. Send comments to


See all Pathfinder tutorials