Optimal Allocation of Vaccine and Antiviral Drugs for Influenza Containment over Delayed Multiscale Epidemic Model considering Time-Dependent Transmission Rate

In this study, two types of epidemiological models called “within host” and “between hosts” have been studied. The within-host model represents the innate immune response, and the between-hosts model signifies the SEIR (susceptible, exposed, infected, and recovered) epidemic model. The major contribution of this paper is to break the chain of infectious disease transmission by reducing the number of susceptible and infected people via transferring them to the recovered people group with vaccination and antiviral treatment, respectively. Both transfers are considered with time delay. In the first step, optimal control theory is applied to calculate the optimal final time to control the disease within a host's body with a cost function. To this end, the vaccination that represents the effort that converts healthy cells into resistant-to-infection cells in the susceptible individual's body is used as the first control input to vaccinate the susceptible individual against the disease. Moreover, the next control input (antiviral treatment) is applied to eradicate the concentrations of the virus and convert healthy cells into resistant-to-infection cells simultaneously in the infected person's body to treat the infected individual. The calculated optimal time in the first step is considered as the delay of vaccination and antiviral treatment in the SEIR dynamic model. Using Pontryagin's maximum principle in the second step, an optimal control strategy is also applied to an SEIR mathematical model with a nonlinear transmission rate and time delay, which is computed as optimal time in the first step. Numerical results are consistent with the analytical ones and corroborate our theoretical results.


