usyed3/TransportBench huggingface dataset:
Problem: Consider an idealized bi-directional loop line system (i.e., zero headway, zero dwell time at stops, and constant cruising speed), where trip origins/destinations are uniformly distributed in the area. All the stations are placed evenly on square lattices, and their spacing is always chosen to minimize the average walking and riding time. By approximately what percentage would the optimal station spacing change if single-direction service is provided instead?
Solution: The optimal station spacing change approximately by $\sqrt{2}-1\approx$+40\% if single-direction service is provided instead of bi-directional loop line system.
Problem: Suppose the Vickrey equilibrium is always reached around a congested bridge during commuter morning rush hour (say, 7 am to 9 am), suggest a solution that can reduce the maximum length of the queue?
Solution: A carpool or transit platform adopted by some of the commuters will potentially reduce the maximum length of the queue.

Increase the capacity of the bridge.

Another option is to stagger the wished arrival times of the commuters.
Problem: In a grid transit network, for realistic analysis/design, how does the optimal stop spacing change if we optimize the average passenger travel time instead of the worst-case passenger travel time? Quantify the change.
Solution: The optimal stop spacing change by $\sqrt{2}-1=$+40\% if we optimize the average passenger travel time instead of the worst-case passenger travel time.\\
Problem: Suppose we are designing a hybrid transit network with a grid central area and a hub-and-spoke periphery. Assume all buses have the same headway $H$, bus schedules are not synchronized to provide timed transfers, and passengers have appointments at their destination. What is the worst possible total waiting time for the most unlucky passenger?
Solution: The worst possible total waiting time for the most unlucky passenger will be $4H$ (one each, at the origin station, 2 transfer stations, and the destination station).
Problem: Considering the “Vickery Equilibrium”, which of the following statement(s) is (are) false?

\begin{enumerate}
    \item The wish curve is built based on travelers’ wished times to arrive at the bottleneck.
    \item The equilibrium conditions indicate that no driver is better off by unilaterally changing their arrival time at the bottleneck.
    \item The driver who arrives at the bottleneck last may experiences the largest in-vehicle delay time.
    \item As the wish curve becomes highly non-linear, there will always be only one critical driver (one who arrives at its destination as wished)
\end{enumerate}
Solution: The last (4th) statement is false.
Problem: A transit agency is trying to minimize the worst-case travel time while constrained to a given budget. Find the optimal spacing s of the following problem. Use $ \alpha=10,\,\ \beta=40,\,\ \gamma=5 \text{ and } M=5$.

\begin{equation*}
\begin{aligned}
\min_{s} \quad & \frac{\alpha}{s} + \beta s 
 \textrm{s.t.} \quad &  \frac{\gamma}{s} \leq M 
  & s \geq 0    
 \end{aligned}
\end{equation*}
Solution: The convex objective function has a minimum at $s = 0.5$, but that violates the constraint. Therefore, the optimal spacing is at the boundary $s^*=1$.
Problem: A city with a ring-radial street network has its CBD at the center. The CBD radius is $r$. A fraction p of the CBDs area is occupied by skyscrapers, each with $n$ floors. The average space per employee is $a$, the street spacing is $s$, the street's traffic capacity is $q$, and the vehicle occupancy is $k$. Derive an estimate of the duration of the morning rush hour based on the number of morning commuters, and the roadway capacity around the CBD perimeter.
Solution: The total number of commuters can be expressed as \(\frac{pn\pi r^2}{a}\). The maximum number of people able to enter the CBD in one hour is \(\frac{qk2\pi r}{s}\).

If we denote by \(T\) the duration of the rush hour, then the following relationship approximately holds:

\[
\frac{pn\pi r^2}{a} \approx \frac{qk2\pi r}{s} T
\]

Thus,

\[
T = \frac{spnr}{2qka}
\]

i.e. \(T\) is linear with respect to each one of \(p\), \(n\), and \(r\).
Problem: How do you think autonomous buses will change the current transit systems in terms of operation, cost and performance? Please consider both a near-term scenario and a far-future scenario.
Solution: In terms of costs, think about the expenses related to this new technology as compared to drivers’ wages and benefits which initially contribute to 2/3 of the total operating cost.

Also think about how future service hours, fleet management, and parking needs will change as human drivers are no longer needed.
Problem: In a sufficiently large city, customer demand for service is homogeneous with density = $\lambda$ [1/time-area]. Identical facilities are installed, and each serves an equal area of size $A$. The service delivery cost from a facility to serve a unit demand is proportional to the Euclidean distance by a factor $c$ [\$/distance]. Then, if the amortized installation cost of one facility is $f$ [\$/time], derive a closed-form formula for the optimal $A$.
Solution: The average delivery distance per unit demand shall be proportional to the square root of the service area size, $\sqrt{A}$, say by a shape factor of $a>0$.
The total cost per facility area per unit time, which includes the service cost and constructing cost, is

