# Day and Night: Locating the General Practitioner's Panel after Hours
## 2 Materials and Methods
### Multiple Time Setting p-Median Problem  
The p-Median problem is typically used in one time setting. However, the problem under consideration covers multiple related time settings: regular and after-hours primary care. Regular care is typically conducted during the daytime during normal working hours. After-hours care is delivered outside of regular hours, usually at night and very early or late in the day. These time settings are mutually exclusive and primary care facilities may operate with different properties in each time setting. Thus, the p-Median problem is altered to address multiple time settings in one OR model. This allows decisions to be made while considering the costs in both time settings simultaneously. The notation used for this model is detailed in Table 1 and Equations (1)-(13). \begin{table}
\begin{tabular}{c c} \hline \hline
**Sets** & \\ \(I\) & Set of all nodes where facilities may be placed, indexed by \(i\). \\ \(J\) & Set of all nodes where demand is located, indexed by \(j\). \\
**Parameters** & \\ \(p\) & The number of primary facilities to locate. \\ \(p^{\prime}\) & The number of secondary facilities to locate. \\ \(d_{j}\) & The primary demand at node \(j\). \\ \(d_{j}\) & The secondary demand at node \(j\). \\ \(c_{ij}\) & The unit cost of supplying demand at node \(j\) from a facility at node \(i\). \\ \(W\) & The discount rate applied to the secondary setting. This can be thought of as \\  & relative cost; for example, \(W=0.5\) suggests that cost incurred in the secondary setting is considered half as important as cost in the primary setting. \\
**Decision Variables** & \\ \(x_{ij}\) & The fraction of primary demand at node \(j\) satisfied by facility \(i\). \\ \(x_{ij}^{\prime}\) & The fraction of secondary demand at node \(j\) satisfied by facility \(i\). \\ \(y_{i}\) & A binary variable, 1 if a facility is located at site \(i\) and 0 otherwise. \\ \(y_{i}^{\prime}\) & A binary variable, 1 if a secondary facility is located at site \(i\) and 0 otherwise. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Multiple Time Setting p-Median Notation. In this modification of the p-Median problem, a primary and secondary set of facilities is simultaneously located to minimise the distance to demand in a primary and secondary time setting. In this case, the primary facilities are located in the regular time setting, and the secondary facilities are located in the after-hours time setting. A constraint added to the standard p-Median problem to create the modified problem is that the number of secondary facilities must be less than or equal to the number of primary facilities. This constraint is founded on the assumption that there are no more primary care practices open during the after-hours time setting than during the regular time setting. This limitation also requires a second constraint. Secondary facilities must share locations with primary facilities. This satisfies the assumption that the same facilities are used for regular and after-hours care, which is expected to be more cost-effective (and typical of real-world settings) than opening facilities separately for each setting. Together, these constraints ensure that after-hours facilities must share locations with regular facilities.