1 Introduction

In the early twenty-first century, people have already suffered several global epidemic influenzas [such as pandemic H1N1 in 2009 (Centers for Disease Control and Prevention 2010) and H7N9 in 2013 (Centers for Disease Control and Prevention 2014)] with enormous life and property losses. The risk of a future pandemic influenza outbreak is expected to increase in the coming decades (US Agency for International Development 2016), resulting in health burdens to infected individuals, societal economic burdens to their families and the whole society. Once there is an influenza pandemic, public health officers will take both antiviral drugs and vaccines as the primary response strategies to control influenza pandemics efficacious (Couch 1999; Monto 2006; Bai et al. 2017; Du et al. 2015; Zhanwei and Yongjian 2015; Du and Bai 2011), antiviral drugs are thus particularly critical and taken as the major pharmaceutical intervention in the early stage of the pandemic influenza outbreak.

In preparation for coming influenza pandemics, the US governments have maintained a large Strategic National Stockpile (SNS) of antiviral drugs as a major component in their pandemic response plans (US Department of Health and Human Services 2005). To limit strain on hospitals and improve convenience, the commercial pharmacies have been taken as antiviral drug-dispensing partners in some state pandemic response plans [such as Virginia (Virginia Department of Health 2009) and Louisiana (Office of Public Health 2011)]. It is thus urgent to optimize the current response strategy for the dispensing of antiviral drugs. The goal of this paper is to explore an optimization method to assign a given amount of antiviral drugs to the chosen location of dispensing points (such as pharmacies) within a city, to match practical demand with supply (Fig. 1).

Fig. 1
figure 1

Drug distribution frame based on practical demand. Antiviral drugs can be accessed by most population, distributed on sparsely populated areas and pharmacies who are geographically far apart

In the existing research of optimizing pharmacy-based response strategy, there are a number of researches (Canoyer 1946; Brown 1992; Hernandez and Bennison 2000), studying the social factors (such as traffic and consumption environment) that a consumer might consider when choosing a pharmacy to buy medicines. The pharmacy site selection problem can be considered as the traditional location problem in theory of combinatorial optimization. However, the site location selection becomes increasingly complex once we consider it additionally from the social perspective. Specifically, with the existing pharmacies, an optimization problem is how to assign the limited dose of drug into different pharmacies in order to benefit the society best. In the related existing mathematical models, they are mostly data driven to help the government to choose pharmacies for antiviral drugs through 0–1 integer linear programming (Singh et al. 2015). In their modeling, the single objective is to maximize the access of the target population to pharmacies. However, there are substantial inevitable but essential social scales needed to be considered:

  • The access is investigated via the distance in many retrospective studies (Singh et al. 2015). However, except the geographical condition, the access, denoted as the tendency of pharmacy visit by people, is additionally influenced by people’s willingness, depending on social factors [such as the pharmacy reputation (Tao and Liu 2015)].

  • The social unbalance for management areas should be considered (Singh et al. 2015). The small management areas should also be assigned, while the previous single-objective modeling process cannot reflect the balance between the multiple optimization objectives (access and social unbalance).

  • The spatial unbalance, as the pharmacy-to-pharmacy distance, should be also taken into consideration. Two close pharmacies may be chosen at the same time. While in reality, the distribution of pharmacies should be in a sparse spatial network (edges with long pharmacy-to-pharmacy distance) to supply more opportunities for people.

  • The resource unbalance, as the quantitative analysis, is necessary, especially important in resource allocation during the outbreak of pandemics. The amounts of antiviral drugs assign to each chosen pharmacy should in a reasonable range.

To sum up, we model the above considerations in the network-based frame, taking pharmacies as nodes, edges weighted by nodes’ distance. The concept of group infers the cluster of nodes located in a same management area. In addition, to maximize the people’s access to the pharmacies, there are at least three other objectives needed to be considered: first is the social unbalance from the group perspective. Each target areas, even small, should be assigned to antiviral drugs. Second is the spatial unbalance from the edge perspective. The chosen pharmacies should not be too close to each other. The last is the resource unbalance from the node perspective. The volume of antiviral drug assigned to a pharmacy should be in larger than a certain threshold, to avoid too many administrative works for the trivial assignment, and smaller than another threshold, to limit the unpractical huge amount of drugs assigned.