Introduction
Seasonal and pandemic influenza A virus (IAV) infection causes severe morbidity and mortality worldwide [1]. There are many drugs to treat influenza, but the immune system is naturally the first defensive line against the disease. Therefore, it is essential to understand the mechanisms that trigger the immune system response and how this response affects the overall spread of the disease. The innate immune response plays an important role in the control and clearance of pathogens following viral infection inside an individ-ual's body. However, in the majority of virus-infected individuals, the innate immune response is insufficient because viruses use different evasion strategies to escape the immune response. Innate immunity plays a critical role in the control of viral infection because most infectious pathogens are eliminated through innate immune response without necessarily requiring the activation of adaptive immunity [2].
Since innate immunity is an important part of the body for dealing with viral infections, some methods have been determined to model different aspects of the human immune system. Differential equation models are the most popular methods to simulate critical diseases' immunological and epidemiological dynamics [3]. In addition, the use of mathematical modeling of the innate immune response interpreting experimental results has made a significant contribution to this field. Many mathematical models of the immune response to IAV infection have been introduced that considered both different aspects of the immune system and different detail levels. The first mathematical model to illustrate the within-host dynamic of IAV in infected mice was developed in 1976 by Larson et al. [4]. The proposed compartmental model includes seven compartments with five associated rate parameters. Also, the virus population dynamic was introduced in mathematical terms. Another model introduced by Bocharov and Romanyukha [5] studied immune responses to viral infections in human infections, such as the influenza A virus, and considered 12 immune populations. Also, Baccam et al. [6] described the viral kinetics of influenza A during infection in the human body, including target cell and the innate interferon response with delayed virus production through infected cells. However, as opposed to previous papers, which did not consider a complete model of the innate immune system, we used a more comprehensive one adapted from [7].
However, the disease's impact within the community and the relationship between people in society also need to be examined. Mathematical models are instrumental in explaining and quantifying epidemic dynamics. Hence, various mathematical models have been proposed in the following for between-hosts epidemic models to provide a general overview of strategies to be employed in the period of influenza virus infection. Kermack and McKendrick created one of the simplest types to explain epidemic dynamics that is called SIR (susceptible, infected, and recovered individuals, respectively). The proposed model was described in three papers in 1927 [8], 1932 [9], and 1933 [10]. Moreover, in [11], another type of epidemic model (SIS) is considered with a nonlinear incidence rate and time delay. In addition, four different control strategies are investigated and compared, including optimal control to decrease the density of infected individuals, increase that of susceptible ones, and reduce relevant costs. Besides these, in [12], a model of the relationship between two types of systems is formulated and analyzed. The first dynamic is the within-host model dynamic and focuses on cellular interactions. The second is the between-hosts model dynamic that focuses on transmission and infection statuses that are governed by the susceptible-exposed-infected-recovered (SEIR) model. Likewise, in this study, motivated by the previous paper, a combined model with different relationships is presented that will be discussed in detail in the following sections. The authors in [13] have used the sliding mode control on the SEIAR dynamic to overcome the uncertainty of parameters. However, they have not considered the optimal time to eradicate the infection in society, and they only refer to the betweenhosts dynamic. For this reason, since time is one of the priorities in order to control disease, we use an optimal control strategy to get the optimal time to cure the infected person and recover the susceptible person.
Optimal control is a mathematical method derived from the calculus of variations. There are different methods for computing the optimal control for mathematical models [14]. Pontryagin's maximum principle, first formulated in 1956 by L. S. Pontryagin [15], is to calculate the optimal control for an ordinary differential equation model system with a given constraint. In [16], an optimal control method is applied to a generic model of a pathogenic attack on the innate immune system. The minimization of a quadratic cost function is generated by numerical optimization. Terminal optimal time control is also investigated. For further studies, the readers are referred to [2], and the references therein introduce an optimal control model based on an ordinary differential equation system. Some studies have investigated the optimal control of SIR and SEIR models, but we mention just some of them in the following. The authors in [17] used an optimal control approach to an SIR epidemic model with a time delay to minimize the spread of infected individuals and maximize the number of susceptible and recovered individuals. Likewise, in [18,19], optimal control is considered to minimize the level of infection at the terminal time for an SIR and SEIR model, respectively, where the incidence rate is an unspecified nonlinear function, while their models only consider one aspect of the impact of the disease that affects the community and the relationship between susceptible, infected, and recovered people. They do not take into account the effects of the disease inside the body, and the relationship between cells is not considered.
Epidemic mathematical models can be used for several epidemic diseases like COVID-19 by modifying the parameter and adding or eliminating some states. In this regard, the authors in [20] considered a SEIAR epidemic model for the COVID-19 pandemic. Also, some new SIR-type models are introduced in [21][22][23][24]. The authors in [21] have considered "isolated," "vaccinated," and "quarantined" people groups due to several different conditions (after and before vaccine development). Moreover, "hospitalized" and "ICUadmitted" people groups are introduced in [22] to express the spread of coronavirus between the healthcare workers. Also, in [23], a new epidemic model (called SIDARTHE) is studied that considers the distinction between diagnosed and nondiagnosed infected individuals with and without symptoms detected acutely symptomatic infected ones. Besides, the discrete-time SEIR epidemic models can be used in such studies instead of continuous ones [25,26], to name a few. To further study about optimal control with time delay, readers refer to [27][28][29][30][31] and references therein.
Optimal control theory can be used to control other diseases like HIV [32] and especially COVID-19. In this regard, the authors in [33] used optimal control theory based on the SQEIAR epidemic model (Susceptible, Quarantined, Exposed, Infected, Asymptomatic, and Recovered) for the eradication of infection considering quarantine and treatment policies in China and Spain for different types of disease (COVID-19, Ebola, and influenza). Also, according to travel between cities that cause an increase in the outbreak, the authors in [33] investigated the impact of travel or immigration and impulsive change of population. These changes 2 Computational and Mathematical Methods in Medicine lead to generate impulsive epidemic models and impulsive control strategies [34]. Also, the authors in [35] have considered an optimal control strategy in the age-structured SEIRQ model for the COVID-19 epidemic in Brazil, where the quarantine entrance parameters are the control efforts of the system. In the same way, to explore the dynamic of the COVID-19 pandemic in Pakistan, the necessary optimality conditions are introduced in [36] using the optimal control theory in a mathematical model. Some optimal control strategies with application to COVID-19 are also introduced in [37], for further study. This paper investigates the correlation between two modeling aspects: the effect of the disease on society and inside the individual's body, which is an important issue. The community includes four groups (SEIR), all of which relate to each other in a community. All communications occur only in the community and among individuals. In contrast, there are some interactions among the cells inside an individual's body. Recovering the susceptible by vaccination takes time that is considered as delay caused by the length of converting the healthy cells into resistant-to-infectious cells. Also, the infected people need to be treated with antiviral treatment to recover, which is also considered as a delay (the length of time to kill the infected and partially infected cells and viruses and convert the healthy cells into resistant-to-infection cells simultaneously).
The goal of the present paper will be presented clearly and thoroughly regarding the reviewed papers. This paper introduces a multiscale model in which both innate immune responses (within-host model) and the SEIR dynamic (between-hosts model) are used simultaneously to define a single system. A multiscale-type model has already been presented in [12], with the difference that the proposed model in the present study is more comprehensive and concisely describes the relationships between the virus, cells, and the immune system. The model is also more realistic and closer to the real world. Moreover, a nonlinear sinusoidal transmission rate (contact rate) is considered, which varies in time according to changes in contacts between people throughout day and night. In this study, the optimal control is used to eradicate the infection at the optimal time in the community. As discussed in Introduction, different papers have been published on the subject of optimal control. However, to the best of the authors' knowledge, an optimal control approach that simultaneously tackles both types of dynamics (within-host and between-hosts) for epidemic models has never been considered in the literature before.
1This paper is organized as follows. Section 2 describes the preliminaries. After that, we propose an innate immune response dynamic in Section 3. The optimal control of innate immune response is introduced in Section 4, followed by the SEIR dynamic model with delay and nonlinear transmission rate in Section 5. In Section 6, we apply optimal control of the SEIR epidemic model. The results of simulations of different cases and sensitivity analysis are presented in Section 7. Finally, Section 8 summarizes the conclusions.

