A COVID-19 outbreak has begun in China at the end of 2019 [HWO, 2020] , later spreading to most other countries and causing a large number of infected individuals and deaths. In Italy, the first country to be hit after China, the first confirmed autochthonous case was recorded on February 21, and the first death on February 22 [Statista, 2020] ; the first death in US was recorded on February 28th [Times, 2020] . 1 The outbreak has so far caused at least 4 million recorded cases, and 275, 000 recorded deaths [Worldometer, 2020] , with real numbers estimated at much higher values. In New York City there have been at this time at least 27, 000 deaths, corresponding to 0.335% of the population. Massive regulatory responses have been put in place by most local and central governments, imposing restrictions (that we call lockdown hereafter) on travels and individual freedom. By several measures, the lockdowns have reduced the spread of the virus and the potential mortality. On the other hand, the intensity of the impact of the pandemic, the lockdown policies, and the behavioral response of agents beyond the regulations (spontaneous social distancing, etc.), have greatly impacted the economic production. As of May 7, 2020, the IMF economic projection predict a loss in real GDP in 2020 of 3% worldwide, as opposed to +3.45% in the four years before (2016) (2017) (2018) (2019) . Even with the IMF forecast for the rebound of 5.8% in 2021, the cumulated loss relative over the next two years relative to the trend would be about 4% of World GDP. In the advanced economies, this loss would be 5.65%, including 6.85% in the European Union and 5.8% in the United States, and lower numbers in Asia and Pacific (-3.35%) or Sub-Saharan Africa (-2.9%). These are massive numbers, quite different by areas of the world, and updated regularly with likely higher GDP losses.
It is imperative for most regulatory bodies to balance between the containment of the effects of the outbreak, and the economic impact of the regulatory measures. In this paper we adopt the number of COVID-19 fatalities and the total GDP as proxies for the two effects, and provide a framework to think about costs and benefits. The two indicators have been selected for their reliability: GDP is a standard economic indicator, while mortality, in particular total mortality and its comparison with the expected mortality from previous years, is regularly monitored and made public in many countries. These assumptions allow to determine optimal lockdown policies using optimal control theory.
More specifically, we consider a proxy for containment policies that encompasses the entire set of behavioral responses of agents who reduce consumption, the shut-down of markets themselves and measures that limit people's movements, thus reducing the chances of infection and the availability of labor. We then introduce the cost of a Covid related death for the social planner; for each intervention policy tuned by a control function, we estimate a loss functional combining total Covid related fatalities and overall production loss in a given time frame.
The evolution of the epidemics is then described by a SEAIRD ordinary differential equations model, as specified in Section 3.1 where a sizeable fraction of the population are asymptomatic individuals who can contaminate others. At each time t, the lockdown is measured by an opening level of society (economic activity and social contacts) c(t) ∈ [0, 1], c = 1 being absence of any restriction and c = 0 being the complete shutdown of all activities. 2 Many papers in the recent literature, including [Grigorieva et al., 2020] and various economic papers cited in Section 2.1 below, compute the optimal policy in a general class with only technical restrictions on the policy space; but this contrast with feasibility of the restriction policies, which cannot adjust continuously: more realistically [Yan and Zou, 2008] , restriction measures require a short time to be implemented, and then should be kept constant for a certain time. For these 1 These are the officially recorded dates, and the virus might have been spreading before these times; we record them here as references for the actual dates we will use in simulations.
2 As a normalization, c will be assumed to linearly affect the infection rate and has a concave effect on GDP, see infra.
reasons, we drastically reduce the dimensionality of the policy space, by taking controls which are constant for some minimal period δ, and then transition linearly to the next level in time δ.
The main point of our study is that one can find the various opening levels that avert a sizeable number of deaths without determining an excessive damage to the economy: Figure 1 illustrates the potentials of this analysis, in that deviations from the best policies either cause an excessive economic loss for a residual decrease in death rate, or an undesirably high mortality to prevent a rather minor decrease in GDP. See for instance [Kaplan et al., 2020] for a similar assessment of the trade-offs involved, implicit or explicit in most economic works discussed in next Section. The darker blue curve in Figure 1 reflects the constrained relation between mortality and GDP for different values of the control policy and can be thought as a technical rate of transformation. As we will explain later, it is generally preferable to be closer to the origin. A social welfare function and its indifference curves as in the light blue curve defines an optimal rule -when it exists. Its slope reflects the marginal rate of substitution (MRS) between mortality reduction and GDP losses and under simplifying assumptions, is the inverse of the statistical value of life, as we will explain later. Figure 1 . Mortality and production loss with one single, long lasting lockdown. The optimal choice, see Section 6.2, reduces mortality to 0.26% with a 19.45% GDP loss: the lockdown realizes a sharp containment of mortality, but the constraint of protracted measures causes a dramatic GDP loss. This policy has not been followed by any country.
Figure 1 also suggests that, for some values of the preferred MRS, there could be two tangency points determining a transition of phases, and possible non-uniqueness of solutions. In Section 5.3, we show one simple example of this phenomenon, and argue that it is the effect of a transition of phases in which the optimal control passes from being the absence of any containment, to a more substantial tightening as function of the social cost of COVID-19 deaths a. As a result, at a critical value of a there is coexistence of two optimal controls generating the same value of the loss functional. In addition, the multiplicity of suboptimal controls around the critical value of a, can have relevant social consequences in terms on how to evaluate potential alternatives to a given containment policy. We then argue that, in general, the optimal control is likely to be unique provided that the social cost of COVID-19 mortality is large enough.
We finally consider some examples. Parameters are realistically taken from current observations, and validated by reproducing observed jump in mortality to this day, and GDP reductions due to first lockdown periods. In the examples, we restrict, as mentioned, to simple controls in low dimensional spaces: in the first example, a unique lockdown is imposed at Day 85 till the end of the observed period, a possibility that only few countries (such as Sweden, for instance) seem to have considered; with our choice of time frame, Day 85 corresponds to March 25: as detailed in Section 6.1, this is about when most lockdowns started; in the second example, a partial reopening is realized at Day 120, after a drastic initial lockdown has been imposed between Day 85 and Day 120, a typical situation at the current moment in time in many countries; in the third example, a periodic alternation of lockdowns and reopenings is applied. In the last example, the optimal control leads to herd immunity, which is achieved in such a way as to have very few infected at the time in which the immunity is reached; the optimization has automatically determined the best possible access to herd immunity [Moll, 2020] . All examples are explicitly simulated and optimal controls are numerically determined. We then carry out a sensitivity analysis to evaluate the sensitivity of the results to errors and fluctuations in parameter selection.
2.1. Brief literature review. The number of papers adapting the SIR model to various economic contexts is large and rapidly evolving and it is impossible to make justice to the literature. derive an optimal strategy where the social planner can affect both the contacts from consumption and contacts from production, each of them contributing to a third on the diffusion parameter β. They study the optimal policy using a standard growth model with leisure-consumption trade-offs. Agents react too little to the epidemics because they do not contemplate the impact of their behavior on other agents' infection rate and a lockdown seriously reduce infection and fatalities in flattening the curve, and avoid congestion of ICU units that would increase the fatality rate.
[Eichenbaum et al., 2020] study a standard DSGE model with a SIR contagion. They find that the epidemic causes per se a moderate recession, with aggregate consumption falling down by 0.7% within the year. Optimal containment would lead to a more drastic loss in consumption by 22%. They also discuss the model with various health policies including vaccines, preparedness and other dimensions. [Acemoglu et al., 2020] develop a multi-SIR model with infection, hospitalization and fatality rate depend on age, with three classes of individuals (young, middle-aged and old). They find that targeted containment policies are most efficient. For the same loss in GDP (-24%), the targeted policies reduce mortality by 0.7 to 1.8 percentage points. They also include a stochastic vaccine arrival, not known for sure by the policy maker, and the stochastic process evolves over time. They assume as in [Alvarez et al., 2020 ] that full lockdown is not feasible, as we also assume. In [Alvarez et al., 2020 ] have a SIR model embedded in the growth model. Their optimal policy is to implement a severe lockdown 2 weeks after 1% of the population is infected, to cover 60% of the population, and then gradually reduce the intensity of the lockdown to 20% of the population after 3 months. The absence of testing reduces the welfare. With testing and under the optimal policy, the welfare loss is equivalent to 2% of GDP. Another paper on sequential lockdown with heterogeneous population is [Rampini, 2020] . In particular, he uses a fatality rate of 0.06-0.08% for younger agents and 2.67 to 3.65% for older workers. [Hall et al., 2020 ] study a variant with the minimization of an objective function and Hamilton-Jacobi-Bellman. Basing their fatality rate on 0.8%from the Imperial college study, they argue that the optimal decline in consumption is approximately 1/3rd for one year. They then consider more recent estimates of the fatality rate, around 0.3% across age groups, and argue that the optimal decline in consumption is still around 18%. Our numbers are in line with these numbers. [Gollier, 2020b] , similar to us assumes that a vaccine is ready after a few months (52 weeks in his case). He uses a R 0 around 2 (1.85 on the slides available on line) prior to containment, and the containment policy drives it down to 1, as we do. He uses a value of statistical life of 1 million euros and studies confinement scenarii under notably periodic reinfection rates. In [Gollier, 2020c , Gollier, 2020a , he further explore the ethics of herd immunity and elaborate on lockdowns differentiated by age groups. In particular, he uses (Table 4 of [Gollier, 2020c] ) a valuation of statistical lives depending on age, with the population between 60 and 69 representing 37% of that of individuals below 19, the population between 70 and 79 representing 23% and those above 80% being slightly less than 10% of that maximum value. He further discusses the critical moral hazard issues associated with the epidemic.
Economic consequences associated with demand and transmission mechanisms have been studied in [Guerrieri et al., 2020] : they show that in the presence of multi-sector production, with or without imperfect insurance, it is possible and plausible to have demand shocks in the second round going beyond the initial supply (shutdown shock). They study various aspects such as. labor hoarding and bankruptcy cascades. [Gregory et al., 2020] study the response of the economy in a search framework. The existence of search frictions slows down the recovery, and under reasonable parameter values, the initial lockdown strategy is likely to have long-lasting effects. In their baseline scenario, unemployment increases by 12 percentage points of the labor force for a year, and it takes 4 years to get back to 3 percentage points above the starting point before the lockdown. They find, interestingly, that it is better to have a longer initial lockdown (6 months) and no uncertainty that a shorter lockdown with the risk during 9 to 12 months to face a second lockdown. [Farboodi et al., 2020 ] estimate a SIR model in which the decline in activity comes from the optimal response of agents without intervention, and where immediate distancing in a discontinuous way, until a treatment is found, is a superior policy, to contain the reproduction number. In contrast, [Krueger and Uhlig, 2020] calibrate a model similar to [Eichenbaum et al., 2020] in introducing goods that can be consumed at home rather than in public places and show that a Swedish-type policy of no-lockdown but strong behavioral response by agents reduces the socio-economic costs of Covid by up to 80%.
Last and most related to us, [Garibaldi et al., 2020] analyze the existence of a SIR-matching decentralized equilibrium and analyze the inefficiencies stemming from matching externalities to determine the optimal way to reach herd immunity.
To conclude, in most of the papers cited above, there is an explicit focus on the optimal policy and the difference between the laissez-faire and the optimal policy is important, due to the externality of contagion. What our paper adds is a formal treatment of existence and a discussion of the potential multiplicity of solution and phase transition due to the non-linearity in the transmission mechanisms of the epidemic. Another paper in this spirit by [Łukasz, 2020] finds explicit optimal solutions in a set of constrained policy functions and characterizes in particular the optimal starting date of the lockdown and discusses time-consistency issues.
Our results are only a first indication of a modeling methodology for the search of an optimal trade off between containment of fatalities and reduced loss in welfare. While the parameters of the SEAIR model are related to the current outbreak, a more detailed model needs to consider stratified and geographically dispersed populations, and more elaborate lockdown policies, targeted to regions, industries and population that are more at risk. The following points are in order.
(1) As discussed above, several papers have recently addressed similar questions, with in particular a focus on the optimal lockdown policy in the presence of behavioral response of agents on production, on investment or in consumption, of heterogeneity of the population and on learning on the underlying parameters of the economy. Here, as usual in most current literature on COVID-19, we use an extension of the SIR model, hence assuming that each individual has the same chance of meeting every other individual in the population. 3 More realistically, one would need to consider geographically dispersed populations with long range interactions and communities (in the spirit of [Gandolfi and Cecconi, 2016] for instance).
(2) In this paper, in order to have an accurate model of the dynamics of the pandemic with several classes (susceptible, exposed, asymptomatic, symptomatic, recovered, fatality, natural demographic turnover), and yet be able to prove existence and discuss conditions for uniqueness of an optimal response function, we treat the simpler case where the social planner can directly control the contagion parameter with an instrument that also affects GDP, either influencing the behavior of agents or closing markets. (3) The simulations we provide are based on parameters known at the time of this study, which are also the parameters perceived by policy makers at the time of decision making. With these parameters, we find that the statistical value of a human life that lead to the application of observed levels of lock down is in line with the value employed in actuarial sciences. (4) Given the nature of the virus and its novelty, there is some uncertainty surrounding the parameters, and these are likely to evolve as medical and epidemiological research progresses. The final numbers will only be available gradually, with large testings currently being implemented. Our approach will therefore only allow us to reassess current policies retrospectively, in one way or another, when the uncertainty at the time of decisions will have dissipated. (5) Similarly, the parameters connecting the spread of the diffusion of the virus to the loss of GDP from lockdown are uncertain. We choose a median way in the numbers in our simulations. (6) We remain agnostic in our conclusions and provide sensitivity analysis in describing a range of alternative parameters. The shape of the optimal response in time is relatively invariant to those parameters, but warn that the intensity of the optimal lockdown relies a lot on exact numbers chosen in our simulations. (7) On the economic side, one dimension not analyzed yet is the fact that the loss of GDP -a supply shock here -is likely to produce second round demand effects, leading to a persistence in the recession that our model does not take into account. Another limitation, of a similar spirit, is the ability of the lockdown to be reversible in the short-run, that is, once stopped, assembly lines may need a lag to resume. (8) Another limitation in the benchmark exercise is that the fatality rates vary enormously by age and morbidity, and in particular, the fatality rate is 10 times higher at least between the population below 60 and above 60. Since the lockdown mostly acts through adjustment of the labor force in our model, more analysis is needed to draw consequences about the overall lockdown strategy. We cannot deliver conclusions about the opportunity of the observed lockdown. (9) Another limitation is that our model does not focus on the behavioral response of agents who may have learned about the parameters of the diffusion of the epidemics and reduced the infectivity of the virus independently of the lockdown. We do however believe that there are behavioral responses, but as in , we also believe that there are strong externalities in the contagion process that the purely-selfish individual behavior would not internalize. In that sense, the non-behavioral approach we follow is a proxy for the inefficiency of the decentralized equilibrium approach that leads to excessive contamination of the population. Future work should however relax the lack of behavioral response and investigate the size and sign of the interaction between government regulations and individual responses. (10) Last but not least, contrary to other studies, we limit our welfare analysis to a fixed period if time of the pandemic, one year and one quarter in the simulations. The implicit assumption is that after one year, treatments will have improved and vaccines may be possible. This acts as an extreme capitalization effect: in the future, technology will have improved and this is already integrated in economic calculation of the present time. It is easy to do a sensitivity analysis where the length of time periods is augmented, and investigate whether a new cycle of pandemic and lockdown is needed. The solution we exhibit for the optimal lockdown are therefore useful not only to rationalize the current experience, but also to prepare to the next wave or the next virus. We however introduce this assumption of a fixed and short period of time over which the smoothing occurs because the hope of a vaccine was present in public discussion. 4
In Appendix, we present optimal control problems that would address some of these limitations.
3.1. Epidemic model. We consider SEAIRD, a version of the SIR model ([Chowell et al., 2009] (25) Page 20), with some realistic features taken from current observations of the Covid-19 outbreak. The population is divided into: susceptible (S), exposed (E), asymptomatic (A), infected (I), recovered (R), Covid related deceased (D), and natural deaths (ND). Variables are normalized so that S + E + A + I + R + D = 1. Overall, we consider a natural death rate n. This is compensated by a natural birth rate, that can be considered as the rate of inclusion into the labor force; the natural birth rate is reduced by a factor that can be interpreted as a Covid related slowdown. We assume that affected individuals become first exposed (E), a phase in which they have contracted the virus and are contagious, without showing symptoms. Exposed individuals either develop symptoms at a constant rate κ, becoming infected, or progress into being asymptomatic till healing with rate (1 − )κ. A susceptible individual is assumed to have a uniform probability of encountering every exposed and asymptomatic, and has a probability of coming in contact with an infected severely reduced by a factor s < 1. The parameter s can be thought of as measuring the effect of an isolation policy that has per se no direct effect on the labor force able to participate in economic production. Instead, the probability of all encounters is then affected by the mitigation policies via a factor c(t), that will affect economic activity, as discussed in the next section. Upon encounter, there is a rate β of transmission.
Those who are infected recover at rate γ, or do not recover and die at rate δ; δ/γ is the deaths to recovered ratio to be estimated from current available observations. Asymptomatic recover at rate γ.
The initial population at the onset of the outbreak of a previously unknown virus consists primarily of susceptible, S(0) ≈ 1, and a small fraction of exposed, so that S(0) + E(0) = 1. For the model under consideration the reproduction number has the following expression
with basic reproduction number R 0 = R(0). Notice that the population S + E + A + I + R + D is preserved. This is a consequence of the fact that by including the term n demography replaces all deaths except Covid deaths. 5 3.2. Containment policies. Containment policies are aimed at reducing the spread of the epidemic by reducing the chances of contacts among individuals. This is reflected in the model by a coefficient c(t) that modulates the encounters between susceptible and either exposed, infected or asymptomatic individuals. We assume that the reduction is the same for all groups, as we have already included the effect of symptoms in segregating infected individuals. This justifies the factor c(t) in (1).
The opening level function c(t) takes values in [c 0 , 1] c 0 > 0; c(t) = 1 indicates that there is full opening, and no lockdown measures have been taken, this is, by default, the status at the early stages of the outbreak. The lower bound c 0 corresponds to the infeasibility of a complete shutdown; this features the fact that there will always be a minimum amount of productive activity (e.g. via internet for home production) from private agents that cannot be interrupted. Provided c 0 is small enough, all our results are insensitive to the precise value. Further, to model concrete feasibility of the policy, the control is assumed to be a continuous, piece-wise linear function, with the additional constraints of being constant for long enough time intervals δ; the transitions between the various constant levels are taken to be linear and last at least some δ to model non-negligible friction in policies implementation; the controls are then Lipschitz 6 continuous. The detailed form of c(t) is given in Section 5.1; and several examples are presented in the Section 6. 5 Mathematically, this is easily seen by taking the derivative of S + E + A + I + R + D. In fact, letting
The class of containment policies considered in this work is in sharp contrast with other choices, such as [Grigorieva et al., 2020] , in which all continuous functions are considered as possible controls. Our work is in the spirit of other applied papers [Rahimov and Ashrafova, 2010] , focused on more realizable controls.
4. Economic effects of epidemic and lockdown 4.1. Social planner's objective. We investigate optimal containment policies balancing the effect of overall death vs. loss of production. This includes an a-priori evaluation of the social cost of Covid deaths, embodied in a constant a. The social planner's loss functional (the negative of its utility) W combines production P and the number of new deaths from Covid 7 D (t), as follows:
The social planner minimizes a loss function between an initial period t 0 = 0 and a final period t 1 = T which could be infinity:
is a decreasing convex function of the GDP P (t), and a is the cost of a covid death D(t) for the social planner. The social planner discounts the future at rate r; such discount factor incorporates both the lesser interest for more distant economic consequences and the preference for containing immediate deaths, hence it acts in the direction of flattening the infection curve. Further normalizing the full-capacity GDP to 1, and assuming that the loss function is zero for full capacity, a typical function would be:
For values of σ above 1 (our choice hereafter will be 2), lim P →0
it follows that c = 0 is never reached, and this further justifies the assumption of c ≥ c 0 . We have
As a last remark, with a linear loss function σ = 0, the parameter a can directly be interpreted as the value of life in elasticity with respect to GDP. With higher values of σ, the value of a relates to the value of life in marginal utility of GDP, given the aversion to intertemporal fluctuations in GDP that is characterized by the elasticity of intertemporal substitution introduced in the next section.
4.2. Production and welfare. We take the overall production P to be a linear function of labor. At any given time, the labor force is S + E + A + R, but its effective availability for production is determined by the current opening policy c(t). The link between c(t) and GDP is captured by a function G(c(t))
and it affects GDP as:
Labor availability in the presence of a lock down is not assumed to be linear, as the effects of socio-economic restrictions can be contained by work force substitution or increased productivity. We assume an iso-elastic control
with θ ∈ (0, 1) for reasons discussed in the parameter selection section 6.1. We think of θ as a reduced form parameter that connects the infection spread and the change in GDP.
With these assumptions, the loss function becomes
Existence of a global minimum of the loss functional. In this section we prove the existence of a global minimum over a suitable class of control functions c. More precisely, fix two values δ, δ with δ > 2δ > 0, and let K be the collection of continuous functions
such that there exist α 1 < · · · < α k−1 ∈ [0, T ] and c 0 ≤ β 1 , . . . , β k ≤ 1, with α i+1 − α i ≥ δ for all i = 1, . . . , k − 1, such that c(t) is continuous and
where we have taken α 0 = 0, α k = T . Notice that K is a class of Lipschitz continuous functions with Lipschitz constant bounded uniformly by (1 − c 0 )/δ on [0, T ], as examplified in Figure 2 . Consider η ≤ δ and points of the form x k = kη for k = 1, . . . , T /η . Take k 1 and k 2 such that |k 1 − k 2 | < δ/η. We consider the two possible cases.
(1) Suppose c(x k1 ) = c(x k2 ). Since |x k1 − x k2 | < δ, any c n has the extreme values of the interval [x k1 , x k2 ] exactly at x k1 and x k2 ; for small and large enough n, assuming, without loss of generality, that c n (x k1 ) ≤ c n (x k2 ), we have
for all x ∈ [x k1 , x k2 ]. Hence, in the limit for n → ∞, we have c(x) = c(x k1 ) for all x ∈ [x k1 , x k2 ]. (2) If c(x k1 ) = c(x k2 ), then take x k2 + δ and connecting two values at distance at most from c(x 1 ) and c(x 2 ), respectively. Since this holds for all small , it implies that |x 1 − x 2 | = δ, and that c must be linear in between these points, connecting c(x 1 ) and c(x 2 ) by continuity. Pairs of points in which (2) happens cannot overlap, hence indicate by α 1 , α 2 , . . . , α k−1 be the smallest points of each pair, arranged in increasing order; let α 0 = 0, α k = T ; and let c 0 ≤ β 1 , . . . , β k ≤ 1 be the such that c(x) = β i for x ∈ [α i−1 + δ, α i ] for i = 1, . . . , k. We have shown that c(x) satisfies (13) for these values of α's and β's. This finishes the proof.
Consider now the following minimization problem min c∈K L(c) with L as in (12). We now show that the functional is continuous in c: once this is proved, by Weierstrass Theorem we conclude that a global minimum c * ∈ K of the functional L exists. To prove continuity we use the well-posedness of the S-E-A-I-R-D model. In fact, let X = (S, E, A, I, R, D) and denote by F (c, X) the vector-valued function having as components the right-hand sides of the S-E-A-I-R-D differential equations.
Then we can rewrite the system in vector form
where by assumption the norm 8 of the solution X is such that X ≤ 1 and F is smooth in both variables. Let now c n ∈ K such that c n converges uniformly in [0, T ] to a function c ∈ K. Consider now the solution X n ∈ C 1 [0, T ] of X = F (c n , X), X(0) = X 0 and denote by X ∈ C 1 [0, T ] the solution to
and by the smoothness of F , the boundness of X n and X and the linear dependence of F on c we have the following bounds
From these last two inequalities we get the differential inequality 5.2. The first order optimality conditions. We now derive the first order optimality conditions in the form of Pontryagin minimum principle, [Pontryagin, 2018] , for the constrained optimization problem
where K is the class of controls defined in the previous section. Let X * and c * ∈ K be the optimal pair for the above constrained minimization problem. Then the augmented Hamiltonian is
and considering now
, w 1 and w 2 are two non-negative functions. Set µ = e rt λ and v 1 = e rt w 1 , v 2 = e rt w 2 , then we can express the optimality conditions in terms of the Hamiltoniañ H, i.e.,H * c = 0 whereH * c indicates the derivative with respect to c ofH(c, X * , µ * , v * ), i.e.
where v * 1 , v * 2 ≥ 0 and the vector X * and µ * are respectively the solution of the direct problem and of the adjoint linear problem along the optimal solution c = c * (t), that is
One can use the optimality conditions to compute the optimal control in a larger class of functions and use it as benchmark for the suboptimal control that we find in the class K.
On uniqueness of the optimal control. The functional L in (12) is in general not convex, and there are no reasons to expect uniqueness of the optimal control in K. In fact, in some cases the cost functional appears to undergo a phase transition in the social cost of COVID-19 death a. Typically, real valued functions of systems undergoing a phase transition are convex in one phase and concave in the other (see, e.g., the percolation probability as function of its intensity parameter, [Gandolfi, 2013] , Figure 2. 3), which is a further justification for the observed loss of convexity of L. In addition, at the critical value of a multiple optimal controls can appear.
In the simple case of a unique, long term lockdown imposed at Day 85 to an opening level c, and by a suitable choice of the parameters within the realistic ranges described below in Section 6.1, one can numerically find a value of a for which there are two minimizers of L.
A graph of L is plotted in Figure 5 .3 as function of c. At the selected value of a, an optimal strategy is to exert no lockdown, but another optimal solution is to impose an opening level c = 84. The two solutions have different overall mortality and GDP loss, but the same value of the loss functional, hence they are equivalent for the social planner, and for all those agreeing with her/his parameter selection and perceived social cost of a COVID-19 death. At values of a which seem to better reflect current valuations, that is for a higher value of the social cost of Covid deaths, see Section 6.1, the minimum is likely to occur in the phase in which D(t) is also convex, which is at lower values of c, and therefore it is unique. This is the case in all the examples of the next section.
6. Examples of optimal policies. 6.1. Parameter selection. There is a large variability in the estimations of the COVID-19 infection rate β [Toda, 2020] ; we adopt the average value of β ≈ 0.25. The reduced exposure to infected individuals who have developed symptoms is difficult to estimate: we start from a factor of s = 0.1 and carry out a sensitivity analysis. Duration of the latency period after infection and before symptoms are developed has been estimated in about 5 days (see for example [Li et al., 2020] and [Kai-Wang et al., 2020] ), so that κ ≈ 0.2. The fraction of asymptomatic is also quite problematic, with estimates ranging from 5% to 60%; we take an average value of (1− ) = 1/3, estimated in one of the studies, [Nishiura et al., 2020] . Similarly, the average recovery period is about 7 days, for mild cases [Byrne et al., 2020] , suggesting γ ≈ 0.14 for the recovery rate of an asymptomatic; in general, more severe cases worsen after about 7 days, requiring hospitalization, which completely excludes them from the possibility of transmission: for this reason, we also use the same value of γ ≈ 0.14 for moving these cases from the infected to recovered, where most of them eventually will be; one fraction eventually dies, with the rate discussed now. The death to recovery rate is a highly controversial value, as both the recorded number of infected and deaths are affected by error which could range to 1000%. We take δ/γ ≈ 0.02 in such a way that the overall mortality rate in the population if the epidemics spreads without control ends up being about 1%; this is in line with several studies and observations: [Basu, 2020] estimates a US mortality of 1.3%; the Institute Pasteur indicates 0.53% [Salje et al., 2020] ; and several locations have observed an increase of overall mortality up to six-fold [ISTAT, 2020] ; this is compatible with a COVID-19 death rate of about 1% spread over the two months very likely needed for the uncontrolled virus to infect everyone in a limited area. Finally, the natural mortality rate is taken to be 3 × 10 −5 corresponding to about 12 death per year per 1000, which is an average natural mortality rate in industrialized countries. 9 With these assumptions, the equations become 
As we take as initial time a very early stage of the epidemic outbreak (for all countries except China), we assume that the number of initial exposed is very small, in the order of one in a million; hence we take S(0) = 1 − 10 −6 , E(0) = 10 −6 , A(0) = I(0) = R(0) = D(0) = 0. A more accurate model, taking care of the geographical dispersion of the population would include different contact rates for individual living in far away areas [Gatto, 2020] As a verification of parameter selection, we show that the mortality reproduces current observations, see Figure 4 . Figure 5 illustrates the risk of a restart of the outbreak after the first reopening.
The yearly discount rate r in various developed countries is currently in the range −0.75 to 5.5%; we assume a discount rate of 4% but we check the impact of a wide range of alternative . Covid deaths for an outbreak followed by lockdown at Day 85. Comparison is with real data of NYC. Notice that NYC seems to have a slightly higher transmission rate β, and has imposed a stricter containment policy than the one assumed by the graph of the mortality in our model. Note: the model is calibrated to fit cities or equivalent homogeneous areas and does not represent an entire country. assumptions in the sensitivity analysis. The exponent σ of the function V is taken to be σ = 2, leading to an intertemporal elasticity of substitution within the year of 1/2.
The elasticity parameter θ needs to be considered carefully. To estimate it, we recall that the reproduction number (8) has been estimated in various countries before and after a lockdown, see Table 1 . From (9), at each point in time log P = θ (log c(t)) + log(S + E + A + R) so that, considering two times, t − shortly before, and t + shortly after a lockdown, we have
where in the first approximation, we neglected the variation in the potential labor force S +E +A+ R, sinc,e between t − and t + , the labor force available for production is assumed to be only impacted by the variations in c; the second approximation follows from (8) again neglecting variations in S(t) in the short interval. This gives the estimate Table 1 . Alternative values of θ, from various studies and variants. The world economy in freefall, http://www.oecd.org/economy/ (C) Fed Atlanta GDPNow tracker (8/10/2020) (D) New York Fed Staff Nowcast https://www.forexlive.com/centralbank/!/the-ny-fed-nowcast-tracks-2q-growth-at-3122-20200508 (E) Sweden: Forecast for 2020 are estimated to be between -6.9% and 9.7% by Statistics Sweden and the Riskbank, approx. 2/3rd of the decline in France. https://www.cnbc.com/2020/04/30/coronavirus-sweden-economy-to-contract-as-severely-as-the-rest-of-europe.html Table 1 shows various examples of co-variations of R and instantaneous GDP variations estimating from now-casting studies from various economic and statistical institutions after the lockdown from various countries. The parameters displayed have different sources. Some come from estimates based on data, other are simulated from epidemiologic models, and some are used in calibrations in economic papers, as a way to compare ourselves to the previous studies. The variability in the value of θ in the table is due to this diversity of methods. The range is between 0.166 and 1.142, with an average of 0.27 and a s.d. of 0.12. We select a value of 1/3 that can be adapted to any country or period as indicated in the table. 10
In order to identify the time horizon of our analysis, we make several assumptions about the evolution of the epidemic. In particular, we assume that the policy assessment can be made with a specific time frame in mind, after which technological advancements like a therapy or a vaccine will drastically reduce the negative effects of the infection: [HHS, 2020] and [Le, 2020] predict a vaccine in early 2021, and challenge trials will anticipate things even further. We then assume a prototypical situation in which the epidemic has started unobserved in January 2020, and we assume that it will resolve at the end of the first quarter of 2021, hence we take T = 460 days. Clearly, these periods are only indicative, and one can adapt the time frame when more reliable perspectives are identifiable.
The choice of the social cost a of a Covid death is particularly complex, as it depends on a variety of socio-political and economic factors. We take a value of a ≈ 10, 000. To assess a value of a, note that it implies from Table 7 a decline of GDP of 76.7% from day 85 to day 460, that is a loss of yearly GDP equal to 460−85 365 × 0.767 = 0.7886, that is, a 21.2% decline in yearly GDP. The gain is a decline in mortality of 0.74%. If these numbers where applied to the case of France, with a GDP of 2778 billions USD in 2018 and a population of 67 million, each live saved would correspond to 1.758 million USD. This is smaller than the statistical value of life currently estimated in developed economies, that is closer to 3 million euros [Baumstark et al., 2013] but one has to remember that most of the fatality have been for older individuals. According to various statistical sources [Statista, 2020] , only 10% of the deaths were aged below 65, while 71% were aged above 75. We also report in Appendix Table 11 the fatality rates by age as available from recent studies. This implies that the right value for the statistical value of life in the exercise has to be lower than the usual estimates [Chris P. L., 2009] . Another factor is that the government lockdown was based on lower estimations for the proportion of deaths. The current range is large, going from 0.4% for symptomatic according to the CDC or 0.37% per infected in the so-called Gemeinde Gangelt study in Germany [Streeck et al., 2020 ] to more than 4%.
Note that taking into account the risk aversion of the loss function does not change significantly the numbers involved and the order of magnitudes are preserved: risk-aversion mostly affect the numbers as (0.9) 2 that is by 20% only. To see this, consider a small time interval of length ∆t = 1, so that the loss function is (V(P )∆t + aD) where D is the number deaths over that interval: differentiating the expression along the iso-loss curve, the slope of the iso-loss (indifference) curve is exactly:
hence the adjustment factor is of the order of magnitude of the fraction of loss of GDP P to the square.
It is seen in the examples below that this value of the social cost of Covid death corresponds to prefer a substantial mortality reduction over GDP preservation, a phenomenon that, although sporadically opposed by some political groups, has found substantial support in most industrialized countries [Survey, 2020] . Such value of a is large enough that the optimal control functions determine an effective containment of the spread of the virus; this implies that the minimum of L occurs where the total mortality is also likely to be convex as function of the control, and that the minimum is likely to be unique (see Section 5.3).
We analyze below several examples of containment:
• A first policy is a containment with opening level c until the end of the study period.
• A second policy is a containment with opening level c till day 120, followed by a higher opening level c until the end of the study period. • A third policy is to implement several cycles of alternated higher and lower opening . As the presence of the virus went substantially unnoticed in the early stages in most locations, and then some time we needed to pass the required legislation, we assume that all lockdowns begin on day 85; this corresponds to March 25. Lock down in most countries, except China, started between March 9 and April 23, with a median on March 25 11 . When considering reopening, we use Day 120, which corresponds to April 29. For countries which have substantially reduced containment measures as of May 5th, the median end date of lockdown has been April 24, with about 20 countries still in lockdown.
All the numerical examples below are computed by Matlab R2016, using discretized ordinary differential equations ("ode45" or "ode23tb" functions) and integrals.
6.2. Optimal unique lockdown. We consider in this section a unique lockdown measure imposed on Day 85 (March 25): the opening level is reduced at level c, and these restrictions are kept in place for the entire period, which is till Day 460, April 4, 2021. While this could have been a viable policy, implementing a moderate containment, the extent of the resulting GDP loss turns out to be dramatic. Figure 1 compares production reduction and mortality for the various levels of c. Figure 6 . Comparison between the optimal moblity level and the case of no restrictions.
The optimal opening level is numerically determined to be c = 76.7%. Figure 6 compares the optimal containment policy with the case of no containment; Figure 7 , compares the optimal case with two different policies corresponding to less or more reduced opening levels.
Notice that in case of no restrictions, the total mortality is about 1%, and annualized GDP loss due to passage of the virus is 1.78%. As noted in the Introduction, the lockdown realizes a sharp containment of mortality, but the constraint of protracted measures causes a dramatic GDP loss. Fig. 7 .B, Bottom left: a opening level higher than optimal. Fig. 7 .C, Bottom right: a opening level below optimal. Figure 8 compares the time evolution of the reproduction numbers in the cases of optimal lockdown and no lockdown: notice that the optimal lockdown quickly brings the reproduction number to slightly below 1, keeping it there for the entire period.
6.3. Optimal reopening level. Most countries have imposed severe restrictions after a first period, which is at Day 85 in our model, followed by a sizeable reopening after about two months. To simulate this situation, we assume that at Day 85 the opening level has been fixed at c = 0.5; as the previous example shows, this would not be optimal if imposed for a long time, and it incorporates the assumption of a release after a relative short period. In accordance to the current reopening in many countries, the containment is relaxed to level c at Day 120. Clearly, in this case a loss of production has already been incurred because of the initial containment, and we have selected an opening level that reproduces the observed loss of GDP in the first quarter at an annual rate of 4-5%, see Table 3 , Line 5.
We then numerically determine the optimal level of reopening, which turns out to be at c ≈ 90.1%. Figure 9 compares the optimal solution with non-optimal ones, and a detailed comparison of some of the outcomes is carried out in Table 3 . Figure 9 . Fig. 9 .A, Top: optimal reopening level. Fig. 9 .B, Bottom left: an excessive reopening. Fig. 9 .C, Bottom right: a suboptimal reopening level. Notice that the optimal reopening level achieves a substantial herd immunity by the so called "flattening the curve". Because of that, the mortality reduction reaches 38.43% only, with a more moderate, but still sizeable, annualized GDP loss of 12.02%. Observe that deviations from optimality are extremely ineffective.
The reproduction number in Figure 10 , after drastically decreasing and then going back higher, finally stabilizes around 0.8. Figure 10 . Reproduction number in the case of the optimal reopening. 6.4. Optimal periodic containment. In this section we show some numerical results related to a periodic containment. We assume that after a drastic lockdown at an opening level of c = 0.5, there is a complete reopening, followed by two more lockdowns at an opening level c: we optimize over c, see Figure 12 . Production loss vs. mortality is plotted in Figure 11 ; notice the peculiar effect of too sharp lockdowns when these are reapplied at Days 170 and 230: because of excessive containment, the outbreak restarts later and the mortality ends up being higher even with more GDP loss than with the optimal control. A third lockdown would be necessary in this case. Figure 11 . Production loss and fraction of deaths in a periodic containment; curve is parametrized by the opening level during the two containments that follow a first, fixed one.
The optimal opening level turns out to be c = 72.9%. This solution provides a moderate reduction in mortality with a contained economic damage at an annualized GDP loss of 7.44%, see Table 4 . Herd immunity is reached with a very low number of infected at the time, which is shown in Figure 13 to be approximately Day 250, when the reproduction number is finally set to just below 1. This is the ideal strategy to achieve herd immunity, as discussed in [Moll, 2020] , and it has been automatically identified by the optimization process. . Reproduction number when control is optimized over the opening level during the two containments that follow a first, fixed one.
6.5. Optimization over three parameters. In this example we optimize over three parameters: after a first, fixed containment from Day 85 to Day 120 at opening level c = 0.5, two more containment periods take place, at opening level c 1 , each for a time length τ , interspersed with reopening at level c 2 : we optimize over c 1 , c 2 , and τ . A comparison of the optimal solution with others is in Figure 14 ; a summary is in Table 5 ; and the reproduction number is plotted in 15. 
We provide, in this section, a Sensitivity Analysis (SA) to evaluate how some of the parameters influence the minimum of the loss functional. Initially, SA is performed by a global sensitivity analysis approach using the Sensitivity Analysis tool of Matlab. Then, we also provide a local sensitivity analysis where we calculate the optimal policy varying one parameter at a time.
The global sensitivity approach uses a representative set of samples of parameters to evaluate the loss functional, which includes also the level of lockdown or reopening depending on the numerical experiment under investigation (see previous sections 6.2, 6.3 and 6.5). The workflow is as follows:
(1) For each parameter, including the opening levelc during containment or reopening, we generate multiple values that the parameters can assume, namely we define the parameter sample interval by specifying a uniform probability distribution for each parameter. We create 200 combinations of these parameters.
(2) Then, find the solution of the SEAIRD model and evaluate the loss functional at each combination of parameter values and choose the combination which gives the minimum value of the loss functional. (3) Fixing the "best outcome" combination found in (2), except the opening levelsc, we run again the optimization procedure, used in the previous sections, to find the optimal value of the opening levels for that combination of parameters. Table 6 indicates the ranges for each parameter. As expected, the parameter that carries a greater weight on the functional value is represented by r. In fact, this is clear in Figure 16 , where, as a result of the sensitivity analysis, a tornado plot is displayed. The coefficients are plotted in order of influence of parameters on the loss functional, starting with those with greatest magnitude of influence from the top of the chart.
Below, for each numerical experiment, we provide a table comparing results from the optimal case determined with our methods, and the optimal case after the SA described in (2) and (3) above. For completeness, we also provide a local sensitivity analysis which is a technique to analyze the effect of one parameter on the cost function, and especially on the optimal policy. We take into account, as prototype, the first experiment where the optimal level of lockdown has to be found. See Table 10 . Table 9 . Comparison of the optimal situation of Section 6.5 and of sensitivity analysis 
In this paper, we have formalized the trade-offs involved in the decision making between preserving economic activity and reducing the speed of diffusion of the pandemic. Our premise is that individual agents, as well as governments, want to contain and, possibly, postpone the infection and therefore the risk of a greater number of potential deaths to a later stage ("flatten the curve") in the expectation of better treatments, or a weakening of the virus, or a vaccine; we assume that actions are planned over a relatively short time horizon, that we choose to be 460 days. Our second working assumption is that there is a strong link between the degree of diffusion of the epidemic and the intensity of the economic shock, with an elasticity that varies in time and across countries but seems to be in a range around 1/3. This elasticity is the result of all changes in behavior of agents, from the economic lockdown itself to the greater precautions of consumers who reduce their consumption and firms who favor drastic reductions in working time. We have modeled containment measures by a function describing the level of opening, which we have taken to be piece-wise linear, with additional regularities, to include feasibility; we then formally described the trade-off between mortality reduction and limitation of economic loss which includes an estimation of the social cost a of COVID-19 mortality, and a discount rate which intensifies the effect of early deaths and early economic losses. We discussed the mathematical set-up and proved the existence of at least one optimal containment strategy. A parametric representation of mortality vs. economic losses illustrates the potentialities of the optimization approach.
Optimal control theory helps to find the right balance between the contrasting welfare needs during the COVID-19 epidemic, even when limited to few free parameters. It also sheds light on the possibility of a non uniqueness of the optimal control policy, very likely due to the non convexity of the loss functional. For instance, a transition of phases takes place in terms of the parameter a describing the social cost of COVID-19 mortality: at critical values of a, we observed the possibility of bifurcation towards two local optima and, therefore, discontinuous changes in the optimal policy as function of a. At and below the bifurcation, complete laissez-faire is optimal, but it is never preferred when the statistical value of a life is large enough.
Given that, for most countries, the implied value of the social cost of COVID-19 death a is in a range in which laissez-faire is not a viable solution, we discussed the optimal policies in a restricted set where the opening level can vary only a very limited number of times and where the solution turns out to be unique. Parameters have been estimated from available data, and a sensitivity analysis has been carried out on the main ones. We have analyzed various examples: one unique lockdown to be extended till the presumed end of the epidemic at the end of the first quarter 2021, a strategy that apparently very few countries tried to plan; a drastic, initial lockdown, followed by a reopening, which is what most countries are currently putting in place; some alternation of containment and reopening after the current one, which is a plausible outcome if the regained activity leads to recurrence of the virus. The results shed some light on the trade-offs involved, and suggests that gradual policies of longer duration but more moderate containment have large welfare benefits. On the other hand, after a sharp lockdown has been put in place, an alternation of containment and reopening is worth of consideration.
Finally, we have investigated the sensitivity of the results on the estimated parameters. For most parameters, our results are insensitive to moderate errors in their selection. Among the significant ones, the most relevant has turned out to be the discount rate: this reflects the belief that early economic loss is more damaging, and that early deaths harm the health system and miss the opportunity of some form of adaptation to the virus or more effective treatments. In the examples we have considered a very high value for the discount rate, as we believe that treatment improvements are very likely. It follows that the timing is key to successful implementation of a containment policy, and that this is closely tied to the the pace and of the perspectives of potential technological advancement.
New York University in Abu Dhabi, May 28, 2020. 12 12 We wish to thank Christian Gollier and Benjamin Moll for comments on this draft. Finally, using the continuity of the functional with respect to c, C the existence of an optimal pair c * , C * follows.
Remark 8.2. In other problems, such as the Ramsey second best problem, the social planner may not be able to allocate consumption properly. Instead, private agents in a market economy choose themselves their consumption, maximizing their own utility function, leading to an arbitrage between consumption in different dates, corresponding to the traditional Euler equation in macroeconomics. This constraint is an additional constraint to the social planner and at this stage, our results do not apply to them. 