1 Introduction

Acquired immune deficiency syndrome (in short, AIDS) is caused by a type of lentivirus called human immunodeficiency virus (HIV). The life cycle of HIV is not yet completely understood. Studies show that the spread of the virus leads to the decreasing of immune cells and the creating of opportunistic infections. When the number of immune cells reaches less than 200, AIDS happens. The normal time from the entry of the virus to a cell to the occurring of AIDS is between 7 and 10 years, varying from one person to another person [14]. Many countries have been affected by the HIV-1 virus for many years. The virus is spreading rapidly in some areas. Many researchers [517] have been developed mathematical models to understand the dynamics of HIV. Due to the rapid spread of HIV-1 in some areas, many countries have been found some ways for fighting HIV-1 [18, 19]. One way is to use drugs that help the immune system to prevent the spread of HIV infection. These drugs are called antiretroviral drugs. Antiretroviral therapy, used to treat HIV in most countries, can restore the immune system and prevent opportunistic infections. These treatments reduce the production of new infections and the rate of HIV transmission. These methods increase the life expectancy of HIV-infected patients. One of these drugs is the reverse transcriptase inhibitor (RTI), which prevents the conversion of viral RNA to DNA and produces infected mature cells. Protease inhibitor (PI) prevents virus production from infected cells [20, 21]. Since these treatments are singly detrimental to the patient, an optimal therapy for the treatment of HIV infection using a combination of multiple appropriate treatment strategies is needed. Due to the lack of understanding of the mechanisms among host cells, HIV infection, and the happening of AIDS, many questions have been raised: What is the best combination? When is the appropriate time to start the treatment? How this treatment should be done? Some HIV mathematical models [2229] play a significant role in understanding the dynamics of viral transmission, drug therapy, and HIV-1 improvement. Optimal control theory [30] is a branch of mathematical science that helps us to find optimal ways to control infectious diseases. One of the optimal ways is to use the best drug dosage to treat and control the infection.

In this paper, we propose a new mathematical model of HIV, which is an extension of the model developed in [16, 17]. In the presented model, we use the logistic function to describe the rate of mitotic proliferation of healthy cells, the saturation function for virus-to-cell transmission, cell-to-cell transmission, and cellular and humoral immune. We also consider the cure rate (namely, the conversion rate of infected cells to healthy cells) by gene therapy or loss of all cccDNA from their nucleus [31].

This paper is organized as follows: In Sect. 2, we formulate our new model with five state variables and two control functions. In Sect. 3, by introducing two drug controllers, we state the necessary conditions for the existence of optimal control. In Sect. 4, we illustrate the numerical simulation of the model. In Sect. 5, we conclude.

2 Model formulation

The population of \(CD ^{+} _{4} \) T-cells is stimulated and divided by the antigen, and this proliferation stops when it reaches its maximum value. Hence, we can use the logistic function to describe this process [32, 33]. To construct a more realistic model, we use the saturation function instead of the bilinear infection rate [16, 34]. Besides the virus-to-cell transmission, we will use the rate of cell-to-cell transmission [9]. Both cellular and humoral immune systems are included in our model for investigating the effectiveness of the Foutz vaccine design [14]. The principle of the Kaminsky gene therapy states that the cure rate can be used to avert the infected cells to uninfected cells [31]. Due to the effect of antiviral drugs on HIV control and personal health, we consider two control functions to study their effect [15]. In view of the above assumptions, we provide a new model with five state variables. The state variables of this model are denoted by x, y, v, z, w, which are respectively: Population of uninfected \(CD^{+}_{4} \) T-cells, Population of infected \(CD^{+}_{4} \) T-cells, Population of infectious HIV virions, Population of T-cells, Population of B-cells. Moreover, two control functions denoted by \(u_{1}(t)\) and \(u_{2}(t) \), are introduced as reverse transcriptase inhibitor (RTI) and protease inhibitor (PI), respectively. RTI prevents the transcription process in HIV-infected cells and PI blocks the protease enzyme and prevents the production of infection and adult viruses. Our proposed model is given below.