Preliminaries
In this section, we first look at the relationship between the two models considered in this paper. According to Figures 1 and 2, our multiscale model considers two scales: the first is the interaction of the virus and innate immune response within a host (inside the body), and the second is the contact between susceptible, exposed, infected, and recovered individuals in society. The dynamic of the innate immune response and relationship between cells and other components are now described in detail. The within-host model dynamic is the innate immune response to the influenza virus using a mathematical model. This model is based on interferon-induced resistance to infection of respiratory epithelial cells and the clearance of infected cells by natural killers with seven state variables (the numbers of healthy (U H ), partially infected (U E ), infected (U I ), and resistantto-infection cells (U R ) and IFN-I molecules ([IFN]), natural killer cells ðKÞ, and virus particles ðVÞ). Also, a nonlinear SEIR epidemiological model for influenza is given where the nonnegative state variables SðtÞ, EðtÞ, IðtÞ, and RðtÞ are the susceptible, exposed, infected (symptomatic), and recovered compartments, respectively. Here, SðtÞ represents the number of people that are susceptible but not infected with influenza, EðtÞ denotes the number of people exposed to influenza (infected but not yet infectious), IðtÞ denotes the population of infected humans with infectious influenza symptoms, RðtÞ is the number of recovered people from influenza, and N is the total population size. The relationship between the two epidemic models is shown in Figures 1 and 2. The dynamics of the innate immune response and SEIR epidemiological model is described further in the following sections.
The general strategy for this study is described by the following Algorithm 1.

The Innate Immune Response Dynamic Model
In this section, we consider innate immune system dynamics for dealing with the influenza virus, which is derived from [7]. There are seven components to the dynamic states, and the following equations govern the dynamics. For brevity, we suppress the notation "ðtÞ" for variables at the current time.

Computational and Mathematical Methods in Medicine
where U H is the number of healthy cells that increase with cell growth rate S H . These cells become partially infected cells ðU E Þ via the virus particles ðVÞ with rate k I . They also convert to resistant-to-infection cells ðU R Þ by the rate k R with IFN-I molecules ð½IFNÞ that increase by the rate of a I . Partially infected cells are in the eclipse phase. This means that they cannot spread the virus in the body and they infect the other healthy cells by the term k E . When the partially infected cells pass through the eclipse phase, they will become infected cells ðU I Þ and can spread the virus and cause other healthy cells to become infected. Partially infected ðU E Þ and infected cells ðU I Þ are destroyed by natural killers ðKÞ at a rate of q K . Once the cells are infected ðU I Þ, they broadcast thousands of similar cells a day, which is denoted by the parameter ρ V . The natural death rates of healthy, infected, infection-resistant cells, and IFN-I molecules are denoted by δ H , δ I , δ R ,and δ IFN , respectively, and the clear rate of virus particles ðVÞ is δ V . The number of NKs (natural killers) increases with a constant cell growth rate S K . In the same way, NKs die at the rate of δ K . After inflammatory stimulation caused by infected cells, natural killers are recruited from the blood indicated by Φ K U I . Figure 3 shows a schematic diagram of the innate immune system response to the influenza virus, which shows the cells' relation very well.
After introducing the model, we now introduce the controller and investigate how to influence the vaccine and antiviral treatment on the cells. As mentioned earlier, the vaccination is used to make healthy cells resistant to infection in a susceptible person's body and by using the antiviral treatment, the virus particles, infected, and partially infected cells are removed inside the infected body as discussed in detail in the next section.

