## Figures

## Abstract

In the framework of homogeneous susceptible-infected-recovered (SIR) models, we use a control theory approach to identify optimal pandemic mitigation strategies. We derive rather general conditions for reaching herd immunity while minimizing the costs incurred by the introduction of societal control measures (such as closing schools, social distancing, lockdowns, etc.), under the constraint that the infected fraction of the population does never exceed a certain maximum corresponding to public health system capacity. Optimality is derived and verified by variational and numerical methods for a number of model cost functions. The effects of immune response decay after recovery are taken into account and discussed in terms of the feasibility of strategies based on herd immunity.

**Citation: **Godara P, Herminghaus S, Heidemann KM (2021) A control theory approach to optimal pandemic mitigation. PLoS ONE 16(2):
e0247445.
https://doi.org/10.1371/journal.pone.0247445

**Editor: **Alessandro Pluchino,
University of Catania, ITALY

**Received: **September 23, 2020; **Accepted: **February 6, 2021; **Published: ** February 19, 2021

**Copyright: ** © 2021 Godara et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **All data files and code are available on github: https://github.com/poss-group/covid19-control.

**Funding: **P. G., S. H., and K. M. H. gratefully acknowledge support from the Max Planck Society.

**Competing interests: ** The authors have declared that no competing interests exist.

## Introduction

The recent outbreak of the illness COVID-19, caused by the SARS-CoV-2 virus, has resulted in a pandemic with unprecedented impact on societies all over the globe. Mitigation measures included complete lockdowns of societal life, with severe psychic, social, and economic consequences [1, 2]. Hence a major focus of governments is on designing containment strategies which are as mild as possible, but substantial enough to limit the severity of the outbreak in order not to overwhelm the health service system (HSS). This requires reliable forecast, based on careful collection of data on the fraction of infected citizens, as well as extensive simulation [2, 3].

We discuss the system in terms of a so-called SIR model [4], referring to the fraction of susceptible (S), infected (I), and recovered (R) citizens in the population. We identify the recovered with all those who are neither susceptible nor infected (*R* = 1 − *S* − *I*); the dynamics are thus fully described by a set of two equations:
(1)
where *S*, *I* ∈ [0, 1] are the fraction of susceptible and infected individuals in the population, respectively. Note that *I*(*t*) denotes the actual fraction of acutely infected citizens at time *t*, no matter whether or not the infection has been realized by the individual, or has even been recorded. The infection of a susceptible individual by an infected is described by the *infection rate β* > 0, while *τ* is the *average duration* of the infection of an individual until her recovery.

The task we address in this study is to limit, during the whole period of the pandemic, the current number of infected individuals such as to prevent the number of those needing intensive care from exceeding the capacity of the deployed HSS. Such control may be described by a control parameter *α*(*t*), which quantifies the effect of mitigation strategies upon the infection rate. We may write *β* = *β*_{0}(1 − *α*), such that *α* = 0 and *α* = 1 correspond to usual societal life and complete mutual isolation of citizens, respectively.

