The FTOT Network Resilience Tool: Link Rank and Removal (in this repository FTOT-Resilience-Link_Removal) is a modification of the base FTOT program for assessing network routing impacts due to disruption.
See the FTOT homepage for general information about the Freight and Fuel Transportation Optimization Tool (FTOT).
This Network Resilience Tool runs disruptions on an optimal routing solution, removing network links sequentially based on one of two metrics: (1) a network property known as betweenness centrality, or (2) the volume of vehicles on roadway links. The tool assesses how resilient an optimal solution is to the removal of key links in the network.
This tool is compatible and has been tested with FTOT version 2024.4 and will not work with previous versions of FTOT. This tool is compatible only with FTOT scenarios using just the road network and for which Network Density Reduction (NDR) is off. To confirm NDR is off, check the the NDR_On element in the scenario XML file is set to False.
For a walkthrough of setting up and running the tool, please see the Network Resilience Tool tutorial video.
conda
- FTOT code
- FTOT documentation and scenarios
- 10-25 GB free hard disk space
This tool relies on the package management software conda
to install all dependencies for this tool, separate from the standard FTOT requirements.
You need either Anaconda or miniconda installed to activate a conda environment. The full Anaconda installation is recommended for most users.
Download and install FTOT if you haven't already done so, and download the documentation and scenarios.
Run simple_setup.bat
to ensure you have a working Python environment setup for FTOT.
Run Quick Start 1 and Quick Start 2 to verify that the installation is complete.
This tool requires a baseline scenario be run on a modified version of the main FTOT code base. The specific modifications are in ftot_routing.py which is updated in the following ways:
- To not add back in all interstates to the road network before optimizing the routing solution. Without this edit, an FTOT analysis of the road network always includes the national interstate system.
- To use only a 50-mile buffer around the selected area in the routing optimization. This makes the scenario analysis more specific to the local network of the FTOT analysis.
To help ensure fully functional code when running the baseline scenario...
- Go into your installed FTOT directory (e.g.,
C:\FTOT
) and rename the\program
subfolder to\program_original.
- Then go to the downloaded Network Resilience Tool repository and copy the entire
\program
subfolder intoC:\FTOT
. The copied over code files already included the modified version of ftot_routing.py.
As an example baseline scenario, run Reference Scenario 7 using the modified FTOT code. Browse to C:\FTOT\scenarios\reference_scenarios\rs7_capacity
and double-click run_v7.bat
.
The Network Resilience Tool code is written for Python 3.9 and uses a Jupyter notebook to interact with the outputs of FTOT runs, calculate network resiliency metrics, and carry out sequential link removal and recalculation of network performance.
The Python dependencies for this resilience tool are detailed in environment.yml
in the \link_removal
subfolder. The following steps use this reference and assume you have an installation of Python 3.9 and conda.
From your Anaconda Prompt, navigate to the location where you cloned this repository and then navigate to the \link_removal
subfolder and run the following:
conda env create -f environment.yml
You should see FTOTnetworkEnv
show up as an available environment when checking your environments with:
conda info --envs
You only need to create the environment once.
You can then launch Jupyter by the following steps:
conda activate FTOTnetworkEnv
jupyter notebook
If the Jupyter notebook instance launches with a warning about the kernel, you may need to manually select FTOTnetworkEnv
as the kernel to use. If the FTOTnetworkEnv
kernel fails to load, follow these steps to ensure all supporting files are present.
From the Jupyter notebook window, browse to Conduct_Link_Removal.ipynb
to begin this module. Follow the instructions in the notebook.
The final cells in the Conduct_Link_Removal.ipynb notebook generate the HTML report. If these cells error out and you do not see an HTML report pop up in your browser or appear in the disruption folder (located at the same place as your baseline scenario folder), please try the following steps:
- Open a new Anaconda Prompt window and activate the environment by running
conda activate FTOTnetworkEnv
- Navigate to the link_removal subfolder:
cd C:\github\FTOT-Resilience-Link_Removal\link_removal
- Run the following:
Rscript compile_report.R <BASELINE SCENARIO FOLDER> <DISRUPT TYPE>
. For example, for Reference Scenario 7 and disruption type 'V' for volume, runRscript compile_report.R C:\FTOT\scenarios\reference_scenarios\rs7_capacity V
- If successful, the prompt window should print out "Output created: Disruption_Results.html".
- Return to the Conduct_Link_Removal.ipynb, scroll back down to Step 5 and re-run each cell underneath "Step 5" one-by-one by clicking into each cell, then from the top menu bar running Cell > Run Cells. You can alternatively click into each cell and press Ctrl + Enter.
- The report should appear in your browser window and should be saved in the disruption folder.
If needed, reach out to the FTOT team at FTOT-Team@dot.gov for assistance.