Fig. 2
figure 2

Spatial map of districts and pharmacies in Shanghai. a From the group level, Shanghai is divided into different districts represented by colors. For example of five pharmacies, the 1st and 2nd are in the blue district, and the other three are in the orange district. When we target the optimized group of pharmacies, the balance is studied in terms of meet multiple objectives (access, social unbalance and sparsely spatial distribution) by considering their popularity, distances and sparsity. b From the node level, the sites of pharmacies considered here are shown with circles. (Color figure online)

Thus to assign the optimized amount of antiviral drug for each pharmacy, we propose a network-based model by maximizing multiple objectives (access, social unbalance, spatial unbalance, and resource unbalance). Here the access is based on a willingness-to-travel model to reflect people’s tendency to a pharmacy according to its distance and reputation. As for social unbalance, it is modeling with \(L_{12}\) norm to make even small areas have antiviral drugs supplied. Besides, to meet the spatial unbalance between any two pharmacies, the concept of network lasso (Hallac et al. 2015) is introduced here to constrain the choices of pharmacies. For the resource unbalance, we limit the volume range of antiviral drugs designed for a pharmacy. Taking the city of Shanghai in 2015 as an example, we use this model to optimize the commercial pharmacy distribution network, given a fixed amount of antiviral drugs. For example of five pharmacies (as plotted in Fig. 2), the 1st and 2nd are in the blue district, and the other three are in the orange district. When we target the optimized group of pharmacies, the balance is studied in terms of meet multiple objectives (access, social unbalance and sparsely spatial distribution) by considering their popularity, distances and sparsity. This research can supply an initial exploration of pharmacy-based distribution of antiviral drugs for the studying construction of strategic national stockpile in China’s Twelfth 5-year plan (Development Center of Science and Technology of Chinese Pharmaceutical Association 2014), as well as the diverse applications in computer science (Li et al. 2018a; Liu et al. 2018a, b, 2016; Cui et al. 2016).

2 Methods

2.1 Data

2.1.1 Subway

To describe the population distribution of Shanghai, we use the travel smartcard dataset (collected by Shanghai Public Transportation Card Co. Ltd) in Shanghai, China during 30 days in April 2015. This dataset involves 313 subway stations, 11 million individuals and 123 million events of trips. Once people travel through the subway stations by their smart card, when and where this event happens will be recorded automatically (Seasson Information Technology Co. Ltd 2015). With these records, we mainly consider the volume of check-in passengers for each station to reveal the population distribution.

2.1.2 Pharmacy

To get the spatial information of pharmacies in Shanghai, we use the API of Baidu Map to get their names and spatial positions (Baidu Inc. 2014). Specifically, there are around 5600 pharmacies, in which there are 2036 pharmacies marked by 11 famous brands (which have more than 50 pharmacies in Shanghai). As for their ratings of popular, they can be found on the website of Dian**, one of China’s leading O2O platforms for urban and lifestyle services (Dian** 2016).

With this information of both network and individual nodes shown in Fig. 2, our aim is to find the optimized group of pharmacies to meet multiple objectives (access, social unbalance and sparsely spatial distribution).

2.2 Willingness-to-travel model

We use the gravity model (Zipf 1946; Barthélemy 2011; Erlander and Stewart 1990) to estimate the effect of distances on individuals’ willingness to travel in Shanghai to get antiviral drugs from pharmacies. Besides, the influence of distances on people’s willingness, pharmacies’ own social profiles (such as reputation and scale) also show obvious effect (Tao and Liu 2015). Such the probability of people’s willingness to the ith pharmacy can be modeled by the following equation: \(p(i)=\sum \nolimits _{j}p_{ij}S_{i}R_{i}\) Here \(p_{ij}\) is the effect of distances on the willingness by gravity model. \(S_i\) denotes the scale of the ith pharmacy, as the number of drug pharmacys in the brand which the ith drug pharmacy belongs. \(R_i\) denotes the reputation of the ith drug pharmacy, as the rating of popular by individuals.

2.3 Optimization model