In order to define *α* in a general way, we state that a certain value of *α* = 1 − *β*/*β*_{0} denotes the subset of all possible mitigation measures which lead to an infection rate *β* ≤ *β*_{0}. We thus do not need to refer to any specific measures, but can formulate our approach in a very general way. The (more or less) accurate determination of these subsets is then the task of careful social (e.g., infection history) data analysis among citizens. This is illustrated in Fig 1, where mitigation strategies, followed by the public authorities, are indicated by the dashed and dotted curves, within a space spanned by the effect of the measures upon the infection rate, *α*, and the cost incurred for economy and society as a whole, *f*(*α*).

Sketch of the space of possible mitigation measures (grey shade), spanned by their effect on the infection rate, *α*, and their socio-economic cost, *f*(*α*). Normal societal life is at the origin, while the upper right corner corresponds to total mutual isolation of all citizens, which is the strongest possible intervention. The dashed and dotted curves depict possible choices for mitigation measures. Such curves correspond to the *cost functions* referred to in the manuscript (see Eq (7).

As indicated by the explicit time dependence of *α*(*t*), we follow a control theoretic approach. This is in some contrast to earlier treatments which have assumed mitigation measures to be constant over time [5–8]. Instead, we aim at determining the optimal function *α*(*t*) which minimizes the impact on society, while at the same time avoiding the HSS to become overloaded. At the end of the mitigation scenario, *herd immunity* shall be reached, so that the epidemic comes to an end without further control. We do not consider potential vaccination scenarios here (as is done elsewhere [9, 10]), so immunization can only be achieved via infection with the virus in the present study.

A dimensionless quantity which is frequently used in epidemiology is the *reproduction number*, *R* ≔ *βτS*, which denotes the average number of susceptibles infected by one infected individual. At the beginning of an epidemic (*S* ≈ 1) and without mitigation measures deployed (*β* = *β*_{0}), one observes the *basic* reproduction number *R*_{0} = *β*_{0}*τ*. In case of the COVID-19 pandemic, typical estimates are *R*_{0} ≈ 3 [11] and *τ* ≈ ten days [1, 12]. It has been shown before that the inherently random, network-like structure of interactions between individuals mainly results in a readjustment of *R*_{0} [13]. Hence we follow a mean field approach, disregarding small scale inhomogeneities of the system. We consider a homogeneous scenario, where *β*(*t*) depends on time, but is spatially constant. Defining a normalized time variable, *θ* ≔ *βt*, we can rewrite Eq (1) as
(2)
The trajectory of the system in the *S*-*I*-plane, *I*(*S*), can be obtained by dividing the equations displayed in Eq (2) by each other. This yields
(3)
which has the solution:
(4)
where *C* is a constant of integration. When no mitigation measures are in place (*α* = 0), we have *I*(1) = 0 and thus obtain
(5)
This is plotted as the dashed curve in Fig 2 for the case *R*_{0} = 3. The maximum turns out to occur at *S*_{peak} = 1/*R*_{0}, where it reaches a value of
(6)
At *S* = *S*_{peak} = 1/*R*_{0}, the population has reached *herd immunity* since from then on the number of infected citizens decreases until zero.

Dashed curve: trajectory with no mitigation starting at (*S*, *I*) = (1, 0), *R*_{0} = 3. Horizontal dashed line: maximum load of the HSS, *I*_{h} (here we have set *I*_{h} = 0.1 for clarity, although this is unrealistically large). Solid curve: trajectory, (*S**(*t*), *I**(*t*)), for an optimal choice of *α*(*t*) (see Eq 16). The corresponding characteristic of *α*(*S*) follows the dash-dotted curve in phase II, the *mitigation phase*. There is no mitigation in phases I and III (*α* = 0).

If the disease is serious, one is faced with the problem that with a fraction of *I*_{peak} people being infected, the number of those in need of hospitalization or even intense care may exceed the capacity of the HSS. We denote by *I*_{h} < *I*_{peak} the maximum fraction of infected citizens which can be managed by the HSS. It is limited by infrastructural aspects, such as the availability of staff or the size and areal density of hospitals, and is indicated by the horizontal dotted line in Fig 2. Any substantial overshoot of the dashed curve over the dotted line constitutes a catastrophe, as a major fraction of the population will then not receive proper health care or treatment. This must clearly be avoided by means of suitable measures, such as reducing mutual contacts between individuals, banning major assemblies, reducing mobility etc., thus reducing the infection rate. Such measures are described by the parameter *α*(*t*), which is to be discussed next.

## Optimal control problem

It is clear that the aforementioned measures will have a more or less substantial impact on society, mainly through their detrimental effects on economy, but also through other societal (e.g., cultural) damage. This may be described by means of a *cost functional*,
(7)
where the cost function *f* corresponds to the mitigation strategy chosen, i.e., the curve chosen in Fig 1. It denotes the cost incurred at a given control *α*, along with the assumption ∂*f*/∂*α* ≥ 0 ∀*α*; later we will require . Convexity of the cost function is a reasonable assumption since one can imagine that chosen mitigation measures become more and more costly as *α* approaches unity. In principle, *f*(⋅) could depend on time *t* explicitly or involve memory, e.g., because prolonged measures cause disproportinally higher cost. For simplicity, we do not treat such cases here.

