Monday, January 23, 2023

Drone Deliveries

A restaurant at the center of Riddler City is testing an airborne drone delivery service against their existing fleet of scooters. The restaurant is at the center of a large Manhattan-like array of square city blocks, which the scooter must follow.

Both vehicles travel at the same speed, which means drones can make more deliveries per unit time. Assume that (1) Riddler City is circular in shape, as you may recall (2) deliveries are made to random locations throughout the city and (3) the city is much, much larger than its individual blocks.

In a given amount of time, what is the expected ratio between the number of deliveries a drone can make to the number of deliveries a scooter can make?

Given the setup, we can assume that the restaurant is at the origin of a unit circle and that the orders come in randomly at any point in the unit disk, that is, $Z = (x,y)$ with $x^2 + y^2 \leq 1.$ The distance traveled by the drone from the restaurant to the point $Z$ is $\|Z\|_2 = \sqrt{x^2 + y^2}$ while the distance traveled by the scooter is $\|Z\|_1 = |x|+|y|.$ Let's also assume that both the drone and the scooter only make one delivery at a time. Then the expected number of deliveries per unit time is proportional to the inverse of the distance traveled per delivery, the expected ratio of number of deliveries by drone versus scooter is roughly equal to the inverse of the ratios of expected distances traveled, that is, $$k= \frac{\mathbb{E} \|Z\|_1}{\mathbb{E} \|Z\|_2}.$$

In polar coordinates the scooter distance can be rewritten as $\|Z\|_1 = r(|\cos \theta | + |\sin \theta|),$ where the absolute values can be dropped in the first quadrant. So, due to symmetry, the numerator of $k$ is given by $$\mathbb{E} \|Z\|_1 = \frac{4}{\pi} \int_0^{\pi/2} \int_0^1 r (\cos \theta + \sin \theta) r dr\, d\theta = \frac{8}{3\pi}.$$

In polar coordinates, $\|Z\|_2 = r,$ so the denominator of $k$ is $$\mathbb{E}\|Z\|_2 = \frac{1}{\pi} \int_0^{2\pi} \int_0^1 r^2 dr\,d\theta = \frac{2}{3}.$$ So, the drone is expected to make $$k= \frac{\frac{8}{3\pi}}{\frac{2}{3}} = \frac{4}{\pi}$$ times as many deliveries per unit time as the scooter.

Extra credit: In addition to traveling parallel to the city blocks, suppose scooters can also move diagonally from one corner of a block to the opposite corner of the block. Now, what is the new expected ratio between the number of deliveries a drone can make and the number of deliveries a scooter can make?

If the scooters are also allowed to move diagonally across blocks, then the equivalent if we think about having to move from the origin to a point that is say $m$ blocks east and $n$ blocks north of the origin, the fastest delivery route would be to go diagonally northeast for $\min \{m,n\}$ blocks then either proceed the remaining $|m-n|$ blocks due east if $m \lt n$ or due north otherwise. In this case the distance traveled is $(\sqrt{2}-1) \min\{m,n\} + \max\{m,n\}$ blocks. In general, zooming back out to our unit circle representation, the distance traveled to any generic point $Z$ in the unit circle is $$\hat{d}(Z) = (\sqrt{2}-1)\min \{|x|,|y|\} + \max\{|x|,|y|\}.$$ The calculation for the expected ratio of number of deliveries per unit time can still proceed analogously, with $$\hat{k} = \frac{ \mathbb{E} \hat{d}(Z) }{ \mathbb{E} \|Z\|_2} = \frac{3}{2} \mathbb{E} \hat{d}(Z).$$

If we focus on the first quadrant where additionally we have $y\leq x$, then $\hat{d}(Z) = x + (\sqrt{2}-1) y$ or in polar coordinates this would be $$\hat{d}(Z) = r\left( \cos \theta + (\sqrt{2}-1) \sin \theta\right),$$ where $0\leq \theta \leq \frac{\pi}{4}.$ By symmetry, we have $$\mathbb{E} \hat{d} (Z) = \frac{8}{\pi} \int_0^{\pi/4} \int_0^1 r\left( \cos \theta + (\sqrt{2}-1) \sin\theta\right) rdr\,d\theta = \frac{16(\sqrt{2}-1)}{3\pi}.$$ So, if scooters can go diagonally across blocks, then the drone is expected to make only $$\hat{k} = \frac{8(\sqrt{2}-1)}{\pi}$$ times as many deliveries per unit time than as the scooter.