-
Notifications
You must be signed in to change notification settings - Fork 7
Setting Up the Optimization Environment for Traffic Assignment Problem
ASU Trans+AI Lab edited this page Nov 6, 2024
·
3 revisions
This guide provides step-by-step instructions for setting up the required environment for running optimization codes using taplite.
- Visit Anaconda's official website and register to receive the installation link via email.
- Download and install Anaconda on your system. If you have an earlier version of Anaconda, pls reinstall the environment and install the latest version to ensure we have a clean base for the following packages.
To set up the necessary Python libraries, follow these steps:
-
Install Ipopt
Go to the Ipopt package page and run:conda install conda-forge/label/cf201901::ipopt
-
Install Pyomo
Go to the Pyomo package page and run:conda install conda-forge::pyomo
-
Install CVXPY
Go to the CVXPY package page and run:conda install conda-forge::cvxpy
- Locate the Python codes for the optimization model at ASU Trans-AI Lab’s GitHub repository.
- Review the following code files:
traffic_assignment_cvxpy.pytraffic_assignment_ipopt.py
- Open Anaconda Navigator.
- Launch the Spyder Python environment.
- In Spyder, open and run the selected code files (
traffic_assignment_cvxpy.pyortraffic_assignment_ipopt.py) to execute the traffic assignment models.
(CVXPY) Nov 03 10:05:30 AM: Problem status: optimal_inaccurate
(CVXPY) Nov 03 10:05:30 AM: Optimal value: 2.040e+04
(CVXPY) Nov 03 10:05:30 AM: Compilation took 1.689e-02 seconds
(CVXPY) Nov 03 10:05:30 AM: Solver (including time spent in interface) took 9.023e-02 seconds
- Flow on link (1, 3): 944.1528 vehicles
- Flow on link (3, 2): 944.1593 vehicles
- Flow on link (1, 4): 48.7980 vehicles
- Flow on link (4, 2): 48.7957 vehicles
Objective value (Total Cost): 20399.6443
- Flow on link (1, 3): 5569.5249 vehicles
- Flow on link (3, 2): 5569.5249 vehicles
- Flow on link (1, 4): 2430.4751 vehicles
- Flow on link (4, 2): 2430.4751 vehicles
Objective value (Total Cost): 197485.3688
- Flow on Path 1 (1->3->2): 5569.5249 vehicles
- Flow on Path 2 (1->4->2): 2430.4751 vehicles
- Travel Time on Path 1 (1->3->2): 31.2760 minutes
- Travel Time on Path 2 (1->4->2): 31.2760 minutes
Minimum Travel Time: 31.2760 minutes
- Gap for Path 1 (1->3->2): 0.0000 minutes
- Gap for Path 2 (1->4->2): 0.0000 minutes
- Weighted Gap for Path 1 (1->3->2): 0.0000 vehicle-minutes
- Weighted Gap for Path 2 (1->4->2): 0.0836 vehicle-minutes
- Total Weighted Gap: 0.0836 vehicle-minutes
Objective value (Total Cost): 197485.3688