The control problem we choose to address is to find a control trajectory, denoted by the function *α*(*t*), such that the impact on society, as described by *K*, is being minimized under the constraint that *I*(*t*) never exceeds *I*_{h} (capacity of the HSS) and at the end of mitigation—at *unknown* terminal time *t*_{e}—herd immunity is reached, i.e., *S*(*t*_{e}) = 1/*R*_{0} (end of phase II in Fig 2).

We thus need to
(8)
where * x* = (

*S*,

*I*), and

*(*

**h***,*

**x***α*(

*t*)) as given by Eq 1 (with

*β*=

*β*

_{0}(1 −

*α*)). Minimization of mitigation time is covered by setting

*f*(⋅) ≡

*const*.

Solving Eq 8 can be recast into minimization of the following functional:
(9)
where **λ**(*t*) = (λ_{S}(*t*), λ_{I}(*t*)), *μ*(*t*)) are Lagrange multipliers. The introduction of *μ*(*t*) for the inequality constraint introduces additional constraints on *μ*(*t*), namely *μ*(*t*) ≥ 0 and the complementary slackness condition *μ*(*t*)(*I** − *I*_{h}) = 0. These are also known as KKT conditions [14]. The star (*) represents the optimal quantities. Additionally, *S*(*t*_{e}) = 1/*R*_{0} and * x*(0) =

*x*

_{0}need to be enforced.

The necessary conditions for optimality can be evaluated by setting the first variation of Eq 9 to zero (for a detailed derivation see S1 Appendix), we obtain:
(10)
(11)
(12)
(13)
(14)
(15)
In addition to these, one also has the optimal system dynamics . The necessary conditions become sufficient conditions if * h*(

*x*,

*α*) and

*f*(

*α*) are convex in

*x*and

*α*[15]. The former can be checked to be valid for the SIR model and the latter implies that .

The task remains to find Lagrange multipliers **λ**(*t*) and *μ*(*t*) which simultaneously satisfy the above conditions. This task usually involves a numerical search for the initial conditions of the Lagrange multipliers and evolve the system of ODE’s until the terminal conditions given by Eqs 10 and 13 are met. We escape the numerical difficulties arising with this procedure by first guessing a solution and then finding the appropriate Lagrange multipliers which verify optimality.

### Heuristic approach

Let us first consider what is necessary to keep the fraction of infected citizens at a constant value, *I*_{c}. Since *S* varies with time, *dI*/*dt* = 0 entails *dI*/*dS* = 0, and hence from Eq 3 we obtain
(16)
This is indicated by the dash-dotted curve in Fig 2. Note that *α*(*t*) does not depend on the value of *I*_{c}.

Next we consider the cost function for proceeding from some *S* = *S*_{0} to some *S* = *S*_{1} < *S*_{0} while maintaining *I* = *I*_{c}. Inserting Eq 16 in Eq 1, we find
(17)
We use this substitution to express the cost function as
(18)
Hence if *S*_{0} and *S*_{1} are fixed, *I*_{c} must be as large as possible to minimize *K*. This now guides our heuristic: we should control *α* such as to maintain *I* = *I*_{h} for as long as possible.

If our guess is valid, the trajectory we have to follow in order to optimally control the pandemic is the one indicated as the solid curve in Fig 2. It starts at (*S*, *I*) = (1, 0) and proceeds until *I* = *I*_{h} is reached. This completes phase I of the process, during which we set *α* = 0. Mitigation measures are then deployed, such that *α* jumps upwards to the dash-dotted curve. It follows that curve all through phase II, hence keeping *I* = *I*_{h} constant. As *S* decreases, *α* is gradually reduced until it reaches zero at the end of phase II. All through phase III, *α* is maintained at zero, while *I* gradually decays to zero because *R* < 1. This ends the pandemic.

### Validation of the solution

We now proceed to verify our heuristic solution. We focus on phase II, as this is where the pandemic will spend the most amount of time. To do this we ask the question: Is it true that if the pandemic starts with *I*_{0} = *I*_{h}, then for all *S*_{0} > 1/*R*_{0} and for all the cost functions *f*(*α*(*t*)) such that , optimal pandemic control must keep *I*(*t*) = *I*_{h} until is reached?

As we will see, the answer to the above question is yes. We proceed by setting and for and . The terminal conditions for the dynamics are given by . We can substitute the terminal conditions in Eq 10 and get the terminal condition for λ_{S} (the terminal condition for λ_{I} is given by Eq 13). The task remains to find *μ*(*t*) such that Eqs 11 and 12 are satisfied simultaneously.

Let’s have a look at Eqs 11 and 12 after making the substitutions. We have
(19)
and
(20)
One can hence find the Lagrange parameter *μ*(*t*) as
(21)
Lastly, there is also the issue of non-negativity of *μ*. If we assume the convexity of *f* we have . Hence the second summand in Eq 21 is non-negative. also implies that λ_{S} is monotonically increasing (Eqs 19 and 20). If the cost of zero control is zero, then the terminal condition Eq 10 implies that , thereby implying λ_{S}(*t*) ≤ 0 in the interval . This shows that for time independent cost functions *f* under the assumptions that and *f*(0) = 0 our heuristic solution is optimal in phase II.

### Numerical results

We have shown that an optimal trajectory starting on the boundary (*I*_{0} = *I*_{h}) remains on that boundary. To obtain optimal control trajectories for arbitrary initial conditions, we perform direct numerical optimization using the software library PSOPT [16]. In Fig 3 we show the numerical solutions to the control problem Eq (8) for various cost functions *f*_{i}(*α*(*t*)) ∈ {*α*(*t*), *α*^{2}(*t*), *α*^{3}(*t*)}.

Optimal control trajectories for different cost functions *f*_{i}(*α*(*t*)) ∈ {*α*(*t*), *α*^{2}(*t*), *α*^{3}(*t*)}. The corresponding optimal terminal times, , are determined as {65.99*τ*, 66.13*τ*, 66.31*τ*}. *I*_{0} = 0.0025, *I*_{h} = 0.01, *R*_{0} = 3, . *R*_{∞} is the asymptotic reproduction number for *t* → ∞, given by *R*_{∞} = −*W*(exp(−1 − *R*_{0} *I*_{h})), with the Lambert *W* function.

Clearly, in all scenarios the optimal trajectory *I** reaches the threshold value *I*_{h} and remains there until is reached (phase II). Phase I, however, depends on the cost function applied. For linear costs, *α*(*t*) = 0 until *I* = *I*_{h}. With higher order cost terms, we observe non-zero control from the very beginning (see Fig 3). This is to reduce the amount of time spent at large control values *α* and thereby the total integrated costs. The optimal terminal time increases with the order of the cost function (see Fig 3). We should note, however, that the influence of the functional form of *f*(*α*(*t*)), as expressed in the different shapes of the numerically derived curves, is minute, since the time axis is logarithmic, and the deviations are noticeable only during a very small fraction of time. Hence we see that the influence of the cost function, which corresponds to the chosen mitigation strategy, is finite, but can be regarded as *negligible* for practical purposes.

## Duration of the pandemic

If immune response acquired after recovery from an infection is permanent, the pandemic will last until herd immunity is reached at the end of phase II. This is when *S*(*t*) = *S*_{1} = 1/*R*_{0}, as indicated by the left vertical dotted line in Fig 2. This is the start of phase III, in which the number of infected citizens decays with no mitigation measures anymore in place (i.e., at *α* = 0). We will now discuss the time we expect it to take until this point is reached. Using Eq (17) with *I*_{c} = *I*_{h}, we can write
(22)
and hence for the total duration of the pandemic, *T*_{0}, until herd immunity is reached,
(23)
Here we have exploited the fact that in all cases of practical relevance, *I*_{h} will be very small as compared to unity. Consequently, the duration of phase I will be very small as compared to phase II, such that the evaluation of the true duration of phase I is of minor importance. As a very good approximation, we have simply set *S*_{0} = 1 and neglected the impact of *α*(*t*) on the dynamics for the short period of phase I.

### Influence of immune response decay

The introductory discussion was based on the idea that recovered patients stay immune for all times. However, it is well known that for some diseases, in particular of the SARS-CoV type, the immune response tends to decay after some time [17]. Hence there is some finite probability that recovered patients become susceptible again.

We now assume that the transition from the recovered to the susceptible state can be described as a Poisson process. In other words, we assume the probability that a randomly chosen, formerly infected citizen becomes susceptible in a time interval [*t*, *t* + *dt*] to be proportional to *dt* and independent of *t*. This modifies the dynamical system (1) to
(24)
with *β* = *β*_{0}(1 − *α*), and *ρ* the average life time of the immune state, averaged over all formerly infected individuals. Note that we conceptually include those who fell victim to the disease and thus do not become susceptible again. Their contribution to the average resusceptibilization frequency is zero, which merely increases the average immune lifetime, *ρ*. From the data in [17], we find that after three years the average IgG immune response against SARS-CoV had decayed to 55.6 percent. For a corresponding Poissonian process we can estimate *ρ* ≈ 931 days.

In Eq 24, we see immediately that the conditions to fulfill ∂_{t}*I* = 0 have not changed with respect to Eq 1. Hence the optimal control trajectory still obeys . In phase II, with optimal control, we obtain
(25)
with the solution
(26)

Again, herd immunity (and hence the end of the pandemic) is reached when *S* = 1/*R*_{0}, at a time we call *T*_{r}, referring to resusceptibilization (i.e., decaying immune response). Inserting this into Eq 26 yields
(27)
and hence
(28)
Although this looks rather awkward, it can be rewritten conveniently in terms of the pandemic duration, *T*_{0}, which we would find for infinite *ρ*. Defining the variable *X* = *T*_{0}/(*τ* + *ρ*), we find
(29)
*X* is the total duration of the pandemic if no loss of immunity occurs, divided by the average time it takes for a patient from her infection to the loss of immunity after recovery, *τ* + *ρ*. If immunity lasts very much longer than *T*_{0}, *X* is small. In this case, the logarithm in Eq 29 can be expanded and we recover *T*_{r} ≈ *T*_{0}. If, however, *ρ* is of order *T*_{0} (remember that *T*_{0} ≫ *τ* in all relevant cases), *T*_{r} diverges. This behavior is summarized in Fig 4a, in which *X* is chosen as the abscissa. We see that the duration of the pandemic becomes uncomfortably large when the total time from infection to resusceptibilization, *τ* + *ρ*, comes close to the pandemic duration with infinite immunity, *T*_{0} (vertical dotted line).

(a) The normalized duration of the pandemic, *T*_{r}/*T*_{0}, as a function of the variable *X* = *T*_{0}/(*τ* + *ρ*) (Eq 29). (b) Solid curves: The minimum required health system capacity to reach herd immunity (Eq 30) as a function of the duration of immunity after recovery, for different values of *R*_{0} (from 1.5 to 4.0 in steps of 0.5). Dotted curve: limit *R*_{0} → ∞. Circles represent the scenario for *ρ* = 93*τ*. Open: *I*_{h} = 0.01. Closed: *I*_{h} = 0.0025.

We might now ask how many acute infections the health system must be able to deal with in order to reach herd immunity at all. This can be derived by demanding lim_{t→∞} *S*(*t*) = 1/*R*_{0} in Eq 26. It is readily shown that the health system capacity required for reaching herd immunity is given by
(30)
This is shown in Fig 4b for different values of *R*_{0}. The dotted curve represents the (unrealistic) limiting case *R*_{0} → ∞.

Only with infinite immune response lifetime (*ρ* → ∞), we observe an exponential decay of *I* after herd immunity has been reached (see also Fig 3). To understand the long time dynamics after mitigation (phase III) for finite *ρ*, we draw the phase portrait (see Fig 5). There exist two fixed points, (*I*_{1}, *S*_{1}) = (0, 1), a saddle for *R*_{0} ≥ 1, and , a stable fixed point for *R*_{0} ≥ 1 (see S1 Appendix for details on the linear stability analysis). So for any initial conditions with *I*_{0} > 0, the uncontrolled system will approach the stationary state, (*I*_{∞}, *S*_{∞}). Interestingly, the stationary fraction of infected coincides with the minimal HSS capacity needed to reach herd immunity.

Phase portrait, , for the uncontrolled SIR model (*α* = 0) with finite immune response (Eq 24). The solid green curve shows a trajectory in phase III, with initial conditions (circle) *I*_{0} = *I*_{h} (capacity limit) and *S*_{0} = 1/*R*_{0} (herd immunity), The dashed curves (orange) show the nullclines, (for *S* = 1/*R*_{0} or *I* = 0), and (for *S* = (1 − *I*)/(*IR*_{0} *ρ*/*τ* + 1)). The stable fixed point (diamond) is given by , *S*_{∞} = 1/*R*_{0}. Parameters: *R*_{0} = 3, *ρ*/*τ* = 93, *I*_{h} = 0.01.