Equilibrium Points and the Basic Reproduction Number.
To determine the disease spread and the number of  Step1. Optimal control design (vaccination strategy) for within-host model to convert healthy cells to resistant-to-infection cells in the optimal time ðt 1 Þ.
Step2. Optimal control design (antiviral treatment strategy) for within-host model to convert healthy cells to resistant-to-infection cells at the same time as destroying the virus particles in the optimal time ðt 2 Þ.
Step3. Optimal control design for between-hosts model to eradicate the infection, considering delays ðt 1 , t 2 Þ in the community.  , The disease-free equilibrium point ðDFEÞ is calculated by equating Equations (1)-(7) to zero and solving for U E * = U I * = V * = ½IFN * = 0 as ðS H /δ H , 0, 0, 0, 0, 0, 0, S K / δ K Þ. To find the endemic equilibrium point ðEEÞ, Equations (1)-(7) are equated to zero, and ½IFN = a I U I / δ IFN . Therefore, by replacing the states, the following equations can be calculated: The last equation has four solutions that one of them is DFE and can be achieved by U I = 0. The other three solutions are obtained using the parameter values in Table 1, one of which is 1:84 × 10 5 , and the other two solutions are negative and unacceptable, because the number of cells is a positive value. Therefore, the other equilibrium points are given as Then, the Jacobian of Equations (1)-(7) is given by Proof. By calculating the seventh-order characteristic equation of J about its DFE and according to the Routh-Hurwitz criterion, the following inequality must be satisfied: Therefore, it can be concluded that R 0 < 1: For R 0 > 1, there exists a positive eigenvalue for the characteristic equation and the equilibrium point is unstable.
Proof. In the same way and by calculating the characteristic equation of J about its EE and according to the negative eigenvalues obtained from Jacobian, the EE is stable if R 0 > 1, otherwise it is unstable.

Sensitivity Analysis.
In this subsection, the sensitivity of R 0 is investigated. Therefore, to check the R 0 sensitivity, It can be concluded that R 0 is directly related to the change of parameters δ H , S H , k I , ρ V , k E , and δ K . That is, if the parameters δ H , S H , k I ,and ρ V increase by 10%, R 0 also changes accordingly (10%) and is inversely related to the parameters δ V ,q K , and S K .

Positivity Analysis.
In this subsection, the positivity of solutions is investigated with Theorem 3. Proof. According to the positivity of all the parameters of the model, Equation (4) can be written as _ Multiplying e In the same way, the other states VðtÞ, ½IFNðtÞ,and KðtÞ (Equations (5)- (7)) are also positive states and can be written as VðtÞ ≥ Vð0Þe According to the positivity of U R ðtÞ, VðtÞ, ½IFNðtÞ and KðtÞ and according to Equation (3), Therefore, all solutions are positive.

Existence of Solutions.
In this subsection, the existence of solutions is investigated with Theorem 4. Proof. The model can be rewritten as The function f 1 ðXÞ satisfies Assumed that all parameters have the maximum Replacing and similarly for others, Therefore, The maximum value of states is equal to R (bounded value); therefore, It can be concluded that

Optimal Control of Within-Host Epidemic Model
Optimal control techniques are used to improve optimal strategies to control numerous kinds of diseases. The flexibility and relative simplicity of optimal control techniques can lead to the development of the optimal strategies to control the monitoring and treating of various kinds of diseases [14]. Therefore, the optimal control theory is applied to the innate immune dynamic in this part of the paper. In the first subsection, the optimal control is used to vaccinate susceptible people and cure infected people.