$$\begin{aligned}& \frac{dx}{dt}= rx \biggl( 1-\frac{x+y}{m} \biggr)- \frac{ ( 1-u_{1}(t) ) \beta _{1} vx}{1+\alpha v}-\beta _{2} xy+\rho y-dx, \\& \frac{dy}{dt}= \frac{ ( 1-u_{1}(t) ) \beta _{1} vx}{1+\alpha v}+ \beta _{2} xy- ( \delta +\rho ) y-\rho _{1} yz, \\& \frac{dv}{dt}= \bigl( 1-u_{2}(t) \bigr)n\delta y-\mu v-\rho _{2} vw, \\& \frac{dz}{dt}= c_{1}yz-b_{1}z, \\& \frac{dw}{dt}= c_{2} vw-b_{2}w. \end{aligned}$$
(2.1)

All parameters presented in model (2.1) are positive and independent of time. They are defined in Table 1. The \(u_{1}\) controller shows the impact of reverse transcriptase inhibitors, and the \(u_{2}\) controller indicates the effect of protease inhibitor. These two controllers are time-dependent and limited to 0 and 1. The case \(u_{1}=u_{2}=0\) denotes 0% efficacy of the reverse transcriptase and protease inhibitors, while the case \(u_{1}=u_{2}=1\) indicates 100% efficacy of the reverse transcriptase and protease inhibitors. To begin, we assume that \(\Phi (t)=(x(t), y(t), v(t), z(t), w(t))\) is an integral curve of the system (2.1) parameterized by the time variable t. Now, we define an objective function as follows:

$$\begin{aligned} J\bigl(u_{1}(t), u_{2}(t)\bigr)= \int ^{t_{f}}_{0} \biggl( x(t)+z(t)+w(t)-v(t)- \frac{E_{1}}{2}u^{2}_{1}(t)-\frac{E_{2}}{2}u^{2}_{2}(t) \biggr)\,dt. \end{aligned}$$
(2.2)

In the above definition, the parameter \(t_{f}\) denotes the terminal time of the treatment, and the parameters \(E_{1} \) and \(E_{2}\) represent non-negative weight factors of the treatment for inhibiting the reverse transcriptase and protease enzymes. The quadratic expressions of \(u_{1} \) and \(u_{2} \) represent non-linear costs of the treatment, as pointed in [35]. We assume that \(u_{1} \) and \(u_{2} \) are piecewise continuous and Lebesgue-integrable.

Table 1 Used parameters in HIV mathematical model

Remark 2.1

Given a continuous function \(g(t)\) on the time interval \([a,b]\). Its average on this interval is given by

$$ \overline{g}=\frac{1}{b-a} \int _{a}^{b}g(t)\,dt. $$

Therefore, the integral defined in (2.2) denotes the average of the function \(g(t)=t_{f}(g_{1}(t)-g_{2}(t))\) on the interval \([0,t_{f}]\), where \(g_{1}(t)=x(t)+z(t)+w(t)\) and \(g_{2}(t)=v(t)+\frac{E_{1}}{2}u^{2}_{1}(t)+\frac{E_{2}}{2}u^{2}_{2}(t)\). We note that \(g_{1}(t)\) is the summation of the uninfected, cellular, and humoral immune cells, while \(g_{2}(t)\) is the summation of the population of viruses and the dosage of the drugs at time t. Hence, the best strategy for treating HIV infection is to maximize the objective function (2.2).

We aim to find the optimal controls \(u_{1}^{*} \) and \(u_{2}^{*}\) such that

$$\begin{aligned} J\bigl(u_{1}^{*}(t),u_{2}^{*}(t) \bigr)=\max \bigl\lbrace J\bigl(u_{1}(t),u_{2}(t)\bigr): \bigl(u_{1}(t),u_{2}(t)\bigr) \in U \bigr\rbrace , \end{aligned}$$
(2.3)

where U is a measurable control set described by

$$\begin{aligned} U= \bigl\lbrace \bigl(u_{1}(t), u_{2}(t)\bigr): u_{1}, u_{2} \text{ are measurable on } [0, t_{f}], \text{and } 0\leq u_{1}, u_{2} \leq 1 \bigr\rbrace . \end{aligned}$$

3 The necessary conditions for the existence of optimal control

