The rapid spread of COVID-19 around the world is stunning. This novel coronavirus created an uprecedented lockdown in many countries which, in turn, caused an immense economic and social impact. Thus, many researchers investigate methods to stop this epidemic as soon as possible. For example, the list of papers on COVID-19 collected by the World Health Organization [6] contains around 10 000 publications, a huge number, given that the virus was first discovered in January 2020. The struggle involves researchers from various fields such as bioinformatics, epidemiology, sociology, mathematics and computer science.
One key factor to stop the spread of the virus is the social distancing (see, e.g., [3] ). Many companies and organizations try to develop applications to aid the social distancing (see [5] for a long list of current such projects). However, many applications seem to focus on tracking people movement. To the best of our knowledge, we do not know any aplication that advises the authorities which decisions to make. As Thomas Pueyo wrotes in his article published on the 19th of March 2020 [8] (Chart 16), governments should have a chart with the effect and the cost of various social distancing measures. As it is currently observed in the world (and especially in Europe), many governments were afraid to take severe social distancing measures in order to avoid a high economic loss.
In this paper we try to address this issue as follows. We first build a model (i.e., a combinatorial optimization problem) that captures the current setting: the risk of the people to get COVID-19, the contact between various people and the cost of closing various facilities such as schools, parks, cities, factories, etc.. We show that the problem we introduce is NP-hard (as it is often the case with complex combinatorial optimization problems). Then, since we cannot solve the problem exactly in polynomial time, we provide a heuristic polynomial time algorithm for this problem. To understand the performance of our algorithm, we implement and test it in Section 5. We generate our test data using special probability distributions that simulate real world social networks as we present in Section 5.1. Our experiments are encouraging and show that even with a 1% budget (from the total cost of locking down the entire country), we can reduce the population risk by more than 5 times compared with the situation in which no measures are taken. Thus, we show that there is a possibility for a "beautiful" lockdown that is efficient in the fight with COVID-19 and safe for the economy.
We mention that the paper is written in a bottom-up fashion. More precisely, in Section 2 we present a prelimiary model that we designed in the early stages of our study. Even if we do not consider the model in Section 2 further in the paper, the motivation for introducing it is two-fold. Firstly, by presenting the model in Section 2 we show the reader the complete path we took to design the model in Section 3 (instead of simply presenting the final product). Secondly, researchers who aim to study and improve the models presented in this paper may find useful to understand the difficulty behind designing a comprehensive model.
The paper is structured as follows. At first, in Section 2 we present the first set of problems that aim to model the problem. We also show that these problems are NP-hard. Then, in Section 3 we present our actual framework. In Section 4 we design an algorithm for the problem presented in Section 3. Then, in Section 5 we describe our experiments. In Section 6 we present an integer linear program formulation for the problem introduced in Section 3. Finally, in Section 7 we discuss several directions for future work.
In this section we introduce a preliminary model (i.e., a collection of related combinatorial optimization problems) that helped us to derive the model from Section 3.
The input consists of an undirected complete graph G = (V, V 2 ) and a function p : V 2 → [0, 1]. Each node v ∈ V in a graph corresponds to a person and p(u, v) is the probability that two people get in contact to each other. Moreover, each vertex v ∈ V has associated two values, risk : V → [0, 1] and vulnerability : V → [0, 1], representing how likely is a person to spread the disease (e.g., it can be 1 if a person is tested positively with COVID-19 or close to 1 if a person was recently in a "red area"), respectively how vulnerable is a certain person (e.g., there are studies showing that eldery people and people with chronic diseases are more likely to be affected).
Besides the input graph we are given: i with to p(a, b) · r 1 (i) . Informally, the cost c 1 (i) represents the cost of closing facility i (i.e., a school, a bar, restaurant, theater, etc.), which, in turn, reduces the probability of the people that belong to that facility to interact with each other. In a simple variant, each r 1 (i) can be set to 0, representing that two people that belong to that facility will have probability 0 to interact once the facility is closed.
Then, we have k 2 sets of vertices V 2 = {V 2 1 , V 2 2 , . . . , V 2 k } each one with a value c 2 : {1, 2, . . . , k} → R + and a value r 2 : {1, 2, . . . , k 2 } → [0, 1]. The cost c 2 (i) represents the cost of reducing the value of all p(a, b), where a ∈ V 2 i and b / ∈ V 2 i to p(a, b) · r 2 (i). Informally, the cost c 2 (i) represents the cost of isolating the people in the group V 2 i (for example, quarantining persons, small groups or even closing entire cities).
Now we introduce a couple of objective functions and constraints that aim to model the current scenario. The overall goal is to reduce the spread of the virus while keeping the cost at a minimum. The first group of problems consider a simplified variant of the framework, ignoring the vulnerability and the risk of each person.
In the first problem the goal is to optimize the economic cost of closing various facilities and isolating various groups of people, while maximizing the number of components created. Problem 1. We are given a budget B ∈ R + and a threshold P ∈ [0, 1]. The goal is to select a setV 1 ⊆ V 1 and a setV 2 ⊆ V 2 such that the following two conditions are met:
After the sets of facilitiesV 1 andV 2 are selected and the corresponding edges have their probabilities decreased (as described in Subsection 2.1), we remove all the edges (a, b) ∈ V 2 such that p(a, b) ≤ P . The goal is to maximize the number of connected components in the remaining graph.
As we stated above, the model does not consider all the information. However, it is useful in cases where not much data is available to conduct preliminary tests. Moreover Problem 1 is interesting to study from the theoretical point of view since it is a novel combinatorial optimization problem.
Notice that even this oversimplified variant of the framework is NP-hard since it is a generalization of the classical Vertex Cover problem as we show in Subsection 2.3.
The second problem that we introduce is similar to the first problem, where the goal is to minimze the budget, while requiring for at least a certain number of connected components to be created.
We are given a number of desired connected components N and a threshold P ∈ [0, 1]. The goal is to select a setV 1 ⊆ V 1 and a setV 2 ⊆ V 2 such that the following holds. After the sets of facilitiesV 1 andV 2 are selected and the corresponding edges have their probabilities decreased, we remove all the edges (a, b) ∈ V 2 such that p(a, b) ≤ P . The number of connected components in the remaining graph should be at least N . The goal is to minimize
If we ask to maximize only the number of connected components we might obtain a solution that does not match the original motivation. For example, we can obtain a solution where we have many small components and a huge component, which is, of course, not desired in practice. Thus, we introduce the following two problems, in which we impose a restriction on the size of the connected componets resulted after the closure of facilities.
Problem 3. The input is the same as in Problem 1. The goal is to minimize the number of nodes of the largest connected components in the remaining graph.
The input is the same as in Problem 2, but N instead of being the number of connected componets desired is the maximum allowed size of a connected component. Thus, the goal is to choose a set of facilities of minimum total budget (if such a set exists) such that, after closing these facilities, each resulting component has size less than or equal to N .
In the end of this section, we formulate two more complex problems that aim to take into considerations all the restrictions, including the risk and the vulnerability.
Problem 5. Besides the input graph and the data associated with the facilities, we are given a budget B, a threshold P and two real numbers W and R. We have the following constraints associated with the connected components resulted after closing the facilities:
Informally, this constraint aims to avoid large groups formed by vulnerable people (such as eldery, or immunosuppressed). 
The goal is to select a set of facilities such that, after removing the edges with the probability less than P , minimises the number of connected components that violate any of the two above mentioned constraints.
The final problem that we propose in this section, is very similar to Problem 5 but aims to enforce that all the components resulted obey the restrictions. Nevertheless, in this variant, we are not given a constraint on the budget. Otherwise, if we are given a constraint on the budget and on the connected components, it is NP-hard even to decide if a feasible solution exists (we obtain an instance of the Knapsack problem that is NP-hard [2] ).
Problem 6. The input is similar to Problem 5, except that we do not have a budget B. The goal is to select a set of facilities of minimum cost (if such a set exists) such that, after removing the edges with the probability less than P , all the connected components do not violate any of the two constraints defined in Problem 5.
In this section we show that problems introduced in Subsection 2.2 are NPhard. We show a complete proof only for Problem 1, since the NP-hardness proofs for the other problems are similar.
Proof. We show a simple reduction from the Vertex Cover problem which is a classical NP-hard problem [2] . In the (decision version of the) Vertex Cover problem the input is an undirected graph G = (V, E) and an integer k and the goal is to decide, if exists, a subset V ⊆ V such that |V | ≤ k and for any edge (a, b) ∈ E, either a ∈ V , b ∈ V or both. Thus, given an instance of Vertex Cover that is, a graph G = (V, E) and an integer k, we construct an instance of Problem 1 as follows.
1. The input graph G of Problem 1 has the same vertex set V .
2. The edge set is constructed as follows: for every edge (a, b) ∈ E, we set p(a, b) = 1, otherwise we set p(a, b) = 0. 3. The set V 1 = ∅. 4. The set V 2 = {{v} | ∀v ∈ V }, while the cost c 2 of selecting any set from V 2 is 1 and r 1 is 0 (that is, all the edges that are incident to a selected vertex are deleted). 5. The budget B = k. Now, we show that the graph G = (V, E) has a vertex cover of size at most k if and only if the maximum number of connected components in the corresponding instance of Problem 1 is n.
First, given a vertex cover V , the solution of Problem 1 that creates n connected components selects the setV 2 = {{v } | v ∈ V }, that is, we select the sets from V 2 corresponding to the vertices in V . Since V is a vertex cover, any edge is incident to at least one vertex from V , thus p(a, b) = 0, ∀a, b ∈ V after selectingV 2 .
Conversely, given a setV 2 , such that |V 2 | ≤ k, we construct the set V = {v | {v } ∈V 2 }. Since n connected components are created after selectingV 2 , we know that p(a, b) = 0, ∀a, b ∈ V (otherwise, we have a connected component with at least two vertices). Since p(a, b) = 0, ∀a, b ∈ V , we know that for any edge (a, b) ∈ E that had p(a, b) = 1, either {a} ∈V 2 or {b} ∈V 2 . Thus, V = {v | {v } ∈V 2 } is a vertex cover of G, completing the proof.
Using a similar reduction, we can show that Problems 2, 3, 4, 5 and 6 are NP-hard. Thus, we state the following corollary. 
The framework presented in the previous section, although promising, has the following problem. The closure of a facility might not have the same effect for all the people that are connected through that facility. Consider the following simple example: two siblings (who live in the same house) study at the same school. Then, after closing the school, in reality the two siblings still have a large probability to get in contact with each other. Thus, we introduce the following framework which captures the aforementioned example and is also simpler than the framework presented in Section 2.
Problem 7. The input consists of a bipartite graph G = (U ∪ V, E). The set U represents the people and the set V represents the facilities. For each edge we have associated a value p : U × V → [0, 1] that represents the percentage of the time spent by a person in that facility in a day. For example, if p(a, b) = 0.25, then person a spends 6 hours (0.25 × 24 hours) in facility b. Each person has associated a probability f : U → [0, 1] of being infected. Each facility has associated a closure cost c : U → R + . Closing a facility v is equivalent with removing the edges incident to v. Moreover, we are given a cost c : U → R + of isolating people. Isolating a subset of people U is equivalent with removing the edges incident to all the vertices in U . Moreover, we are given a total budget B for closing the facilities.
The risk of a facility is informally the weighted (using the risk as the weight) sum of the time spent by the people in that facility. More precisely, R : V → R + is:
The risk of a person r : U → R + is defined as the weighted sum spent by a person in the facilties he visits (weighted using the riks of the facility). Formally:
We define r(U ) the vector in R |U | , that has in each component the risk of a person.
The goal is to select a set of facilities of total cost at most B such that a given function F : r(U ) → R is minimized. In this paper we study the problem for F as 1 . In other words, we aim to optimize the total risk of the people.
We show that Problem 7 is NP-hard even in an extremely restricted version in which there is only one person associated with a facility. Proof. The problem can be reduced to the Subset Sum problem in which the input is a set S of numbers and an integer B and the goal is to decide if there exists a subset of numbers from S whose sum is precisely B. The Subset Sum problem is a famous NP-hard problem [2] . Given an instance of the Subset Sum problem, we create an instance of Problem 7 as follows. For each number x in the set S, we create a facility v of cost c(v) = x. Each facility v has precisely one edge (u, v) ∈ E, with f (u) = c(v)/max v∈V c(V ) and p(u, v) = 1. Thus, for each pair person/facility (u, v) we have R(v) = r(u) = c(v)/max v∈V . A set of facilities of cost X gives a total risk for people of cost
. Therefore, if we can decide in polynomial time if the total risk incurred for the population in Problem 7 is
, then we can decide if there exist a subset of numbers from S that have sum precisely B. Thus, Problem 7 is NP-hard in the case F = 1 .
In this section we provide a heuristic (approximation) algorithm for Problem 7. We test our algorithm in Section 5 and show that it gives promising results.
Our algorithm (presented in Algorithm 1) sorts the list of people and the facilities according to their efficiency (the cost of isolating/closing a person/faciltiy divided by the amount of risk the people/facilities have). Then, the algorithm aims to find the optimum division of the available budget between isolating people and closing facilities. According to our experiments (see Section 5) there is not an obvious correlation between the optimal value of the division of the budget (i.e., variable Split in Algorithm 1) and the minimum total risk. Thus, we need to iterate over all values of Split in order to find a good solution. Of course, since there are infinitely many numbers between 0 and 1, we cannot iterate over all possible values. Choosing a larger increment improves the running time but reduces the accuracy of the solution. 
In this subsection we describe how we generated our data.
First our data generator allows two parameters as input that determine the number of facilities and the maximum size of a facility. The size of the facilities (i.e., how many people visit that facility in a day) is drawn according to a power law distribution with exponent α (in our experiments α varies between 0.8 and 1.3). We also select an average number of daily activities for a person (i.e., how many facilities a person visits during one day). In our experiments the average number of activities is set between 3 and 8). Then, we set the number of people in a country to be the sum of all the facilities divided by the average number of facilities a person visits during one day.
In Figure 1 we show an example of the distribution of the size of the facilities for 1000 facilities each having a size between 10 and 10000. For each facility v we select size(v) people that will visit that facility uniformly at random from the population, where size(v) is the size of facility v that was generated previously using the power law distribution. The number of activities performed daily by each person form a Poisson distribution (see Figure 2 for an example).
We now show how we generate the weights on the edges. For each person, we choose the time spent in each facility using an exponential distribution.
The chance that a person i caries the virus, i.e., f (i), is also drawn from a power law distribution with exponent α 2 . One important thing to notice is that α 2 influences significantly the risk of the whole population to get infected. More precisely, if α 2 is large (that is, there are few people with high risk of carying the Finally, we have to set the cost of isolating people and the cost of closing facilities. We choose the cost of isolating a person as a fraction of total budget available (this fraction can also be set as an input parameter in our generator). The cost of closing a facility of size s is s x , where x is a random variable drawn according to a Gaussian distribution with mean µ and variance σ (in our tests we vary the µ between 1.1 and 1.2 and σ between 0.3 and 0.5). Finally, the budget is also an input parameter in the generator and we design it as a fraction of the total cost of closing the facilities, generally, between 1% and 30%.
We carry our tests for a population of around 30 000 people. This population is achieved by varying the parameters in our model as: the number of facilities (between 100 and 1 000), the average number of daily activities (between 3 and 8) and the size of each facility (between 4 and 10 000). For each set of parameters we carry out 5 tests and we choose the average risk produced by our algorithm over these 5 tests.
The dataset size is the maximum that our hardware can handle. Nevertheless, we argue that our experiments scale to a larger population. In Figure 4 we show how the risk changes if we change the number of facilities and the size of each facility: the risk has a decreasing trend as the size of our population increases, thus we believe that our algorithm is even better for larger scale instances.
(a) The horizontal axis represents the number of facilities, while the vertical axis represents the risk improvement. The size of each facility is between 4 and 1 000.
(b) The horizontal axis represents the size of each facility, while the vertical axis represents the risk improvement. The number of facilities is 500 and the average number of daily activities performed by a person is 4. Figure 4 : The improvement in the population risk (i.e., the risk of the population after our algorithm, divided by the risk before the run of our algorithm) compared with the size of the instance. The average number of daily activities performed by a person is 4. The budget allocated is 5% of the ammount necessary to close all facilities. With this budget we are able to quarantine 5% of the population. Then, we have α = 1.1 and α 2 = 2. Observe that the improvement is bigger as the population increases.
Next, we show how the split of the budget between isolating people and closing facilities influences the total risk. In our tests we have 500 facilties between 4 and 1 000 people, each person performs on average 4 activities per day and we have α = 1.1, α 2 = 2. The cost of the exponent of the random variable that determines the cost of closing the facilities is drawn from a normal distribution with µ = 1.1 and σ = 0.4 (Figure 5a and Figure 6a ), σ = 0.5 ( Figure 5b and Figure 6b ). The budget is 10% of the cost of closing all facilities in Figure 5 and 1% in Figure 6 . This budget suffices to isolate 10% of the population, respectively 1%.
Notice that with a budget of only 1% from the cost of closing all facilities, we are able to lower the risk to less than 20% of the original risk (Figure 6b) . Finally, we tested how does the risk decrease if we take actions quickly. More precisely, we vary α 2 which is the power law exponent that determines the percentage of people that are likely to be already infected. However, we did not notice any major influence of this factor in the total risk if the infection proportion is drawn according to a power law distribution.
Our algorithm was implemented in Python and the tests were carried out on a 2013 MacBook Pro with 2.4 GHz Quad-Core Intel Core i7, and 8GB RAM. The code used for testing and generating data is available on GitHub [7] .
We are aware that NP-hard problems can be formulated as integer linear programms (ILPs) and then solved using dedicated software (e.g., Gurobi [4] or CPLEX [1] ). However, the ILP approach is feasible only for small datasets, which is not the case in this paper.
Nevertheless, for the sake of completeness, in this section we present an ILP formulation of Problem 7. We have the following types of variables. First we have two variables x u , for each person u ∈ U and y v , for each facility v ∈ V . Both variables are either 0 or 1 depending whether the corresponding person is isolated or not, respectively whether the corresponding facility is closed or not. Then, we have variables r u and, respectively, R v , that determine the risk of a person, respectively of a facility. The ILP is presented below.
In this paper we presented a model and an algorithm that aims to help authorities to take more efficient decisions in the fight with COVID-19. Naturally, the most stringent open problem is to test and validate the model and the algorithm on real data. People have a huge mobility nowadays and it is impossible to create a model which is fully accurate. Nevertheless, based on our tests we believe that our model is capable of capturing the most important features of the current situation.
Also, a natural open problem is to tune the input parameters: the probabilities p in the input graph, the cost of closing facilities and isolating people c and c and the contagion risk associated with each person.
Since the economy is under severe pressure under the current lockdown, we expect that some ease of the restrictions will happen soon. Thus, we are hopeful that our model will give the authorities some insight in taking the best decisions. Moreover, as we can see from our experiments, even with a very small budget (sometimes as low as 1% of the total cost necessary to lock down the entire economy), the risk of infection can be decreased significantly. Thus, we strongly believe that, with wise decisions, it is possible to stop the spread of COVID-19 without an economic collapse.