\[
z = a c \sqrt{A} + \frac{f}{\lambda A}.
\]

Hence, the optimal $A$ is
\[
\quad A^\ast = \left( \frac{2f}{\lambda ac} \right)^{\frac{2}{3}}.
\]
Problem: In the context of Vickrey equilibrium with linear earliness/lateness penalties, can you show that the cumulative virtual arrival curve for a late traveler must be piecewise linear?
Solution: Let \(\mu\) denote the slope of \(D(t)\), and \(w\) the slope of \(V(t)\) for some late person. Assuming we shift \(D(t)\) curve by \(\Delta\), the change in lateness costs is \(\frac{\Delta}{\mu} L \beta\) and the change in delay costs is \(\beta \left( \frac{\Delta}{w} - \frac{\Delta}{\mu} \right)\). At the optimal point, we have 

\[
\lim_{\Delta \rightarrow 0} \frac{\Delta \text{ cost}}{\Delta} = -\frac{1+L}{\mu} \beta + \frac{1}{w} \beta = 0.
\]

Thus 

\[
w = \frac{1}{1+L} \mu,
\]

which completes the proof.
Problem: Passengers' origins and destinations are uniformly distributed along a circular bus line. Imagine that you have an infinitely large fleet so that the service headway is zero. Also, the bus dwell time at each stop is negligible, and there is no speed limit. You are asked to optimize the bus stop spacing assuming that the prevailing passenger travel distance is 4 km, their access speed is 1 m/s, and for safety concerns, the maximum permitted bus acceleration/deceleration is 2 m/s\(^2\). What is the worst-case passenger door-to-door travel speed under your design?
Solution: 
Optimizing for the worst case, we take the total walking time to be \(2 \cdot\frac{s}{2v_w} = \frac{s}{v_w}\) where \(s\) is the stop spacing and \(v_w\) is the walking speed. In the bus, the average passenger will stop at \(l/s\) many bus stops where \(l\) is the prevailing travel distance. Because the bus' cruising speed is unbounded, the fastest option for the bus in between stops is to accelerate from a standstill until it has driven half the distance between two stops, and then decelerate until it reaches a standstill at the next stop. Under this strategy, the travel time in between stops is \(2\sqrt{s/a_0}\), so the total travel time on the bus is \(2ls^{-1/2}a_0^{-1/2}\). The total door-to-door travel time, \(T\), is then

\[
T = \frac{s}{v_w} + 2ls^{-1/2}a_0^{-1/2}
\]
Minimizing this travel time gives an optimal stop spacing of 
\[
s^\ast = \left( \frac{v_w^2 l^2}{a_0} \right)^{1/3} = 200\, \text{m}.
\]

Plugging in the optimal stop spacing into the travel time equation gives an average door-to-door speed of 6.67 m/s.
Problem: A daily commuter train line serves a linear city in the interval \(x \in [-L, L]\). Commuters’ residences are uniformly distributed in \([-L, 0]\); and their workplaces are uniformly distributed in \([0, L]\). A train makes one scheduled trip per day toward the workplaces in the morning, and returns in the afternoon. Passengers’ walk to stops at speed \(v_w\). The stop spacing is \(s \ll L \). The train's cruising speed is \(v_t\). The vehicle delay per stop is \(\tau\). The daily operating cost includes two parts: \(c_d\) per unit distance served, and \(c_s\) per train stop. The agency’s budget is \(B\) [\$/day]. Formulate an optimization problem that minimizes the commuters’ average door-to-door travel time in both directions. Find the optimal spacing \(s^\ast\).
Solution: The expected door-to-door travel distance (each way) is clearly \(L\), and walking distance (each way) is \(s/2\), so the mathematical program can be written as follows:


\begin{equation*}
\begin{aligned}
\min_{s} \quad & \frac{L}{v_t} + \frac{L}{s}\tau + \frac{s}{2v_w}  
 \textrm{s.t.} \quad &  2L c_d + c_s \left( \frac{2L}{s} \right) \leq \frac{B}{2}, 
   & s \geq 0   
 \end{aligned}
\end{equation*}