In this section, by using the Pontryagin maximum principle [30], we obtain the necessary conditions for the existence of optimal control for system (2.1). The Pontryagin maximum principle states: if \(u^{*}(t)=(u_{1}^{*},u_{2}^{*})\in U\) is an optimal control for (2.2) with a fixed terminal time \(t_{f} \), then there exists an adjoint vector \(\lambda (t)\) with five adjoint variables \(\lambda _{1}\), \(\lambda _{2}\), \(\lambda _{3}\), \(\lambda _{4}\), \(\lambda _{5}\), which is defined as

$$\begin{aligned}& \lambda : [0, t_{f}] \rightarrow \mathbb{R}^{5}, \\& \lambda (t) = \bigl(\lambda _{1}(t), \lambda _{2}(t), \lambda _{3}(t), \lambda _{4}(t), \lambda _{5}(t) \bigr), \end{aligned}$$

such that for all \(t \in [0,t_{f}]\), the following conditions are satisfied.

  1. 1.

    The state variables are obtained from the below equations:

    $$\begin{aligned}& \frac{dx}{dt} = \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial \lambda _{1}},\qquad \frac{dy}{dt}= \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial \lambda _{2}}, \\& \frac{dv}{dt} = \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial \lambda _{3}},\qquad \frac{dz}{dt}= \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial \lambda _{4}}, \\& \frac{dw}{dt} = \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial \lambda _{5}}. \end{aligned}$$
  2. 2.

    The optimal control values \(u_{1}^{*} \) and \(u_{2}^{*} \) can be obtained from the optimality conditions:

    $$\begin{aligned} \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial u_{1}}=0, \qquad \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial u_{2}}=0. \end{aligned}$$
    (3.1)
  3. 3.

    The adjoint equations can be solved from

    $$\begin{aligned}& \frac{d\lambda _{1}}{dt} =- \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial x},\qquad \frac{d\lambda _{2}}{dt}=- \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial y}, \\& \frac{d\lambda _{3}}{dt} =- \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial v}, \qquad \frac{d\lambda _{4}}{dt}=- \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial z}, \\& \frac{d\lambda _{5}}{dt} =- \frac{\partial H(t, u_{1}^{*}, u_{2}^{*}, \lambda (t))}{\partial w}. \end{aligned}$$

According to the Pontryagin maximum principle, the Hamiltonian function H for our problem is defined as

$$\begin{aligned} & H(x,y, v, z, w, \lambda _{1}, \lambda _{2}, \lambda _{3}, \lambda _{4}, \lambda _{5}, u_{1}, u_{2}) \\ &\quad = x+z+w-v-\frac{E_{1}}{2}u^{2}_{1}- \frac{E_{2}}{2}u^{2}_{2} \\ &\qquad {} +\lambda _{1} \biggl( rx \biggl( 1-\frac{x+y}{m} \biggr)- \frac{ ( 1-u_{1}) \beta _{1} vx}{1+\alpha v}-\beta _{2} xy+ \rho y-dx \biggr) \\ &\qquad {} +\lambda _{2} \biggl( \frac{ ( 1-u_{1} ) \beta _{1} vx}{1+\alpha v}+\beta _{2} xy+ ( \delta +\rho ) y-\rho _{1} yz \biggr) \\ &\qquad {} +\lambda _{3} \bigl( ( 1-u_{2} )n\delta y-\mu v-\rho _{2} vw \bigr) +\lambda _{4} z ( c_{1}y-b_{1} ) +\lambda _{5} w (c_{2} v-b_{2} ). \end{aligned}$$
(3.2)

The adjoint variables satisfy