We mainly consider three items for the multi-objectiveness of access, social unbalance, spatial unbalance and resource unbalance.

  1. 1.

    The access is used to reflect people’s tendency to a pharmacy according to its distance and popularity. For a pharmacy, the tendency is proportional to the number of people living around and the popularity (such as the scale and reputation) of this pharmacy. Specifically, let \(\alpha\) be the access measure of the assigned volume of drug, denoted as \(x_{i}\), for the ith drug pharmacy. We set \(\alpha\) with element \(\alpha _{i}=\sum \nolimits _{j}pop_{j}p_{ij}S_{i}R_{i}\). Here \(pop_j\) is the population for the jth station, \(S_i\) is the scale of the ith drug pharmacy and \(R_i\) denotes the reputation of the ith pharmacy. Let \(p_{ij}=\frac{1}{r_{ij}^{2}}\), where \(r_{ij}\) represents the distance between the jth station and the ith drug pharmacy.

  2. 2.

    As for the social unbalance, \(l_{12}\) norm is commonly used as the exclusive Lasso for multi-view feature selection (Bach et al. 2012), which is suitable for us to balance the resources in different management areas. Thus no area is assigned without resources. The only difference between areas is the dose of the drug distributed.

  3. 3.

    To meet the request of spatial unbalance as the sparsely spatial distribution, a network-lasso penalty operator D (Hallac et al. 2015) is introduced here, which is used to describe the relationships between two nodes. In our case, the closer two chosen pharmacies are, the larger the penalty tends to be.

  4. 4.

    The resource unbalance is modeled by constraining the volume range of antiviral drugs designed for a pharmacies. We limit \(x_{i}\) in the range of \([\xi , \alpha _i]\),

To sum up, with the above multi-objectiveness, we propose the following optimization model for the pharmacy-based distribution of antiviral drugs:

$$\begin{aligned}&\max \sum _{i} \alpha _{i}x_{i} - \lambda \left\| x\right\| _{12} - \mu D\\&\begin{array}{r@{\quad }l@{}l@{\quad }l} s.t. &{} \alpha _{i}=\sum _{j}pop_{j}p_{ij}S_{i}R_{i} \\ \\ &{}\sum _{i}x_{i}=M_{med} \\ \\ &{}x_{i} \in [\xi , \alpha _i] \\ \\ &{}\left\| x\right\| _{12}=\sum _{w \in K}\left( \sum _{m\in w}x_{m}^w\right) ^{2}\\ \\ &{} D=\sum _{i,k}{ \frac{ 1_{x_{i} \le \xi }1_{x_{k} \le \xi } }{d_{ik}} } \\ \\ \end{array} \end{aligned}$$

Here, \(x_i\) represents the volume of drug assignment for the ith drug pharmacy. D is the network-lasso penalty operator, constraining each pair of pharmacies. \(\alpha _i\) is the access influence and also the upper bound of \(x_i\). \(\lambda\) infers the influence of social unbalance. \(\mu\) denotes the influence of spatial influence. \(\left\| x\right\| _{12}\) denotes \(l_{12}\) norm of groups of drug pharmacies. \(1_{\bullet }\) is the indicator function. \(1_{x_i}\) denotes whether \(x_i\) is larger than \(\xi\) drug pharmacy. \(x_m^w\) denotes the volume of drug assignment for the mth station in the wth management area among the K management areas. \(d_{ik}\) means the distance between the ith drug pharmacy and the kth drug pharmacy. \(\xi\) is the lower bound of \(x_i\). \(M_{med}\) denotes the total dose of drugs.

The above model can be considered as a constrained nonlinear multivariable function, which can use Hessian-based (the second derivatives of the Lagrangian) method by a dense quasi-Newton approximation (Haelterman et al. 2009). Besides, to show the social and spatial unbalances intuitively, we consider the following two rates to measure them respectively:

  • Rate of spatial relations within 1 km, which denotes the ratio between the number of pharmacies pairs (whose spatial distance is less than 1 km) and the total number of pharmacies pairs.

  • Coverage rate of districts, which means the ratio between the number of districts (who have at least one pharmacy assigned) and the total number of districts.

Fig. 3
figure 3

Density distribution of access for each pharmacy and distance between two pharmacies

Fig. 4
figure 4

Dynamics of pharmacies’ access with varying lambda (\(\lambda\)) and mu (\(\mu\)) from 0.01 to 10,000. When lambda and mu are small in sub-graph a, many pharmacies are chosen for drug assignment. As for the increasing mu and lambda, the drugs tend to focus on a single pharmacy or different pharmacies in dynamic districts