Vaccination Strategy.
In this subsection, the optimal control is applied to the innate immune response to convert healthy cells to resistant-to-infection cells. The vaccine works with the innate immune to develop protection (immunity) to the disease. This subsection is aimed at minimizing the number of healthy cells ðU H Þ by converting them to resistant-to-infection cells ðU R Þ with the control input (vaccination) at a rate of ν in the optimal time. It is obvious that injecting a vaccine into the susceptible person's bodies takes time to vaccinate them (recovered) against the disease. Unlike [13,19], in the current paper, this time is considered as a delay in moving susceptible people to the recovered people group in the society, which is investigated in Section 5 in detail. As long as the healthy cells have not become resistant-to-infection cells in the susceptible body, the person has not been vaccinated against the disease, and there is still a risk of infection. The above description is given by the following model: _ Figure 3 shows the diagram of the within-host dynamic model with vaccination. The susceptible individual's body does not have the virus, infected, or partially infected cells. Therefore, the goal is to convert healthy cells into resistant-to-infection cells using the vaccination strategy in the optimal time. Therefore, the optimal control problem is to minimize the cost (objective) function applied to Equations (18)- (24) given by in which a free terminal time is investigated, which gives a minimum duration of a vaccination. t f represent the duration of the vaccination. ∅ is a positive increasing function such that lim t⟶∞ ∅ðtÞ = +∞. In other words, the vaccination strategy is applied using the optimal control ðν * Þ in optimal time ðt f * Þ such that where ν is control and U 1 is the set of admissible controls 7 Computational and Mathematical Methods in Medicine defined by The necessary conditions for optimality are expressed by Also, a stationarity condition on the control is as follows: which are expressed using the Hamiltonian of the system. The Hamiltonian for the control problem is defined as follows: where Therefore, and p 1 , p 2 , p 3 , p 4 , p 5 , p 6 , and p 7 are the adjoint functions to be determined suitably. Then, the necessary conditions are computed as follows: Then, the necessary conditions for optimality are computed, which are expressed by the mentioned Hamiltonian equations [38]. These equations include a linear, ordinary differential equation that are shown by In order to derive the necessary conditions for this optimal control, the Pontryagin maximum principle [39] is applied to characterize the optimal control problem and the optimal final time, which is given as the following theorem.

Theorem 5.
Given an optimal control ν * , solutions U H * , U E * , U I * , U R * , V * , ½IFN * , and K * for the optimal control problem Jðν * , t f * Þ = min fJðν, t f Þ | ν ∈ U 1 , t f ∈ ℝ + g. Then, there are adjoint variables p 1 , p 2 , p 3 , p 4 , p 5 , p 6 , and p 7 that satisfy with transversality conditions as As a result, an optimal control ðνÞ is given by and the optimal final time is given by Proof. Using Pontryagin's principle, the adjoint equations and transversality conditions are obtained such that Computational and Mathematical Methods in Medicine and using the optimality conditions, the optimal control is solved as ∇ H ν = 0 in the following form: Thus, the control law is written as Using the property of the control space, the following equation is obtained: so, the optimal control is characterized as Now, according to Equation (28) and knowing δX f = 0, the optimal final time ðt f * Þ is computed using the following equation: ∂ϕ Therefore, using the characterization of the optimal control, the following optimality system is presented to obtain the optimal control and the state. This optimal control problem consists of the state system Equations (18)- (24) with initial conditions at t = 0, the adjoint system Equations (34)- (40) with the final conditions Equation (41), and the characterization of the optimal control Equation (42).
and the adjoint system is as follows: with and T * which can be rewritten as in Equation (78). So, the proof is completed.
After examining the effect of the vaccine on the person's body and the control strategy applied to the model for the best effect, it is necessary to investigate the efficiency of the optimal antiviral treatment strategy in an optimal time, which is considered in the following subsection.

Antiviral Treatment
Strategy. This subsection is aimed at destroying the virus particles and converting healthy cells into resistant-to-infection cells simultaneously using the optimal antiviral treatment strategy. There are infected and partially infected cells within the infected individual's body. Therefore, the control input (antiviral treatment) is used to eradicate the disease by converting healthy cells to resistant-to-infection cells at the rate of T 1 and destroying virus particles at a rate of T 2 . Figure 4 shows the conceptual flow diagram of the innate immune dynamics with the proposed control action (antiviral treatment). Moreover, the dynamic of the innate immune with antiviral treatment is 9 Computational and Mathematical Methods in Medicine considered as To reach the proposed goal and minimize the cost of the optimal antiviral treatment strategy within an optimal duration, the following objective function with free terminal time has to be minimized: in which t f represent the duration of the antiviral treatment. ∅ is a positive increasing function such that lim t⟶∞ ∅ðtÞ = + ∞. Also, to reach the optimal controls ðT 1 * , T 2 * Þ and an optimal terminal time ðt f * Þ, we considered where U 2 is the set of admissible controls defined by Then, the necessary conditions for optimality are written as follows: in which t f is unknown while Xðt f Þ is fixed; therefore, δX f = 0. Then, the Hamiltonian for the control problem is defined as where p 1 , p 2 , p 3 , p 4 , p 5 , p 6 , and p 7 are also the adjoint functions to be obtained. As discussed earlier, the following theorem is obtained to apply Pontryagin's principle to the Hamiltonian.
Theorem 6. Given optimal control pair T 1 * , T 2 * and solutions U H * , U E * , U I * , U R * , V * , ½IFN * , and K * for the optimal control problem JðT 1 ½IFN * , and K * be optimal state solutions with an associated optimal control pair ðT 1 , T 2 Þ. There are adjoint variables that satisfy the following equations: with transversality conditions: Furthermore, the optimal controls ðT 1 , T 2 Þ are given by Figure 4: The diagram of the innate immune dynamics with the proposed control action (antiviral treatment). and the optimal final time is given by Proof. The adjoint equation and transversality conditions can be obtained using Pontryagin's principle as similar to Equations (44)-(50). Then, by using the optimality conditions, the optimal controls are obtained using ∇ H T 1 = 0 and ∇ H T 2 = 0 . As a result, the control inputs are computed as Using the property of the control space, we obtain So, the optimal control is characterized as and according to Equation (74) and knowing that δX f = 0, the optimal final time ðt f * Þ is computed using the following equation: ∂ϕ Therefore, using the characterization of the optimal control, we have the following optimality system to obtain the optimal states: and the adjoint equations are as follows: where Then, the proof is completed.