$$\begin{aligned}& \dot{\lambda }_{1}=-\frac{\partial H}{\partial x}=-1-\lambda _{1} \biggl(r-d-\frac{ry}{m}-\frac{2rx}{m}- \frac{(1-u_{1})\beta _{1}v}{1+\alpha v}-\beta _{2} y \biggr) \\& \hphantom{\dot{\lambda }_{1}=}{}-\lambda _{2} \biggl( \frac{(1-u_{1})\beta _{1}v}{1+\alpha v}+\beta _{2}y \biggr) , \\& \dot{\lambda }_{2}= -\frac{\partial H}{\partial y}=-\lambda _{1} \biggl( \rho -\frac{rx}{m}-\beta _{2}x \biggr)-\lambda _{2} (\beta _{2}x- \delta -\rho -\rho _{1} z )- \lambda _{3} (1-u_{2} ) n \delta -\lambda _{4}c_{1}z, \\& \dot{\lambda }_{3}= -\frac{\partial H}{\partial v}=1+\lambda _{1} \frac{(1-u_{1})\beta _{1}x}{(1+\alpha v)^{2}}-\lambda _{2} \frac{(1-u_{1})\beta _{1}x}{(1+\alpha v)^{2}}+\lambda _{3}(\mu +\rho _{2} \omega )-\lambda _{5}(c_{2}v-b_{2}), \\& \dot{\lambda }_{4}= -\frac{\partial H}{\partial z}=-1+\lambda _{2} \rho _{1}y+\lambda _{4}(b_{1}-c_{1}y), \\& \dot{\lambda }_{5}= -\frac{\partial H}{\partial w}=-1+\lambda _{3} \rho _{2}v+\lambda _{5}(b_{2}-c_{2}v). \end{aligned}$$

Since \(\lambda _{i} (t_{f})=0\) for \(i=1, 2, 3, 4, 5\), they are called the transversality conditions.

Theorem 3.1

Consider the objective function \(J(u_{1}(t),u_{2}(t))\) defined in (2.2). Then, there exists an optimal control \((u_{1}^{*}(t),u_{2}^{*}(t)) \in U\) such that

$$\begin{aligned} J\bigl(u_{1}^{*}(t),u_{2}^{*}(t)\bigr)= \max_{u_{1},u_{2}\in U} J\bigl(u_{1}(t), u_{2}(t)\bigr). \end{aligned}$$

Moreover, the optimal controls \(u_{1}^{*}\) and \(u_{2}^{*}\) maximizing the objective function (2.2) are given by

$$\begin{aligned} u_{1}^{*} (t) &=\min \biggl(\max \biggl( 0, \frac{\beta _{1}(\lambda _{1}-\lambda _{2})xv}{E_{1}(1+\alpha v)} \biggr),1 \biggr), \\ u_{2}^{*}(t) &=\min \biggl(\max \biggl(0,- \frac{n\delta y\lambda _{3}}{E_{2}} \biggr),1 \biggr), \end{aligned}$$

where \(x=x^{*}(t)\), \(y=y^{*}(t)\), and \(v=v^{*}(t)\) are the solutions of system (2.1).

Proof

From the results obtained by Fleming and Rishel [36], we can show the existence of the solution by using the following facts.

  1. (i)

    The set of all controls contained in U are non-negative and Lebesgue-integrable on \([0, t_{f}]\).

  2. (ii)

    The right-hand side of the system (2.1) is bounded by a linear function of the state and control variables, and thus the solutions exist.

  3. (iii)

    The set U is convex and closed.

  4. (iv)

    The integrand of the objective function, \(x(t)+z(t)+w(t)-v(t)-\frac{E_{1}}{2}u^{2}_{1}-\frac{E_{2}}{2}u^{2}_{2} \), is concave on U. To prove this, we use the fact that a multi-variable function as \(f(x_{1},\ldots , x_{n})\) is concave if and only if the Hessian matrix

    $$ H(x)= \biggl[\frac{\partial ^{2} f(x)}{\partial x_{i} \partial x_{j}} \biggr], $$

    is semi-negative definite. We set \({\mathcal{F}}(u_{1},u_{2})=x+z+w-v-\frac{E_{1}}{2}u^{2}_{1}- \frac{E_{2}}{2}u^{2}_{2}\), which admits the Hessian matrix

    H(u)= [ 2 F u 1 2 2 F u 1 u 2 2 F u 2 u 1 2 F u 2 2 ] = [ E 1 0 0 E 2 ] .

    Since \(E_{1}, E_{2} \geq 0 \), we have that \(\mathcal{H}(u)\) is semi-negative definite, and therefore, the result follows.

  5. (v)

    There exist constants \(a_{1}>0\), \(a_{2}>0\), and \(\beta >1\) such that the integrand \(L(t,x,y,v,z,w)\) of the objective function (2.2) is bounded by

    $$ L(t,x,y,v,z,w)\leq a_{1}-a_{2} \bigl( \vert u_{1} \vert ^{2}+ \vert u_{2} \vert ^{2} \bigr) ^{\beta /2}. $$
    (3.3)

    From (2.2), we have

    $$ L(t,x,y,v,z,w)=x(t)+z(t)+w(t)-v(t)-\frac{E_{1}}{2}u^{2}_{1}(t)- \frac{E_{2}}{2}u^{2}_{2}(t). $$
    (3.4)

    By taking \(E=\min \lbrace E_{1}, E_{2} \rbrace \) in (3.4), we find that

    $$ L(t,x,y,v,z,w)\leq 3M-\frac{E}{2} \bigl(u^{2}_{1}(t)+u^{2}_{2}(t) \bigr). $$

    Hence, we can write

    $$ L(t,x,y,v,z,w)\leq a_{1}-a_{2} \bigl(u^{2}_{1}(t)+u^{2}_{2}(t) \bigr), $$
    (3.5)

    where \(a_{1}=3M>0\), \(a_{2}=\frac{E}{2}>0\), and M is the upper bound of the state solutions \(x(t)\), \(z(t)\), \(w(t)\). This implies that the inequality (3.3) holds true with \(\beta =2>1\).

