## 4 The \(p\)-Median Model for Planning Parcel Locker Locations  
In the proposed service scenario, it is critical to properly locate the parcel lockers and to designate each passenger to a location to pick up parcels. Suppose the ride-pooling market has \(N\) passengers and \(M\) candidate locations for parcel lockers, we let \(i\in I=\{1,2,\ldots,N\}\) and \(j\in J=\{1,2,\ldots,M\}\) be the indices for ride-pooling passengers and candidate locations for the parcel lockers, where \(I\) and \(J\) further denote the set of passengers and the candidate parcel locker locations. We assume there is an exogenously given number of parcel locker locations to be selected, which is assumed to be a constant parameter denoted as \(P\). Then, the planner chooses \(P\) locations where the parcel lockers are to be deployed among \(M\) candidates, such that the overall detour distance experienced by \(N\) passengers for picking up the parcels is minimized. Therefore, matching between the passengers and the parcel locker locations needs to be simultaneously determined while choosing \(P\) locations, without which the overall passenger detour distance cannot be obtained. Moreover, since we lack the historical data on urban parcel deliveries, it is assumed that there are always enough parcels at any parcel locker \(j\in J\) to be pooled with the passengers. In light of the above setting, we adapt the well-known \(p\)-median model (also known as the \(p\)-Hub median model) [41; 42] to formulate the parcel locker location planning problem. Figure 1: Illustration of moderate and full passenger–parcel integration: (**a**) moderate passenger–parcel integration; (**b**) full passenger–parcel integration. The \(p\)-median model is a fundamental optimization framework used in location analysis and facility planning, in which \"p\" represents the predefined number of facilities to be located. Moreover, we notice that there are other commonly used location planning models that have different objectives compared with those of the \(p\)-median model. For example, the \(p\)-center model aims to locate \"p\" facilities to minimize the maximum cost between any OD pair [43,44]; the hub maximal covering problem aims to locate a set of hubs such that the total flows between all the OD pairs can be maximized [45]. In this paper, since our goal is to determine the optimal placement of parcel lockers to minimize the total detour distance between the passengers and the designated parcel lockers, the \(p\)-median model is considered to be an appropriate choice and is hence adopted. The \(p\)-median model for parcel locker location planning (denoted as PM) is formulated as follows:  
\[\min_{x_{ij},y_{j}}Z=\sum_{i\in I}\sum_{j\in J}x_{ij}d_{ij} \tag{1}\]  
s.t. \[\sum_{j\in J}y_{j}=P \tag{2}\]  
\[x_{ij}\leq y_{j},\;\forall i\in I,\;j\in J \tag{3}\]  
\[\sum_{j\in J}x_{ij}=1,\;\forall i\in I \tag{4}\]  
\[x_{ij},y_{j}\in\{0,1\},\;\forall i\in I,\;j\in J \tag{5}\]  
Objective function (1) is to minimize the total passenger detour distance \(Z\) by determining the values of the two binary variables \(x_{ij}\) and \(y_{j}\), where \(x_{ij}\) equals 1 if passenger \(i\) is pooled with a parcel stored at location \(j\), and 0 otherwise. \(y_{j}\) equals 1 if a parcel locker is installed at location \(j\), and 0 otherwise. \(d_{ij}\) is the detour distance experienced by passenger \(i\) if he/she is pooled with a parcel stored at location \(j\). The computation of \(d_{ij}\) is illustrated in Figure 2 below. There are three nodes in Figure 2 denoted as nodes A, B, and C. Let nodes A and B be the trip origin and destination of passenger \(i\), respectively, and C is the parcel locker location \(j\). \(I_{AC}\), \(I_{CB}\), and \(I_{AB}\) stand for the travel distances from A to C, from C to B, and from A to B. Then, we have \(d_{ij}=I_{AC}+I_{CB}-I_{AB}\). Constraint (2) requires that the number of selected candidate parcel locker locations be equal to \(P\), which, as mentioned above, is assumed to be pre-determined in this paper.