Remark 7.
In the vaccination strategy, the healthy cells convert to resistant-to-infection cells using the proposed controller and their number converges to zero when t ⟶ ∞ ðU H ⟶ 0Þ and the rest remain at their initial zero value, while in the antiviral treatment strategy, in addition to converting healthy cells to resistant-to-infection cells, the virus particles decrease and converge to zero using the proposed controller. Meanwhile, the number of natural killers converges to the initial constant value. Then, after a while, 11 Computational and Mathematical Methods in Medicine Equation (59) becomes _ U E = −ðk E + q K KÞU E in which ðk E + q K KÞ is constant and is considered as first-order linear differential equation that yields U E = U E0 e −ðk E +q K KÞt . As a result, U E converges exponentially to zero.
In this section, the effect of the optimal control on the within-host model is examined. At the same time, it is necessary to explore the controller's influence on the betweenhosts model (SEIR epidemic model). Thus, the impact of the delay computed in this section is discussed in the following section in detail.

SEIR Dynamic Model
In this section, a SEIR epidemic model is introduced with two additional properties. First is two time-delay that aroused from this fact that vaccination and antiviral treatment take time to impact a person's body. Second is a nonlinear contact rate (transmission rate) function that is followed by this fact that the contact rate is varying throughout day and night. In this regard, the susceptible and infected individuals move to the recovered people group with time delays t 1 and t 2 (optimal times of vaccination and antiviral treatment within the body, which is computed in the previous section), respectively. The proposed SEIR epidemic model is presented as where α = ðg − 3μ d ρ + μ d Þ. As shown in Figure 5, SðtÞ represents the number of susceptible individuals who are vulnerable and not infected, EðtÞ or exposed individual denotes the number of people that are infected but not infectious yet, IðtÞ signifies the population of infectious people with symptoms that can transmit the disease to others, and RðtÞ is the number of completely recovered (immune) people. N is the total population size ðSðtÞ + EðtÞ + IðtÞ + RðtÞ = NÞ. μ d is the rate of deaths from causes unrelated to the infection, and μ b is the birth rate in each group, which is triple the mortality rate ðμ b = 3μ d Þ. t 1 is the vaccination time of susceptible people, and t 2 is the recovery time of infected people. In the case of births, in the susceptible, exposed, and recovered groups, newborns are susceptible to the disease and add to the susceptible group at the rate of μ b . Fraction ρ of the infected individuals' infants goes to the infected compartment, and the others (fraction ð1 − ρÞ of infected individuals' infants) move to the susceptible group. The exposed people get infected at a rate of κ, and infected people leave their compartment at the rate of α.
The contact rate is βðtÞ that is purposefully variable throughout day and night. It is also obvious that this rate at night is higher than during the day, which makes it closer to the real world and is more effective in practice [40]. According to the basic definition of βðtÞ that is defined as "the average number of contacts between indi-viduals in the population per unit time" [40], the contact rate must be more than one during the day due to the more relations between people in the community. Moreover, late at night and early in the morning, the transmission rate is less than one. Therefore, with trial and error and taking into account the assumptions below, the contact rate is obtained as βðtÞ = 0:5ð3 − sin ð2πtÞ 2 − sin ð2πtÞ − cos ð2πtÞÞ. Thus, the contact rate is less than one late at night and at daybreak and is greater than one in the middle of the day because there are more social gatherings and offices and schools are also open.
In the next section, an optimal control is applied to the proposed model to overcome the disease outbreak. Figure 5: Conceptual flow diagram of the influenza SEIAR dynamics with the proposed controllers.

Optimal Control of the Between-Hosts Epidemic Model
The aim of this section is twofold: first, minimizing the number of susceptible individuals and moving them to the recovered group by vaccination at a rate of u v ð0 ≤ u v ≤ 1 Þ in 25 days and second, moving the infected people to the recovered group at a rate of u τ ð0 ≤ u τ ≤ 1Þ by antivi-ral treatment in 25 days, as shown in Figure 5. The SEIR dynamic model in the presence of the controller is presented as

Computational and Mathematical Methods in Medicine
To this end, the optimal control strategy is used to achieve these goals. The objective function is considered as where B 1 , B 2 , and B 3 are gains of the infected, susceptible, and recovered individuals. Also, B 4 and B 5 are the gains of control inputs u v , and u τ , respectively. Moreover, t f and Xðt f Þ are fixed. Tacking the Hamiltonian yields where p 1 :p 2 ,p 3 , and p 4 are adjoint functions that satisfy the adjoint equations. Pontryagin's maximum principle is applied to the Hamiltonian H to derive the necessary conditions for the optimal control. The adjoint equation and transversality conditions are obtained by using Pontryagin's maximum principle such that Notice that the control u v ðt − t 1 Þ can only influence the state variable on the time interval ½t f − t 1 , t f . Thus, it suffices to compute the optimal control on the interval ½0, t f − t 1 . Therefore, we have which yields Similarly, that can be written as which yields 19 Computational and Mathematical Methods in Medicine So, the optimal controls are given as Therefore, using the characterization of the optimal control and considering Equations (90) and (92), the following optimality system is obtained as The adjoint equations are also obtained as where After investigating the effect of the proposed controller on both models, the results of the controller actions should be illustrated. Therefore, the simulation results of the proposed work are outlined in the next section.

Simulation Results
In this section, a numerical simulation is given to prove the accuracy of the results obtained in the previous sections. First, the effect of the optimal controllers on the innate immune response and then on the SEIR epidemic model is assessed. The value of innate immune response parameters regarding increment in the number of infected people, while the number of susceptible people does not decrease more because of the less contact between infected individuals ð 0:6 βðtÞÞ. Obviously, the number of exposed and infected people decreases followed by nearly half decrement in the contact rate with susceptible people. Thus, few people get infected; as a result, few people have recovered. In Figure 7, the impact of changes in the value of g, which is the recovery rate of infected people, is presented. As shown in Figure 7(a), when the rate of g is doubled, a greater number of susceptible people have recovered; as a result, fewer people get infected and the number of susceptible people is increased. Moreover, the number of infected people increases when the recovery rate decreases and decreases with increment in the value of recovery rate because more infected people are recovered. As a result, it is obvious that the number of recovered people is grown up followed by the rise in the recovery rate.
According to Figure 8, the exposed people are infected at a rate of κ; therefore, increment in this rate leads to growth in the infected people number; as a result, there is growth in the number of recovered people. It is obvious that the number of susceptible people is decreased when κ increases.
As observed, for different values of βðtÞ, g,and k, the disease does not disappear in about 25 days; therefore, it is necessary to use vaccination and antiviral treatment strategies to overcome the epidemic. Thus, in the next sections, the model in the presence of vaccination and antiviral treatment is simulated compared to the model without the controller.   Consequently, the susceptible individual, which includes healthy cells, will be recovered against the infection. Converting the healthy cells into the resistant-to-infection cells takes time, which is considered as delay in recovering process of susceptible individuals in the SEIR model. In Section 4, initially, the optimal time of healthy cells converting into resistant-to-infection cells in the susceptible individual's body has been obtained. Numerical simulations suggest eight days as the optimal time to convert the healthy cells into the resistant ones in a susceptible person's body (see Figure 9). The proposed optimal time will be considered as a delay of moving susceptible people to the recovered people group in the SEIR model in the next section. Figures 10(a) and 10(b) show the effect of control input (vaccination) on the number of healthy and resistant-toinfection cells. There is a surge in the number of resistantto-infection cells during vaccination in eight days. After vaccination, it can be deduced that rising in the resistant-toinfection cell numbers is associated with the reduction in the healthy cell numbers, indicating the controller efficacy. As mentioned, as the number of resistant-to-infection cells increases moment by moment, the susceptible person eventually becomes immune to the disease after eight days because the healthy cells in his/her body have all become resistant.

Within-Host Therapy.
There are virus particles (as a result, infected and partially infected cells) in the infected person's body. Therefore, the infected person needs to be treated with antiviral treatment. Thus, over the treatment process, the infected and partially infected cells and virus particles are killed, and the healthy cells become resistantto-infection simultaneously, which also takes time.
In Figure 11, the final optimal time to eradicate disease computed in Section 4 is shown. As shown in Figures 12(a) and 12(b), using antiviral drugs, healthy cells become resistant-to-infection cells. The drug's effect on infected and partially infected cells and viruses can also be seen in Figures 13 and 14, respectively. It is clear that the infected and partially infected cells are destroyed within six days, and the number of virus particles is also converged to zero, which indicates that the infected person is cured. Moreover, the evolution of IFN-I molecules and natural killer cells with and without the controller is shown in Figures 15(a) and 15(b).

Optimal Control Results between Hosts.
In this section, we examine the effect of the optimal controller on the SEIR epidemic model, which was discussed in Section 7, in detail. First, the changes in the number of susceptible, exposed, infected, and recovered individuals in the absence of appropriate control are investigated. Then, the effect of the vaccination strategy and antiviral treatment on individuals in a community is examined. For the numerical simulations, the delay differential equation solver (dde23) is used. This solver does not solve the advance equations ðt + t i Þ directly; therefore, it is necessary to convert the advance equations  descends and converts to infected people. Eventually, it remains stationary at a constant value (less than 2,000 people). Besides, the number of recovered people without any controller is greater than their number in the control-based strategy. The number of recovered people has reached more than 10,000 because in the absence of effective treatment, more people become infected, and as a result, more people will be recovered. By injecting the vaccine into the susceptible person's body, during the conversion of healthy cells to

Between-Hosts Therapy.
When the infection spreads in the community without control over its prevalence, the number of infected people is increasing every day, as shown in Figure 17(a). It rose by over 3,000 people. Finally, their number decreases until the 25 th day and reaches a little under 2,000 and remains unchanged, indicating the community's disease persistence. Also, the exposed people number reaches a high number of 4,000 in only twelve days and ultimately converges to a stable population and remains at almost 1,500 (see Figure 17(b)).

Computational and Mathematical Methods in Medicine
In contrast, the number of infected people exceeds almost 500 with antiviral therapy, which is used to treat infected people (transfer them to a recovered group). During the computed optimal time (the same delay as six days), the healthy cells convert to resistant-to-infection cells; at the same time, virus particles are eradicated by antiviral treatment in the infected person's body. Therefore, the infected people move to the recovered people group in almost 25 days. According to Remark 8, the number of exposed people also converges to zero as a result of decrement of infected people in 25 days.

Conclusion
In this paper, the optimal control theory was applied to two types of dynamic epidemic models: the innate immune response dynamic and the SEIR epidemic model. A nonlinear transmission rate and time delay were considered in the SEIR epidemic model. The aim of this paper was twofold: firstly, preventing the virus from spreading within the body of a host and secondly, curb the epidemic in the society and between hosts. To this end, two control strategies were introduced to satisfy the first goal in the susceptible and   Figure 17: The population of infected and exposed individuals with and without the controller. 25 Computational and Mathematical Methods in Medicine infected person's bodies. In this regard, vaccination was used to convert healthy cells to resistant-to-infection cells inside the susceptible individual's body that recovered them against the disease in society. In the following, antiviral treatment was used to reduce the concentration of viruses and convert healthy cells to resistant-to-infection cells at the same time inside the infected individual's body to recover them. Moreover, to control the epidemic in society, the optimal control was used to increase the number of recovered people by reducing the number of susceptible and infected people in the fixed 25 days. Transferring occurred with a delay computed as the optimal time of disease eradication inside the infected individual's body and the recovery of the susceptible individual's body. Finally, numerical simulation was used to illustrate the usefulness of the obtained results.

Data Availability
The data used are included within the paper and cited accordingly.

Conflicts of Interest
The authors declare that they have no conflicts of interest.