From the above statements (facts), we deduce the existence of the optimal controls \(u_{1}^{*} \) and \(u_{2}^{*} \). To obtain the expressions of \(u_{1}^{*}\) and \(u_{2}^{*}\), we use (3.1) with H defined in (3.2). This gives that

$$\begin{aligned} & -E_{1}u_{1}+\frac{\beta _{1}vx}{1+\alpha v}(\lambda _{1}- \lambda _{2})=0, \\ & -E_{2}u_{2}-n\lambda _{3}\delta y=0. \end{aligned}$$

Hence, we find that

$$\begin{aligned} &u_{1}^{*}(t)= \textstyle\begin{cases} 0 & \text{if }u_{1} \le 0, \\ \frac{ (\lambda _{1}(t)-\lambda _{2}(t) ) \beta _{1}v^{*}(t)x^{*}(t)}{E_{1}(1+\alpha v^{*}(t))} & \text{if }0 < u_{1} < 1, \\ 1 & \text{if }u_{1} \ge 1, \end{cases}\displaystyle \quad \text{and} \\ &u_{2}^{*}(t)= \textstyle\begin{cases} 0 & \text{if }u_{2} \le 0, \\ -\frac{n\delta \lambda _{3}(t)y^{*}(t)}{E_{2}} & \text{if }0 < u_{2} < 1, \\ 1 & \text{if }u_{2} \ge 1. \end{cases}\displaystyle \end{aligned}$$

 □

4 Numerical simulation

In this section, we investigate the optimal control numerically for studying the effectiveness of the drug on disease. At first, we replace the values of the parameters of Column 1, Column 2, Column 3, and Column 4 of Table 2 in model (2.1). Next, we choose the initial values from Table 3 and set \(E_{1} = 1\), \(E_{2} = 10\), and \(t_{f}=10 \). To numerically solve the optimal control problem (2.1) and (2.2), we use the Applied Modeling Programming Language AMPL [37]. We work with a grid of \(N_{f} = 10 0 0 \) grid points with nodes \(t_{i} = i h\), \(h = \frac{t_{f}}{N_{f}}\), \(i = 0 , 1 ,\ldots , N_{f} \) and use the Euler method. The proliferation of infected cells and viruses for the values of Column 1 of Table 2 are shown in Fig. 1(a)–(g). Figure 2(a)–(g) shows that for the values of Column 2 of Table 2, the amount of \(u_{1} \) and \(u_{2} \) affects the spread of disease. Figure 3(a)–(g) illustrates that for the values of Column 3 of Table 2, the effect of the drug on the proliferation of infected cells, viruses, cellular and humoral immunes.

Figure 1
figure 1

(a) Saturation level of uninfected \(CD^{+}_{4} \) T-cells with optimal control for Column 3 of Table 2 (b) Level of infected \(CD^{+}_{4} \) T-cells with optimal control for Column 3 of Table 2 (c) level of viral load with optimal control for Column 3 of Table 2 (d) level of T-cells with optimal control for Column 3 of Table 2 (e) level of B-cells with optimal control for Column 3 of Table 2 (f) Behavior of optimal control, \(u^{*}_{1} \) as protease inhibitor for Column 3 of Table 2 (g) Behavior of optimal control, \(u^{*}_{2} \) as reverse transcriptase inhibitor for Column 3 of Table 2

