Trapezoidal rule and ad hoc optimization

Problem from transportation engineering (user-equilibrium)

Steven R. Woodruff - Winter 2021 - CEE 303 - Computational methods

Problem setup

image.png

When designing roadways between an origin and a destination, transportation engineers must predict how traffic will naturally distribute itself across all available routes. One theory that predicts how drivers will choose their routes is called user-equilibrium. The underlying idea behind user-equilibrium is that each driver will choose the route the minimizes the amount of time they must spend on the road to get to their destination.

For each route between an origin and destination pair, the time required to travel that route depends on the traffic volume (or traffic congestion). This function is,

$$ t_i(v_i) = \dfrac{L_i}{s_i}\left[1 + \alpha_i\left(\dfrac{v_i}{c_i}\right)^{\beta_i}\right], $$

where $t_i$ is the time required to travel a route [hr] as a function of the traffic volume on that route $v_i$ [vehicles/hr], $L_i$ is the length of the route [mi], $s_i$ is the average speed vehicles travel at without any traffic (the speed limit) [mph], $c_i$ is the maximum vehicle capacity of a route [vehicles/hr], and $\alpha_i$ and $\beta_i$ are dimensionless parameters that ensure the traffic fits the model (the values are determined by observing traffic patterns in field tests).

Suppose you are a traffic engineer designing a new highway that connects Ann Arbor to Detroit. Currently, there are two main highways that connect the cities (called Route 0 and Route 1). The new highway (Route 2) will reduce the amount of traffic on the existing routes. Your job is to determine how the traffic will be distributed on the three routes using user-equilibrium.

The parameters that describe the travel time for each route are given below:

Route parameters Route 0 Route 1 Route 2
Route length, $L_i$ [mi] 43 44.9 40
Free-flow speed, $s_i$ [mph] 60 55 60
Traffic capacity, $c_i$ [veh/hr] 900 800 850
1st fitting parameter, $\alpha_i$ 0.15 0.2 0.25
2nd fitting parameter, $\beta_i$ 2 3 2

The traffic distribution will satisfy the following objective function:

$$ \min z(v_0) = \sum_{i=0}^2 \int_0^{v_i} t_i(\omega) \; d\omega $$

subject to,

$$ \sum_{i=0}^2 v_i = 1800 \; \text{[veh/hr]} $$$$ v_1 = 0.8v_0 $$$$ v_i \geq 0,\; i = 0, 1, 2 $$

You need to find the value of $v_0$ that minimizes $z(v_0)$ within the acceptable range of values for $v_0$ (as determined by the problem constraints). Once you have the optimal value of $v_0$, you will need to find the time required to travel across each route (by plugging $v_0$ into $t_i$, for $i = 0, 1, 2$). To accomplish this task, do the following:

  1. Create a function in Python which returns the travel time of a route ($t_i$) with respect to traffic volume ($v_i$) for each of the three routes. Indicate the location of this function(s) in your report.
  2. Create a Python function that performs trapezoidal integration over a given function. The inputs of your integration function should be the points where the function is evaluated and the values of the function at those points (i.e., x and f(x), respectively). Indicate the location of this function in your report.
  3. Create a Python function that calculates the value of $z(v_0)$ using your route travel time functions and your integration function. You should be able to express $v_1$ and $v_2$ in terms of $v_0$ and $v_{tot} = 1800$ [veh/hr]. You should integrate the objective function every 0.1 [veh/hr] ($dv_0 = 0.1$ [veh/hr]). Indicate the location of this function in your report.
  4. Plot your $z(v_0)$ curve, and compare your result with the analytical solution below. Show this plot in your report. (Note: you do not need to indicate units for $z(v_0)$ or $z_{\text{ana}}(v_0)$) $$$$$$ z_{\text{ana}}(v_0) = \dfrac{449 v_0^4}{1.375\times 10^{13}} - \dfrac{567721 v_0^3}{1.40454\times 10^{12}} + \dfrac{243 v_0^2}{180625} - \dfrac{5605711 v_0}{4.7685\times 10^6} + \dfrac{4.764\times 10^5}{289} $$$$$$
  5. Using the Python min() function and the np.where() function, determine the minimum value of $z(v_0)$ and the corresponding value of $v_0$ that gives the minimal result. Report the values of $v_0$, $v_1$, and $v_2$ that minimize $z(v_0)$ to the nearest whole number (in [veh/hr]).
  6. Plug your results from Problem 5 into the travel time functions to determine the amount of time required to travel each route under equilibrium. Report your time in the nearest whole minute, and confirm that adding the new route will keep traffic volume below 90% capacity for each route.

Perform all calculations and make all plots using Python. Make sure you watch the lab module videos for tips on how to integrate using symbolic bounds and how to use the min() and np.where() functions.