Fig. 5
figure 5

Pharmacies’ antiviral drug distribution without considering social and spatial unbalances. The x-axis is indexed by the pharmacies. Comparing with \(\alpha\), the top 29 pharmacies with highest access are chosen

Fig. 6
figure 6

Spatial map of chosen pharmacies for varying \(\lambda\) and \(\mu\). Each blue point denotes a pharmacy chosen. The indexes of subgraph are corresponding to the IDs in Table 1

Fig. 7
figure 7

Normalized Objectives with dynamic number of pharmacies chosen. Taking ID. a–f as the representation of Table 1, the normalized objectives (access, social and spatial unbalance) are shown. When there are few pharmacies, the normalized social unbalance shows more influence. Once the number of pharmacies exceed its peak, the normalized spatial unbalance tends to show its influence

3 Results

During early 2016, there are 2036 pharmacies in Shanghai from 11 famous in 15 administrative districts. To characterize the properties of pharmacies’ network, we start by analyzing the density distribution of access and distance, shown in Fig. 3. To be specific, the density distribution of logarithmic access follows the Gamma distribution, while the logarithmic distance follows the Normal distribution. These distributions tell us that the pharmacies with high or low access are in the minority, the same with the distances.

Next, we begin to evaluate the optimization model for the pharmacy-based distribution of antiviral drugs. Assuming there are \(10^5\) dose of antiviral drugs for assignment, which is more than any single pharmacy’s access, but not enough for the full coverage of all pharmacies. We estimate the spatial network of pharmacies shown in Figs. 4 and 6 by varying the influence of social unbalance and spatial unbalance, given resource unbalance as a fixed threshold for the minimum of pharmacies’ drug for assignment. With increasing influence of social unbalance (represented by \(\lambda\)), decreasing number of pharmacies are assigned with drugs across different districts, showing the social unbalance to avoid the unbalance assigned resources of across management areas. In contrast, with the increasing spatial influence (denoted by \(\mu\)), the doses of drugs tend to be in only one pharmacy, which has the highest access influence. Comparing with the traditional single objective (where \(\lambda\) and mu are all 0), the drug distribution of pharmacies is fixed, as shown in Figs. 5 and 6. Many pharmacies locate at the city center, and close to each other.

We additionally explore the relationship between the number of chosen pharmacies and the desirable objectives (access, social and spatial unbalances) achieved, shown in Table 1 and Fig. 7. The social and spatial unbalance are both increasing with the number of chosen pharmacies. While for the access, there is a peak. Too little or too many pharmacies are leading the access influence decreasing. Specifically, there are 29 pharmacies needed with high social unbalance (covering 81% districts) by the traditional single-objective method of access. In the contrast, only 12 pharmacies are needed with similar access ability but smaller social unbalance (covering 75% districts). Or more pharmacies are assigned with covering 87% districts. As for the spatial unbalance, the rates of spatial relations within 1 km in the proposed optimization model are still improved in conditions of less or more pharmacies assigned. From this, we can see the trade off among social unbalance, spatial unbalance and the access to the dynamic number of pharmacies assigned.

Table 1 Items involved in the optimization model, corresponding with Fig. 4

4 Discussion

Increasing governments take the pharmacies in their plans for the dispensing of antiviral drugs. Whether and how much this strategy can benefit the society is needed to study, especially for the constructing strategic national stockpile. In this paper, we study an optimization method to assign a given amount of antiviral drugs to pharmacies within a city. A network-based method is proposed by maximizing multiple objectives (access, social unbalance, spatial unbalance and resource unbalance). We can see how these objectives influence the number of pharmacies chosen. The improvements of social and spatial unbalance are in the cost of access.

Our studied results can help deepen the understanding of antiviral drug distribution in the network of pharmacies within cities by evaluating this interesting strategy in different perspectives. The methods used might be specific, but the questions raised can be valuable on their own and motivate research using other types of data (Lin et al. 2017a, b; He et al. 2017; Yuan et al. 2017; Li et al. 2018b, c; Cai et al. 2017; Shen et al. 2018; Jia et al. 2017; Liu et al. 2018c; Huang et al. 2018; Wang et al. 2018).