Figure 2
figure 2

(a) Saturation level of uninfected \(CD^{+}_{4} \) T-cells with optimal control for Column 4 of Table 2 (b) Level of infected \(CD^{+}_{4} \) T-cells with optimal control for Column 4 of Table 2 (c) level of viral load with optimal control for Column 4 of Table 2 (d) level of T-cells with optimal control for Column 4 of Table 2 (e) level of B-cells with optimal control for Column 4 of Table 2 (f) Behavior of optimal control, \(u^{*}_{1} \) as protease inhibitor for Column 4 of Table 2 (g) Behavior of optimal control, \(u^{*}_{2} \) as reverse transcriptase inhibitor for Column 4 of Table 2

Figure 3
figure 3

(a) Saturation level of uninfected \(CD^{+}_{4} \) T-cells with optimal control for Column 5 of Table 2 (b) Level of infected \(CD^{+}_{4} \) T-cells with optimal control for Column 5 of Table 2 (c) level of viral load with optimal control for Column 5 of Table 2 (d) level of T-cells with optimal control for Column 5 of Table 2 (e) level of B-cells with optimal control for Column 5 of Table 2 (f) Behavior of optimal control, \(u^{*}_{1} \) as protease inhibitor for Column 5 of Table 2 (g) Behavior of optimal control, \(u^{*}_{2} \) as reverse transcriptase inhibitor for Column 5 of Table 2

Table 2 The values of the parameters in the HIV mathematical model
Table 3 The initial values in HIV mathematical model

In Fig. 4(a)–(b), the population of infected \(CD^{+}_{4} \) T-cells is represented in the presence of treatment control functions with an initial value of \(y(0)=80 \), which is initially reduced by the initial proliferation of the population of uninfected \(CD^{+}_{4} \) T-cells. By controlling the disease, the number of uninfected \(CD^{+}_{4} \) T-cells reaches the saturation level, and the population of infectious cells tends to zero. Figure 4(c) shows that the proliferation of the virus in the presence of treatment is gradually reduced to zero. Figure 4(d)–(e) depicts the level of proliferation of T-cells and B-cells in the presence of treatment, respectively. Finally, Fig. 4(f)–(g) represents the optimal controls \(u_{1}^{*} \) and \(u_{2}^{*}\) that simulate the reverse transcriptase and protease inhibitors for the values of Column 4 of Table 2.

Figure 4
figure 4

(a) Saturation level of uninfected \(CD^{+}_{4} \) T-cells with optimal control for Column 6 of Table 2 (b) Level of infected \(CD^{+}_{4} \) T-cells with optimal control for Column 6 of Table 2 (c) level of viral load with optimal control for Column 6 (d) level of T-cells with optimal control for Column 6 of Table 2 (e) level of B-cells with optimal control for Column 6 of Table 2 (f) Behavior of optimal control, \(u^{*}_{1} \) as protease inhibitor for Column 6 (g) Behavior of optimal control, \(u^{*}_{2} \) as reverse transcriptase inhibitor for Column 6 of Table 2

5 Conclusion

In the present paper, we considered a five-dimensional model with the logistic function for replicating \(CD_{4}^{+}\) T cells, the saturation infection rate, and the treatment rate with two control functions to control the HIV-1 infection. There is no current definitive treatment for the HIV-1 infection. However, at the same time, several methods of treatment have been developed to control it. Because of the high costs of the treatment and side effects of drugs, we should minimize the dosages of drugs in the treatment. To this end, we introduce two controllers to identify the efficiency of reverse transcriptase and protease inhibitors. We used numerical values of the parameters to evaluate the model. Numerical methods used are based on optimal control to prevent the spread of infection and the production of new virus particles with minimal side effects through medication. The Pontryagin maximum principle was employed to provide the explicit formulations of the optimal controls. The optimal control process was numerically tested by replacing the values of Columns 1–4 of Table 2 in the model (2.1). The numerical simulation shows that the virus load stops after treatment, and the spread of infected cells is reduced. The above results were obtained by using AMPL software. Numerical results of the model show that the concentration of infected cells increases before treatment and decreases after treatment. The results suggest that the optimal amount of drugs effectively better control AIDS and minimize the side effects of drugs.