We have thus shown that given , herd immunity can be reached in finite time during mitigation phase II. After mitigation measures have been released (phase III), *I* converges to in the long time limit. Moreover, *I* remains below *I*_{h} (see Fig 5) since re-entering the regime *I* < *I*_{h} from above would require a trajectory to cross itself (not possible for an autonomous system of ODEs (Eq 24) with unique solutions).

## A few scenarios

Let us finally consider a few scenarios for some typical parameters, as we have in the current COVID-19 pandemic. The maximum number of known acute infections in Germany in spring 2020 was around 100.000, which was well tolerable for the HSS. Depending upon the percentage of cases which are officially recorded, the actual number of infected citizens may be considerably larger. If we assume a factor of two here, corresponding to 200.000 cases, we have *I*_{h} ≈ 0.0025 (given ≈80 million citizens in Germany). On the other hand, if there are more, and if we also take into account that the HSS could well take a few more patients, we might also consider a scenario with 800.000 acute infections at a time, corresponding then to *I*_{h} ≈ 0.01. In both cases we also have to vary the average lifetime of the immune state, *ρ*, and observe its effect on the duration of the pandemic.

The two sets of scenarios are represented in the graphs in Fig 6. The remaining fraction of susceptible citizens is shown as the solid curves, while the dashed curves represent the control parameter, *α*. As before, we have assumed *R*_{0} = 3 for the basic reproduction number. We take the value *ρ* = 931 days mentioned above for another SARS-CoV strain as a reasonable estimate. Using *τ* = ten days, this corresponds to *ρ* = 93*τ*. In order to cover this case, we have used the values *ρ*/*τ* = {50, 93, 200, ∞}. For Germany, an HSS capacity of *I*_{h} = 0.01 (top (a) graph) would correspond to roughly 32% of hospital beds. We do not consider the need for intensive care units here, one reason being lack of knowledge about the fraction of ICU cases. (500.000 in total) utilized for patients with COVID-19, if we assume a hospitalization rate of 20%. This is a conservative estimate given that the number published by the Robert Koch Institute [18] (17%) is based on reported cases only; the true hospitalization rate might be significantly lower. The bottom (b) graph corresponds to a smaller HSS capacity (*I*_{h} = 0.0025), for Germany, corresponding to 8% utilization of hospital beds.

Solid curves: *S*(*t*). Dashed curves: *α*(*t*). The fraction of acutely infected citizens is kept at *I*_{h} in phase II until herd immunity is reached (*S* = 1/*R*_{0}, horizontal dashed line). If this is successful (if , see Eq 30) phase III begins: Mitigation measures are being released (*α* = 0) and *S*(*t*) oscillates around its limiting value *S*_{∞} = 1/*R*_{0}. Other parameters: *R*_{0} = 3, *τ* = 10 days.

From the steadily decreasing dashed curves representing *α*(*t*), it is obvious that the mitigation measures can be gradually alleviated as time proceeds. In the top (a) graph (*I*_{h} = 0.01) for infinite immunity (*ρ* → ∞), one would reach the end of mitigation measures after about two years (= 66.7*τ*, with *τ* = 10 days). This is, however, hardly realistic. For the more realistic case, *ρ*/*τ* = 93, it would take about three years (≈ 114.9*τ*). For an HSS capacity of *I*_{h} = 0.0025, bottom (b) graph, clearly, there would be no chance to ever reach herd immunity for *ρ*/*τ* = 93. Instead, one would not reach any further than *α* ≈ 0.5, which still corresponds to rather harsh measures.

It should finally be noted that the number of fatalities is limited for all cases where herd immunity is reached. In particular, if *ϕ* is the fraction of fatalities among those which are infected, the fraction of fatalities with respect to the population is for infinite *ρ*. If *ρ* is finite, we find
(31)
This is precisely the scaling described by the curve displayed in Fig 4a, which shows that already well below *X* = 1, the death toll incurred by the herd immunity strategy becomes prohibitively high if immune response decay plays a significant role.

## Conclusions

We have shown that for a wide class of cost functions, in order to reach herd immunity without vaccination, it provides an optimal control strategy to keep the effective reproduction number, *R*, at unity during the majority of the duration of the pandemic. Deviations which depend upon the specific form of the cost function are limited to a narrow time window and can be considered negligible for practical purposes.

Reducing *R* can be achieved through various measures, e.g., increased hygiene, physical distancing, or contact tracing [19]. Keeping *R* at the critical value of unity—above which epidemic spreading sets in—is, however, hardly feasible in practice, due to uncertainties as well as observation delays concerning the effects of mitigation measures. Development of robust optimal control scenarios taking such uncertainties into account is left for future investigations.

In this study, costs incurred at time *t* have been considered local in time. Cost functions nonlocal in time (with a memory kernel) would be an interesting extension but go beyond the scope of this work. Costs associated with the number of infections have not been considered explicitly. Instead we kept the number of infections below an upper bound, e.g., the capacity limit of the health service system (HSS). Of course there are societal costs due to infections even below the limit of the HSS. However, if herd immunity is the goal and vaccination is not available, then there is no way around a fraction of 1 − 1/*R*_{0} of the population going through the infection. Moreover, the effectiveness of specific mitigation measures can depend on the number of infections; while contact tracing is an efficient measure for low case numbers, local health authorities can be overwhelmed if case numbers are high [20, 21]. Therefore, the socio-economic costs for establishing a given reproduction number *R* might depend on *I* as well. Here we focused on simple costs functions as a starting point allowing for analytical treatment.

Explicit expressions for the expected duration of the pandemic have been given, and we have seen that the duration of the pandemic increases strongly as the average lifetime of the immune state decreases. In particular, we can conclude that in case the immune response to SARS-CoV2 decays in a similar manner as for the formerly encountered SARS-CoV1 strain [17], using infection mediated herd immunity as a vaccination strategy for SARS-CoV2 would require a substantial fraction of health system capacity dedicated to COVID-19 patients (see Fig 6). However, as a consequence of global mobility there may be more pandemics coming which show different infection and immune response behavior. We therefore think that our results should be borne in mind for future use, as they are of rather general nature.

## Materials and methods

Simulation code and data can be found in the following repository: https://github.com/poss-group/covid19-control.

## Supporting information

### S1 Appendix. Detailed derivations.

1) First order necessary conditions for optimality. 2) Stability analysis of the uncontrolled SIR model with finite immune response.

https://doi.org/10.1371/journal.pone.0247445.s001

(PDF)

## References

- 1.
World Health Organization. Report of the who-china joint mission on coronavirus disease 2019 (covid-19); 2020. Available from: https://www.who.int/docs/default-source/coronaviruse/who-china-joint-mission-on-covid-19-final-report.pdf.
- 2. Enserink M, Kupferschmidt K. With COVID-19, modeling takes on life and death importance. Science. 2020;367:1414. pmid:32217707
- 3. Dehning J, Zierenberg J, Spitzner FP, Wibral M, Neto JP, Wilczek M, et al. Inferring change points in the spread of COVID-19 reveals the effectiveness of interventions. Science. 2020;369 (6500). pmid:32414780
- 4. Hethcote HW. The mathematics of infectiuous diseases. SIAM Review. 2000;42:599–653.
- 5. Harko T, Lobo FSN, Mak MK. Exact analytical solutions of the Susceptible-Infected-Recovered (SIR) epidemic model and of the SIR model with equal death and birth rates. Applied Mathematics and Computation. 2014;236:184–194.
- 6.
Gros C, Valenti R, Schneider L, Valenti K, Gros D. Containment efficiency and control strategies for the Corona pandemic costs; 2021. Available from: https://arXiv.org/abs/2004.00493.
- 7. Zlatić V, Barjašić I, Kadović A, Štefančić H, Gabrielli A. Bi-stability of SUDR+ K model of epidemics and test kits applied to COVID-19. Nonlinear Dynamics. 2020;101(3):1635–1642. pmid:32839639
- 8.
Ferguson N, Laydon D, Nedjati Gilani G, Imai N, Ainslie K, Baguelin M, et al. Report 9: Impact of non-pharmaceutical interventions (NPIs) to reduce COVID19 mortality and healthcare demand. Imperial College London; 2020. Available from: http://spiral.imperial.ac.uk/handle/10044/1/77482.
- 9.
Perkins A, Espana G. Optimal control of the COVID-19 pandemic with non-pharmaceutical interventions. Epidemiology; 2020. Available from: http://medrxiv.org/lookup/doi/10.1101/2020.04.22.20076018.
- 10.
Djidjou-Demasse R, Michalakis Y, Choisy M, Sofonea MT, Alizon S. Optimal COVID-19 epidemic control until vaccine deployment. Infectious Diseases (except HIV/AIDS); 2020. Available from: http://medrxiv.org/lookup/doi/10.1101/2020.04.02.20049189.
- 11. Liu Y, Gayle AA, Wilder-Smith A, Rocklöv J. The reproductive number of COVID-19 is higher compared to SARS coronavirus. Journal of Travel Medicine. 2020;27(2):taaa021. pmid:32052846
- 12. He X, Lau EH, Wu P, Deng X, Wang J, Hao X, et al. Temporal dynamics in viral shedding and transmissibility of COVID-19. Nature Medicine. 2020;26(5):672–675. pmid:32296168
- 13. Parshani R, Carmi S, Havlin S. Epidemic Threshold for the Susceptible-Infectious-Susceptible Model on Random Networks. Physical Review Letters. 2010;104:258701. pmid:20867419
- 14.
Kuhn HW, Tucker AW. Nonlinear Programming. In: Proceedings of the Second Berkeley Symposium on Mathematical Statistics and Probability. Berkeley, Calif.: University of California Press; 1951. p. 481–492. Available from: https://projecteuclid.org/euclid.bsmsp/1200500249.
- 15. Mangasarian OL. Sufficient Conditions for the Optimal Control of Nonlinear Systems. SIAM Journal on Control. 1966;4(1):139–152.
- 16.
Becerra VM. Solving complex optimal control problems at no cost with PSOPT. In: 2010 IEEE International Symposium on Computer-Aided Control System Design. IEEE; 2010. p. 1391–1396.
- 17. Wu LP. Duration of Antibody Responses after Severe Acute Respiratory Syndrome. Emerging Infectious Diseases. 2007;13:1562. pmid:18258008
- 18.
Robert Koch Institute. Coronavirus Disease 2019 (COVID-19). Daily Situation Report of the Robert Koch Institute 29/04/2020; 2020. Available from: https://www.rki.de/DE/Content/InfAZ/N/Neuartiges_Coronavirus/Situationsberichte/2020-04-29-en.pdf?__blob=publicationFile.
- 19.
Bulchandani VB, Shivam S, Moudgalya S, Sondhi SL. Digital Herd Immunity and COVID-19; 2020. Available from: http://arxiv.org/abs/2004.07237.
- 20.
Contreras S, Dehning J, Mohr SB, Spitzner FP, Priesemann V. Towards a long-term control of COVID-19 at low case numbers; 2020. Available from: https://arXiv.org/abs/2011.11413.
- 21. Contreras S, Dehning J, Loidolt M, Zierenberg J, Spitzner FP, Urrea-Quintero JH, et al. The challenges of containing SARS-CoV-2 via test-trace-and-isolate. Nat Commun. 2021;12(1):1–13. pmid:33452267