The minimum spacing \(s^\ast\) is the solution to a constrained convex problem: \[ s^\ast = \max \{\sqrt{2L\tau v_w}, \,\, 4Lc_s/(B-4L c_d) \}\].
Problem: A bus line forms a loop along which the passenger origins and destinations are uniformly distributed. You are given 3 buses. You could provide bi-directional service, where half of the vehicles go clockwise and the other half go counterclockwise, or allocate all buses to go in the same direction. Which type of service provides a shorter door-to-door travel time to an average passenger? You can assume that passengers arrive without knowledge of the schedule, and they do not have scheduled appointments at the destination.
Solution: Assume the corridor length is \(L\), stops are uniformly distributed, and the dwell time at each stop is a constant (i.e., independent of the number of boarding/alighting passengers). We also denote the vehicle cycle time by \(C\), and the number of vehicles by \(n\). For simplicity, we assume that \(n/2 \in \mathbb{Z}\). Then the headway for unidirectional service is given by 

\[
H = \frac{C}{n}.
\]

The headway for bidirectional service is \(2H\). The average travel distance is \(L/2\) if the service is unidirectional, or \(L/4\) if bidirectional. Note that passenger riding time is generally proportional to trip distance, i.e., \(C/2\) for unidirectional service and \(C/4\) for bidirectional service. Hence, since passenger walking experience would remain identical, the total travel time (waiting + riding) is \(\frac{C}{2} + \frac{H}{2}\) for unidirectional service and \(\frac{C}{4} + H\) for bidirectional service.

Thus, the condition to provide a bidirectional service rather than a unidirectional service is

\[
\frac{C}{4} + H < \frac{C}{2} + \frac{H}{2}
\]

i.e.,

\[
H < \frac{C}{2}.
\]

That is,

\[
n > 2.
\]

You have 3 buses, and hence you should provide bidirectional service.
Problem: An independent taxi driver must provide service to passengers in a line interval \([0, 1]\). 
\begin{itemize}
    \item [a.] All passengers start their trips at a subway station at the origin, and their destinations are uniformly distributed. Find the expected travel distance required to serve one passenger, including the empty backhaul. 

\item [b.] All passenger origins and destinations are uniformly and independently distributed, and the driver serve passengers on a FIFO basis. Find the expected service distance per passenger. 

\end{itemize}
Solution: 
\begin{itemize}
    \item [a.] The taxi starts at the origin:

\begin{itemize}
    \item Expected distance to pick up a passenger = \( \frac{1}{2} \) (since those are uniformly distributed between 0 and 1).
    \item Expected distance to drop off the passenger = \( \frac{1}{2} \) (for the same reason).
\end{itemize}

Therefore, total expected distance = 1.

\item [b.] Similarly,

\begin{itemize}
    \item Expected distance to pick up a passenger = \( \frac{1}{3} \) (expected distance between 2 uniformly distributed points between 0 and 1).
    \item Expected distance to drop off the passenger = \( \frac{1}{3} \) (for the same reason).
\end{itemize}

Therefore, total expected distance = \( \frac{2}{3} \).

\end{itemize}
Problem: A route deviation system is currently used to serve a rectangular area of a fixed width W. The vehicle can run longitudinally or perpendicularly along a very fine grid of orthogonal streets. In strategy 1, buses travel through the ``middle line," serve each passenger by deviating perpendicularly, and return immediately to the route afterwards. In strategy 2, buses travel directly between consecutive passengers while largely following the longitudinal direction, so that there is no returning to any middle line. What is the expected lateral travel distance for either strategy?
Solution: The horizontal distance is the same, but the expected lateral distance is reduced. Assuming the zone width is w, the lateral distance to pick up n passengers in the zone route system is $\frac{1}{3}nw$. On the other hand, the lateral distance to pick up n passengers in the route deviation system is $\frac{1}{2}nw$. Therefore, we are saving 33\% in terms of expected lateral distance.
Problem: A bus line runs from 5 am to midnight. In each direction, the line has 40 stops and is 12 km long. The bus cruising speed is 30 km/h, and each stop imposes a delay of 15 seconds. The dispatch headway from a terminus (at one end of the route) is 10 min during the rush hours (7 am-9 am, and 3 pm-7 pm), and 30 min for the remainder of the service period. What is the minimum fleet size M needed to run this route?
Solution: We first prepare some basic metrics. The cycle time for the commuter route is $2\left(\frac{40\times 0.25}{60}+\frac{12}{30}\right)=1.13 $ hr, or 68 min, and vehicle dispatch frequencies are 6 per hr and 2 per hr in rush intervals and during the remainder of the service time, respectively.
\begin{figure}[h!]
    \centering
    \includegraphics[width=0.5\linewidth]{img/P10_55.png}
    \caption{Cumulative plot of buses available, dispatched, and returned.}
    \label{fig:P10_55}
\end{figure}

Following the recipe from the book, the cumulative plots of buses dispatched D(t), returned R(t)=D(t-1.53), and minimal available curve A(t) can be computed, as shown in the figure above.

Through the graphical approach, the minimum fleet size M is 7.