The emergence and re-emergence of infectious diseases represent a major threat to public health and may cause heavy economic and social losses. Recent epidemics of Ebola in West Africa and MERS-CoV in South Korea highlighted once again the requirement for strong public health interventions for fast disease eradication [1, 2] .
In a similar way, outbreaks of infectious diseases in domestic animals may cause significant consequences for both the sustainability of the livestock industry and the costs associated to disease surveillance, control, and eradication. Moreover, the economic burdens imposed by livestock diseases exceed the agricultural compartment, by affecting also commerce, tourism, and even human health in the infected areas. Consequently, minimizing the time period needed for outbreaks eradication in the affected areas represents a public health priority.
There exist several examples of livestock epidemics causing huge sanitary and economic impacts, such as the 1996 epidemic of classical swine fever in The Netherlands [3] , the 2001 epidemic of foot-and-mouth in the UK [4] , and the 2015 epidemic of high pathogenic avian influenza in Midwestern USA [5] . From the epidemiological point of view, the main indicators generally used to describe the severity of these infection events in livestock are: (i) the total number of infected animals and farms during an epidemic, and (ii ) the duration of the epidemic. The rationale behind these indicators is based on the evidence that epidemic surveillance and control costs are directly related to spatial and temporal extension of the epidemic events [6] . Furthermore, the effect of the epidemic duration on the socio-economic burdens associated to livestock diseases is larger than in human diseases. This is due to the sanitary restrictions imposed to farms in infected areas during ongoing outbreaks, such as animal movement and export bans. Moreover, the block or the restriction of farm activities can go over the time of infection, carrying on until the diseasefree status is formally regained [7] . Examples of costly restrictions for the livestock industry include: the export ban of UK cattle because of the 1996 bovine spongiform encephalopathy epidemic [8] and the export ban of poultry and poultry related products in Hong Kong, Laos, Thailand, and The Netherlands due to outbreaks of highly pathogenic avian influenza [9, 10, 11] .
By using a stochastic modeling framework for classical swine fever in The Netherlands pig farms, Mangen et al. [12] showed that the increase of the epidemic duration affects the sanitary costs associated to disease outbreaks more than a proportional growth in the number of infected farms. This prediction followed from the observation that longer epidemics are more widespread, involving a larger number of animals slaughtered. The estimate of the epidemic duration appears almost invariably in the simulation outputs of data-driven mathematical models developed to evaluate the effectiveness and the efficiency of surveillance and control policies for several infections in livestock, such as foot-and-mouth disease [13] , classical swine fever [14] , bovine tuberculosis [15] , and avian influenza [16] . However, few attempts have been made to address the problem of minimizing the epidemic duration from a theoretical point of view by using optimal control theory. To our knowledge, the only example of analytic characterization of the control function in a time-optimal framework is due to Jiang [17] , who focused on the analysis of isolation strategies in a subsystem of the model proposed in Zhang et al. [18] to describe SARS spread. On the other hand, the optimal control theory has been widely applied to solve the problem of minimizing the total number of infected individuals (or the total infectious burden) in basic SIR (Susceptible-Infected-Recovered) epidemic models by means of different control policies, such as: the implementation of emergency prophylactic vaccination plans, the isolation of infected individuals, the reduction of disease transmission through the limitation of contacts between individuals, and non-selective culling [19, 20, 21, 22, 23, 24, 25] .
Prophylactic vaccination consists in the vaccination of susceptible individuals; its goal is to prevent the development of diseases. Isolation consists in the quarantine of infected individuals. As regards livestock diseases, in SIR models isolation is mathematically equivalent to removal of infected individuals through test-and-cull procedures. Non-selective culling consists in the slaughtering of both infected and healthy individuals and it is usually implemented in wildlife and livestock when no other options are available (e.g. no diagnostic tests available, lack of time or resources). The rationale for culling healthy individuals resides in the positive relationship between the rate at which individuals become infected and the abundance of susceptible individuals. Among humans, the reduction of transmission can be obtained through information campaigns or emergency movement bans (e.g. school closures, flight limitations), while in livestock it can be obtained by imposing limitations on animal, vehicle, and personnel movements among farms.
Those cited studies solved the optimal control problem for the minimization of the infectious burden in unconstrained conditions (i.e. without costs of control or resource limitations). They showed that the optimal strategy always relies in the adoption of the maximum control for the entire epidemic. In this context, maximum control is intended as the implementation of the control policy at its maximum available rate.
Here, by using simple SIR models in an optimal control framework [26] , we thoroughly investigate the problem of minimizing the epidemic duration by using prophylactic vaccination, isolation, non-selective culling, or reduction of transmission controls. In this study, we will show that the optimal control strategies to minimize the epidemic duration in SIR models can substantially differ from those minimizing the infectious burden. Specifically, we will prove that: (i) using the maximum control for the entire epidemic duration may not be the optimal strategy (even in unconstrained conditions); and (ii ) when the maximum control for the entire epidemic is not an optimal strategy, a delayed control is optimal. Consequently, our results lead to the conclusion that minimizing the epidemic duration does not always imply minimizing the total infectious burden, and vice versa.
We describe the evolution of the infection in a host population with a standard deterministic SIR model [27] , that can be described by the following system of two ordinary differential equations (ODEs):
where S(t) and I(t) represent the number of susceptible and infected hosts, respectively, β represents the transmission rate of the infection and µ represents the loss rate of infected individuals through both mortality and recovery. If we denote by x(t) = (S(t), I(t)) T the column vector that describes the state of the system at time t, we can rewrite system (1) in the more compact formẋ = f (x). In our analysis, we consider four different control policies, namely: vaccination, isolation, culling, and reduction of transmission. We denote the generic control policy rate applied at time t by u(t), which is assumed to be a piecewise continuous function that takes values in a positive bounded set U = [0, u max ]. We apply the different policies separately by adding a linear term in the control variable u(t) to model (1), namely considering the general systeṁ
where the function g depends on the chosen control policy. Specifically, we define a general linear term policy
which is a linear function of S and I that allows to model
Isolation
Culling
and, in addition, we consider the nonlinear term policy
We define the basic reproduction number for model (1) as R 0 = βS(0)/µ, which represents the average number of secondary infections produced by a single infected individual in a completely susceptible population in the absence of control [27] . In addition, for each policy we will define the control reproduction number R C that represents the average number of secondary infections produced by a single infected individual in a completely susceptible population with control measures in place [28] . From this definition, it follows that, when R C < 1, control measures applied at the beginning of the epidemic are able to immediately reduce the number of the infected individuals (i.e.İ(0) < 0). The target will be the minimization of the eradication time of the infection. Existence of the eradication time in problem (2) is guaranteed by the results in Appendix A.
Definition 1 (Eradication Time). The eradication time T of the controlled SIR problem (2) is the first time at which the number of infected individuals reaches the threshold ε, where ε < 1 is a fixed positive constant.
We will chose initial conditions of infected individuals I(0) strictly greater than ε. As a consequence, T being the first time at which the variable I reaches ε, it holds thatİ(T ) < 0.
We can then write the optimal control problem [26] where the goal is:
where g is defined by the chosen control policy.
Given the optimal control problem (8) with f, g ∈ C ∞ (R 2 ), we apply the Pontryagin's Minimum Principle [26] in order to find a characterization of the optimal control strategy.
Theorem 1 (Pontryagin's Minimum Principle for linear time-optimal control problem [26] ). Suppose that u * (t) is a minimizer for the optimal control problem (8) and let x * (t) = (S * (t), I * (t)) T and T * denote the optimal solution of problem (2) and the optimal eradication time, respectively. Then, there exists a piecewise C 1 vector function λ * (t) = (λ * S (t), λ * I (t)) T = 0 such thaṫ
where the Hamiltonian is defined as H(x, u, λ) = 1 + λ T (f (x) + ug(x)), and:
1. the function h(w) = H(x * (t), w, λ * (t)) attains its minimum on U at w = u * (t):
H(x * (t), u * (t), λ * (t)) ≤ H(x * (t), w, λ * (t)), ∀w ∈ U for every t ∈ [0, T * ]; 2. the Hamiltonian is constant equal to zero along the optimal solution:
3. the following transversality condition holds: λ * S (T * ) = 0. Moreover, because the Hamiltonian is linear in the control variable, the value of u * (t) is determined by the sign of the switching function ψ(x, λ) = λ T g(x) for all the time instants t at which ψ(x * (t), λ * (t)) does not vanish:
Control u(t) 0 Figure 1 : Schematization of the four types of admissible optimal control and legend of the plot colors that will be used throughout the article. White (panel a) denotes a constant control at its maximum value. Different shades of gray denote delayed controls applied at the switching time τ * s . We distinguish three different behaviors, depending on the position of τ * s with respect to the infectious dynamics: the switch occurs before the peak of the infection (panel b, light gray), in correspondence of the peak (panel c, gray) or after the peak of infection (panel d, dark gray).
The results that we will prove in the next sections can be summarized in the following theorem.
Theorem 2. For each considered control policy the optimal control for problem (8) is bang-bang. The optimal strategy consists either in a constant control u * (t) ≡ u max or in a delayed control 0 → u max with a single switching time τ * s , namely u * (t) = 0 for t ∈ [0, τ * s ) and u * (t) = u max for t ∈ (τ * s , T * ]. In addition, if the optimal control is delayed, three different behaviors are allowed, depending on the position of the switching time τ * s compared to the peak of infection, leading to the four different types of admissible optimal control sketched in Fig. 1 .
We will denote the set of such admissible optimal controls by
As regards the numerical solution, several numerical methods for the optimal solution of both minimum time and bang-bang control problems can be found in literature. Such techniques are mainly based on shooting methods [29, 30, 31] , smooth regularizations of the control function [32] , or pseudospectral methods [33] . However, since our problem is characterized by the particular class of optimal controls A in (9), for our numerical simulations we will use a simpler ad hoc numerical scheme. The method is based on the idea of identifying each bang-bang function u(t) ∈ A with a real parameter. Since the delayed optimal control function is not defined at the switching time instant, for numerical simulations we fix by convention u * (τ * s ) = u max . Then, we can generalize the idea of switching time, defined as the zero of the switching function ψ, introducing the starting intervention time τ = 0 in case of constant maximum control τ s in case of delayed control (10) which represents the first time instant at which the control u(t) ∈ A assumes the value u max . Since a delayed control can be characterized by its switching time τ s , we can then identify each admissible optimal control in A, constant or delayed, by the value of τ and write it in the more general form:
Therefore, the functional to be minimized J(u) can be seen as the function J : τ → T , that links the starting intervention time τ ≥ 0 to the eradication time T of the problemẋ
An optimal control u * will be identified by a starting intervention time such that τ * = argmin J, since it can be proved that J always admits at least a minimum value (see Theorem A.1). The numerical solution will be computed by evaluating the function J(τ ) over a suitable interval and looking for its minimum value. In particular, we fix a uniform mesh k ≤ ε. Finally, we take the minimum over the set of computed eradication times T j = min{T i , i = 1, . . . , M } as the optimal eradication time, and set the corresponding τ j as the optimal starting intervention time.
In the following sections we investigate the four different control policies considered. For each policy we will present theoretical and numerical results. In our numerical simulations, we set ε = 0.5, as in [24] . Then, through a sensitivity analysis, we explore the solutions of optimal control problems (4)-(7) on a wide range of parameter settings describing different epidemiological conditions (represented by R 0 = βS(0)/µ), different possible control efforts (represented by u max ), and a different number of initially introduced infected individuals in the population (represented by I(0)).
We consider SIR model (1) with the general linear term control, denoted by u l (t), obtaining an optimal control problem as the one defined in (8), with g l (x) as in (3).
l is the optimal control strategy for the linear term control problem, then u * l is a bang-bang control with at most one switching time τ * s from no control to maximum control.
Proof. See Appendix B.1.
We proceed now to analyze the peculiarities of each policy involved in the general formulation.
We consider the vaccination control, denoted by u v (t) in the optimal control problem (8), with g v (x) as in (4) . The control reproduction number for vaccination is defined as R v C = R 0 = βS(0)/µ. For this policy, it is easy to prove that there exists a unique time instant t p (possibly 0) at which the functionİ changes sign. In particular,İ(t) > 0 for t < t p andİ(t) < 0 for t > t p . We call t p the peak time, because it represents the time at which the number of infected individuals reaches its maximum. Therefore, in addition to the general results of Theorem 3, it is possible to prove the following. 
The numerical analyses on the time-optimal vaccination problem are illustrated in Fig. 2 . In Fig. 2(a) (that ranges from 0 to µ) and R 0 (β). Color meanings are specified in Fig. 1. (b) Plot of the optimal starting intervention time τ * , the optimal eradication time T * , and the eradication time T τ =0 as functions of u max v , with R 0 (β) = 3. Other parameters: S(0) = 2000, µ = 5, I(0) = 1, ε = 0.5. gray and white regions in Fig. 2(a) represent the combinations of parameters [u max v , R 0 (β)] for which the time-optimal vaccination problem selects for delayed and constant control, respectively. As highlighted by the analytic results, Fig. 2 (a) displays that the switching time always occurs before the peak of infection and that higher vaccination efforts always select for a constant control. Fig. 2(b) shows the optimal starting intervention time (τ * ), the eradication time for the optimal vaccination strategy (T * , solid curve), and the eradication time for the constant vaccination (T τ =0 , dashed curve) as functions of the maximum effort, u max v . In Fig. 2(b) , we notice that the optimal starting intervention time undergoes a "catastrophic" transition (sensu [34] ) from delayed to constant control for increasing values of u max v . Then, small changes in u max v can cause an abrupt change in the starting point of the optimal vaccination campaign. On the other hand, Fig. 2(b) shows that, when delaying the onset of vaccination is optimal, the differences in the final time of the epidemic between optimal control and constant control (i.e. variation in the objective function) is marginal.
We consider SIR model (1) with isolation control, denoted by u i (t), obtaining an optimal control problem as the one defined in (8), with g i (x) as in (5). The control reproduction number for isolation is defined as
). The numerical analyses on the time-optimal isolation problem are illustrated in Fig. 3 . In Fig. 3(a) , we show the results of the simulations performed in the parameter space [u max i , R 0 (β)]. Conversely to vaccination, our results show that the time-optimal isolation problem can select for delayed strategies also for high values of maximum effort, u max i . Moreover, the switching time for the optimal isolation strategy can occur after the peak of infection (see the dark gray region in Fig. 3(a) ). In Fig. 3(b) , we show that the isolation problem selects for optimal delayed control in a wide range of parameter settings also when the number of infected individuals firstly introduced in the population increases (i.e. I(0) > 1). Fig. 3 (c) displays the optimal starting intervention time (τ * ), the final time for the optimal isolation strategy (T * , solid curve), and the final time for the constant isolation (T τ =0 , dashed curve) as functions of the maximum effort, u max i . As in the vaccination problem, the optimal starting intervention time for isolation undergoes a "catastrophic" transition from delayed to constant control for increasing values of maximum effort. Fig. 3(c) shows that delayed control can be optimal also when R C < 1, i.e. when an prompt intervention at t = 0 could have implied an immediate decline in the number of infected individuals. In addition, when delaying the onset of isolation is optimal, the differences in the final time of the epidemic between optimal control and constant control can be significant. Fig. 3(d) shows the number of susceptible individuals at the end of the epidemic for the optimal isolation strategy (S(T * ), solid curve) and the constant isolation (S(T τ =0 ), dashed curve) as functions of the maximum effort, u max i . Similarly to the switching time, S(T * ) exhibits a discontinuous increase at the boundary between delayed and constant control. 
We consider the culling control, denoted by u c (t), in the optimal control problem defined in (8) , with g c (x) as in (6) . The control reproduction number for culling is defined as R c C = βS(0)/(µ + u max c ). The numerical analyses on the time-optimal culling problem are illustrated in Fig.  4 . In Fig. 4(a) , we show the results of the simulations performed in the parameter space [u max c , R 0 (β)]. We display that, when R 0 is low, delayed control is selected for small values of culling effort (u max c ), while, when R 0 is high, delayed control is selected for intermediate values of u max c . In addition, in the aforementioned cases, the starting of the optimal culling generally occurs before the peak of infection (light gray region in Fig. 4(a) ). However, we can notice that there exists a small region in the parameter space [u max c , R 0 (β)] where the starting of the optimal strategy can occur after the peak of infection (see the dark gray region in the box). Fig. 4(b) shows the optimal starting intervention time (τ * ), the final time for the optimal culling strategy (T * , solid curve), and the final time for the constant culling (T τ =0 , dashed curve) as functions of the maximum effort, u max c . Also in this case the optimal starting intervention time undergoes a "catastrophic" transition from delayed to constant control for increasing values of u max c and, when delaying the onset of culling is optimal, the differences in the final time between optimal control and constant control is marginal, analogously to the case of vaccination.
We consider SIR model (1) with reduction of transmission control, denoted by u r (t), obtaining an optimal control problem as the one defined in (8), with g r (x) as in (7) and 0 < u max r ≤ 1. The control reproduction number for reduction of transmission is defined as R r C = β(1 − u max r )/µ. Despite the nonlinearity of this kind of policy, it is possible to find the same type of optimal strategy of the linear term policies.
Theorem 5. If u * r is the optimal control strategy for the reduction of transmission problem, then u * r is a bang-bang control with at most one switching time τ * s from no control to maximum control.
Proof. See Appendix B.3.
The numerical analyses on the time-optimal reduction of transmission problem are illustrated in Fig. 5 . In Fig. 5(a) , we show the results of the simulations performed in the parameter space [u max r , R 0 (β)]. We display that, when delayed control is selected, the starting of the optimal reduction of transmission generally occurs after the peak of infection (dark gray region in Fig. 5(a) ). In Fig. 5(b) , we show that the reduction of transmission problem selects for optimal delayed control in a wide range of parameter settings also when the number of infected individuals firstly introduced in the population increases (i.e. I(0) > 1). Fig. 5(c) shows the optimal starting intervention time (τ * ), the final time for the optimal reduction of transmission strategy (T * , solid curve), and the final time for the constant reduction of transmission (T τ =0 , dashed curve) as functions of the maximum effort, u max r . Similarly to the isolation problem, we find that: (i ) delayed control for reduction of transmission can be optimal also when R C < 1; and (ii ) when delaying the starting of reduction of transmission is optimal, the differences in the final time of the epidemic between optimal control and constant control can be significant. Fig. 5(d) shows the number of susceptible individuals at the end of the epidemic for the optimal reduction of transmission strategy (S(T * ), solid curve) and the constant reduction of transmission (S(T τ =0 ), dashed curve) as functions of the maximum effort, u max r . Similarly to the isolation problem, S(T * ) exhibits a discontinuous increase at the boundary between delayed and constant control.
In this work, we investigated the problem of minimizing the epidemic duration by using different control policies. Specifically, we characterized analytically the time-optimal control strategies for prophylactic vaccination, isolation, non-selective culling, and reduction of transmission by using a family of simple SIR models in an optimal control framework [26] . Our analyses led to the non-trivial result that, even in the unconstrained optimal control problem (i.e. without costs of control or resource limitations), using the maximal effort for the entire epidemic period may not be the optimal strategy to minimize the epidemic duration. In addition, we found that, when applying the maximal effort for the entire epidemic is sub-optimal, then a delayed control represents the optimal strategy in all the cases investigated. We even found that the optimal amount of delay applied to the control may be sufficiently large to postpone the beginning of the intervention after the peak of the infection (see Fig. 1 and dark gray regions in Figs. 3(a), 4(a), and 5(a) ). In addition, we showed that the delayed control may represent the optimal strategy for minimizing the epidemic duration even when a prompt intervention could immediately reduce the number of infected individuals (i.e. reduce R C below 1, see Figs. 3(c) and 5(c)).
The biological explanation for the optimality of delayed controls relies on the remark that, at the beginning of the epidemic, the infection process can be more efficient in depleting the reservoir of susceptibles (which represents the mechanism leading to epidemic extinctions) than the applied control. In other words, reducing via external interventions the number of individuals involved in the infection process at the beginning of the outbreak (especially the infected ones) may lead to slower epidemic dynamics, which implies longer times for the epidemic to go extinct. Two evidences support this explanation: (1) delayed control is generally optimal when the effectiveness of the control is low (i.e. low u max ); and (2) isolation and reduction of transmission policies (which do not reduce directly the number of susceptibles) tend to select for delayed control in wider ranges of parameter settings than vaccination and culling.
Our results differ from those previously obtained for the time-optimal problem in specific epidemic contexts. By analysing a subsystem of an epidemic model describing SARS spread, Jiang [17] proved that, according to Pontryagin's Minimum Principle, maximizing the isolation effort for the entire epidemic period would reduce epidemics in minimum time. Similarly, by numerically testing scenarios in an SIR model where the control always reduces the disease reproduction number below 1, Iacoviello & Liuzzi [35] showed that maximizing the combined vaccination and isolation efforts for the entire epidemic period eradicates epidemics in minimum time.
Our results substantially differ also from those obtained minimizing the total number of infected (or the infectious burden) in SIR epidemic models. By characterizing optimal controls according to Pontryagin's Minimum Principle, different works showed that the unconstrained problems for isolation [22, 24] , vaccination [21, 24] , and culling [25] only support the trivial solution of applying the maximal effort for the entire epidemic. Then, from our results it follows that the infectious burden may not be minimized while minimizing the epidemic duration in simple SIR models.
Minimizing the infectious burden in the optimal control problem for isolation and reduction of transmission is equivalent to maximize the final number of susceptibles, From these figures, we notice that the different objective functions provide similar results when the control efforts are sufficiently large to rapidly lead the epidemic to extinction (high u max ), while they provide substantially different results in the case of less efficient strategies (low u max ). Specifically, the time-optimal control strategy performs poorly in minimizing the infectious burden at the boundary between delayed and constant control (see Figs. 3(d) and 5(d)), while the infectious burden minimization strategy performs poorly in minimizing the epidemic duration for slightly higher values of R C (see the peak of T τ =0 in Figs. 3(c) and 5(c)).
Moreover, we find that small changes in the control parameter u max can cause large changes in the shape of the optimal strategies. An analogous result was found by Hansen & Day [24] investigating the problem of minimizing the infectious burden through isolation in a SIR framework with limited resources. Hansen & Day [24] also found that a "catastrophic" shift in the shape of the isolation strategy corresponds to an abrupt variation in the objective function (i.e. the infectious burden). Conversely, here we find that "catastrophic" shifts in the shape of the control strategies correspond to continuous variations in the objective functions (i.e. the final time of epidemics).
We believe our findings can be useful in throwing light on overlooked results obtained with more complex models developed in specific epidemiological contexts. For instance, Roche et al. [13] investigated the performances of different spatially explicit models for the spread of foot-and-mouth disease in the UK farms, considering different control scenarios. Among other scenarios, they compared the effect of suppressive vaccination strategies started at 7 and 14 days after the outbreak beginning. They found that, in two out of the four models investigated, the medians and/or the 95 th percentiles of the epidemic duration decreased when the control is delayed by 7 days [13, see models 'IS+' and 'NL' in table 4 therein]. On the other hand, they found that the number of infected farms always increases when the vaccination is delayed [see table 4 in 13] . In a similar way, by investigating the effectiveness of combined culling and movement restriction to control classical swine fever in Switzerland pig farms, Dürr et al. [14] found that delaying the starting of the control from 6 to 16 days after the outbreak beginning reduced the median outbreak duration in three out of the eight analysed scenarios [see figure 4 in 14].
Previous works have already shown that delayed control might represent an optimal strategy in some epidemiological applications. For instance, Handel et al. [36] and Hansen & Day [37] showed that delaying the controls may be optimal in preventing the re-emergence of the epidemic or the emergence of resistant epidemics. Bolzoni et al. [25] showed that the delayed control may be optimal in wildlife diseases where the host population growth is density-dependent.
The numerical analyses performed here under the assumption of constant control highlighted that increasing the control efforts may lead to a substantial increase of the eradication time. This is especially true in the case of isolation and reduction of transmission, where the eradication time may increase from two-to five-fold with respect to the "do-nothing" alternative (see Figs. 3(c) and 5(c)). Similar negative effects of constant efforts on disease control have also been highlighted when the target of the intervention was the reduction of the number of infected individuals [38, 39, 40, 41] . All these counter-intuitive findings suggest that the implementation of simple time-dependent strategies may crucially improve the control of infectious diseases.
Other aspects of diseases control implementation that were not included in the present work -such as combined controls [24] , the costs of control [23] , resources limitation [24] , and availability of surveillance information [42] -can play a significant role in shaping the optimal strategy. These aspects are essential in defining optimal protocols of intervention for diseases eradication. However, thanks to the generality of the model formulation, we believe our results can be used as a benchmark to contrast the outcome of future investigations.
Proof. By definition, there exists an optimal solution of (8) if the functional J(u), which gives the eradication time of the controlled SIR problem (2) as a function of the control, has (at least) a minimum point u * on the set of admissible controls. For each policy Theorem 2 holds, namely the set of admissible controls is A given in (9) . As detailed in Section 2, we can see J as a function that links the starting intervention time τ (10) to the eradication time T :
Since the starting intervention time cannot be larger than the eradication time of the uncontrolled epidemic, then there exists an upper bound τ max for τ . We prove that J admits at least a minimum point τ * by proving that it is a continuous function on the bounded interval [0, τ max ]. First we prove that J is a continuous function in 0, namely that lim h→0 + J(h) = J(0). We observe that by definition J(0) is the eradication time T 0 (= T τ =0 ) of the solution x(t) of the controlled problem
where y 1 is the solution of the uncontrolled problem ẏ 1 (t) = f (y 1 (t)), 0 ≤ t ≤ h; y 1 (0) = x 0 while y 2 is the solution of ẏ 2 (t) = f (y 2 (t)) + u max g(y 2 (t)), t ≥ h;
By the Continuous Dependence on Initial Conditions Theorem, for a generic t ≥ h it holds:
where the last inequality follows from the Mean Value Theorem. This is true in particular for t = T h : ||y(T h ) − x(T h )|| ∞ ≤c h. Let us consider only the infected component of the two solutions: I x (t) and I y (t). Then |I y (T h ) − I x (T h )| ≤c h, which leads to |I x (T 0 ) − I x (T h )| ≤ch, since I y (T h ) = ε = I x (T 0 ). This is equivalent to lim h→0 + I x (T h ) = I x (T 0 ). I x (t) being a continuous positive function that is strictly monotone in a neighborhood of T 0 , it is invertible and therefore we can state that lim h→0 + T h = T 0 , namely lim h→0 + J(h) = J(0). The proof of the continuity of J in a generic starting intervention time τ follows from the continuity in 0, using translation arguments.
Remark A.1. If we consider non-negative initial data S(0) and I(0), then the solution of the differential system (2) is non-negative at each time t > 0.
Indeed, for all the chosen policies, the I axis is a trajectory for the system; the S axis is also a trajectory (for vaccination and culling policies) or is a set of stationary points (for isolation and reduction of transmission policies). Using results of Remark A.1 it is sufficient to prove that for S, I > 0 the vector field evaluated on the boundary line S + I = k points towards the internal part of the region Q k [43] ; it is straightforward for each policy since the scalar product of the vector field f (x) and the outward pointing normal vector of the boundaryn = (1, 1) T is negative in all cases.
Corollary A.1. Given an initial condition x 0 = (S(0), I(0)) ∈ R 2 + , let x(t) = (S(t), I(t)) be the solution of (2). Then I(t) → 0 as t → +∞ for all control policies.
Proof. By Remark A.2 we know that the set Q N 0 , where N 0 = S(0) + I(0), is a (trapping) region. Moreover, in this region the functionṠ(t) has a constant negative sign, so there cannot be periodic trajectories and all orbits must converge to a stationary pointx ∈ Q N 0 . It is easy to prove that the number of infected individuals of a stationary point is always zero. In fact, for the vaccination and culling policies, the only stationary point isx = (0, 0), while for isolation and reduction of transmission policies the stationary points are all those of the S axis.
Pontryagin's Minimum Principle, the Hamiltonian function, the switching function and its derivative are respectively:
and the adjoint variables satisfy the following system of ODEs:
3)
The sketch of the proof of Theorem 3 is as follows.
(i) First we prove that the control is non-singular, namely that the function ψ vanishes only in isolated points. Suppose in fact that ψ vanishes in an open interval B. Then also all the derivatives vanish there and in particular ψ =ψ = 0 in B, which yields by some algebra λ S = λ I = 0 by (B.2), since S, I > 0 when S(0), I(0) > 0 (see Remark A.1). This is in contradiction with Theorem 1, as the adjoint variables λ S and λ I cannot vanish simultaneously by construction, therefore ψ vanishes only in isolated points. As a consequence, the control is a piecewise constant function u l (t) that can assume only two values: 0 and u max . The switching times are defined as the time instants at which the function ψ(t) changes its sign and, consequently, the function u l (t) changes its value. Therefore two types of switch can occur: either the value of u l (t) is 0 in a left-neighbourhood of the switching time and is u max in a right-neighbourhood, and we denote it by 0 → u max , or the converse, which is denoted by u max → 0.
(ii) Next we show that the optimal control in a left-neighbourhood of the eradication time T must be equal to u max . By condition 3 of Theorem 1 ψ(T ) = −α 2 I(T )λ I (T ) andψ(T ) = α 1 βS(T )I(T )λ I (T ). The sign of the function ψ in the left-neighbourhood of T will then be determined by the sign of λ I (T ). Substituting λ S (T ) = 0 in (B.1) and by condition 2 of Theorem 1 we get λ I (T ) = −İ(T ) −1 , which is positive, sinceİ(T ) < 0. As a consequence, ψ(T ) ≤ 0 andψ(T ) ≥ 0. Since they cannot vanish simultaneously, as α 1 and α 2 are not simultaneously zero, ψ is negative in a left-neighborhood of T .
(iii) Now we prove that there can be at most one switching time, relevant to the switch 0 → u max . Let τ s be a generic switching time, namely ψ(τ s ) = 0. Then −α 1 S(τ s )λ S (τ s ) = α 2 I(τ s )λ I (τ s ) by (B.2). Suppose α 2 = 0, then at the switching time λ I = − α 1 Sλ S α 2 I . Substituting this relation in (B.1) and by condition 2 of Theorem 1, we can write λ S , and therefore λ I andψ, as functions of Q(t) = βI(t)+ α 1 α 2 (βS(t)− µ), which is a decreasing function sinceQ(t) < 0:
In particular, we can see that the sign ofψ is opposite to the sign of Q. Suppose that there are multiple switching times τ (j) s , j = 1, . . . , n. We have already proved that u l (T ) = u max , so at the last switching timeψ(τ (n) s ) < 0 must hold, thus Q(τ (n) s ) > 0. Since Q is a decreasing function, this means that Q is positive in the interval [0, τ (n) s ], and it implies that all the switching times τ (j) s are from no control (positive values of ψ) to maximum control (negative values of ψ). This is not possible, therefore there can be at most a unique switch from no control to the maximum control rate u max , namelyψ(τ s ) < 0. Now suppose α 2 = 0. We still prove that there can be at most one switching time, relevant to the switch 0 → u max and that, in addition, the switch can only occur before the peak time. Let τ s be a generic switching time, namely ψ(τ s ) = 0. Then λ S (τ s ) = 0 by (B.2) and, analogously to what happens at the eradication time T , λ I (τ s ) = −İ(τ s ) −1 . Thus, the sign ofψ(τ s ) is opposite to the sign ofİ(τ s ), which is positive (respectively, negative) before (resp. after) the peak time of the infection t p . The only possible change in sign of the function ψ after the peak is then from negative to positive, which is not admissible, since we proved that ψ is negative in a left-neighborhood of T . Thus the switch can only occur before the peak and, beinġ ψ(τ s ) always negative, it must be unique. Moreover, since ψ changes its sign from positive to negative values, the control switches from 0 to the maximum rate u max .
The sketch of the proof of Theorem 4 is as follows.
(i) The position of the switch with respect to the peak of infection follows from Appendix B.1, point (iii) (case α 2 = 0).
(ii) By definition of the basic reproduction number, we know that if R 0 < 1 then the number of infected individual is monotonically decreasing in time, namely the peak of the infection is t p = 0. As we already proved that there cannot be a switch for t > t p , in this case the optimal control must be u v (t) ≡ u max v . Suppose that R 0 > 1 and that the optimal control is delayed with switch 0 → u max v at time τ s > 0. Then we prove that the relation µ > u max v must hold. First we prove that, under those hypotheses, the function ψ has a minimum point m ψ in (τ s , T ) at which λ I (m ψ ) < λ S (m ψ ), as sketched in Fig. B.6 . The function ψ vanishes at τ s (by definition) and at T (by the transversality condition), while it is strictly negative between the two points, therefore it must have at least a minimum point. Since ψ is a C 1 function, in such pointsψ = 0 and thus also λ I = 0, by (B.2). Substituting this latter value in the second derivative of the switching function and recalling the definition of ψ in (B.2) we obtain ψ = βSI(βSλ S − βIλ I − u max λ I ) = β 2 S 2 Iλ S = −β 2 SIψ.
Thenψ is positive and we can state that ψ has only an extremal point in that interval, and more specifically that it is a minimum point, which we denote by m ψ . Moreover, since λ I (m ψ ) = 0 and λ S (m ψ ) > 0, it is straightforward that λ I (m ψ ) < λ S (m ψ ).
Similarly, we prove that the function λ S has a unique maximum M λ S in the interval [τ s , T ] at which λ I (M λ S ) > λ S (M λ S ), as sketched in Fig. B.6 . In fact, it vanishes at τ s (since ψ(τ s ) = 0) and at T (for the transversality condition) and it is strictly positive between the two points, since ψ < 0. On the interval [τ s , T ], being Appendix B.3. Proof for optimal reduction of transmission policy Let x(t) = (S(t), I(t)) T denote the optimal solution for the reduction of the transmission control problem, with control term u r (t), λ(t) = (λ S (t), λ I (t)) T the corresponding adjoint variables and T the optimal eradication time. By the Pontryagin's Minimum Principle, the Hamiltonian function, the switching function and its derivative are respectively:
H(x, λ, u r ) = 1 + (λ I − λ S )β(1 − u r )SI − µIλ I (B.4)
ψ(x, λ) = (λ S − λ I )βSI,ψ(x, λ) = −µβSIλ S , (B.5) and the adjoint variables satisfy the following system of ODEs:
For the proof of Theorem 5, first we show that the control is non-singular, namely that the function ψ vanishes only in isolated points. Suppose that ψ vanishes in an open interval B. Then ψ =ψ = 0 in B, namely λ S = λ I = 0 (see (B.5)), which is in contradiction with the statement of the Theorem 1. Therefore, ψ can vanish only in isolated points. Substituting λ S (T ) = 0 (the transversality condition) in (B.4) and by condition 2 of Theorem 1 we get λ I (T ) = −İ(T ) −1 , which is positive, beinġ I(T ) < 0. As a consequence, ψ(T ) < 0 by (B.5).
Let τ s be a generic switching time, namely ψ(τ s ) = 0. Then λ S (τ s ) = λ I (τ s ) by (B.5) and, by equation (B.4), they are both equal to (µI(τ s )) −1 . Substituting this value in (B.5) we obtainψ(τ s ) = −βS(τ s ), which is negative. Therefore, since the sign of the derivative of ψ is constant at every switching time τ s , there can be at most a unique switch from no control (positive values of ψ) to the maximum rate of control u max r (negative values of ψ).