0% found this document useful (0 votes)
30 views11 pages

6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS OF EPIDEMIOLOGICAL TYPE

This research article presents a 6th-order Runge-Kutta forward-backward sweep algorithm (RK6FBSM) for solving optimal control problems, particularly in epidemiological models. The RK6FBSM demonstrates improved accuracy and convergence compared to traditional methods like Euler and 4th-order Runge-Kutta. Numerical simulations confirm the effectiveness of the proposed method in optimizing control inputs under various conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views11 pages

6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS OF EPIDEMIOLOGICAL TYPE

This research article presents a 6th-order Runge-Kutta forward-backward sweep algorithm (RK6FBSM) for solving optimal control problems, particularly in epidemiological models. The RK6FBSM demonstrates improved accuracy and convergence compared to traditional methods like Euler and 4th-order Runge-Kutta. Numerical simulations confirm the effectiveness of the proposed method in optimizing control inputs under various conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

RESEARCH ARTICLE

6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP


ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS OF
EPIDEMIOLOGICAL TYPE

AJE TEMITOPE*

Department of Mathematical Sciences


Federal University of Technology, Akure, Ondo-State, Nigeria

Corresponding Email: [email protected]

Received: 11-11-2022; Revised: 19-12-2022; Accepted: 05-01-2023

ABSTRACT
This paper seeks to formulate a more accurate forward-backward algorithm for solving optimal control
problems using the 7-stage Runge-Kutta of order 6 (RK6) numerical scheme. The control variable were
approximated using the interpolating polynomial or spine while the RK6 forward and backward sweeps
were used in approximating the state and adjoint variables respectively because its A-stability, accuracy
and higher rate of convergence. Three numerical examples were simulated to ascertain the accuracy and
convergence of the 6th order Runge-Kutta forward-backward sweep method (K6FBSM). It was
discovered that the RK6FBSM performs better when compared with the Euler and the 4th order Runge-
Kutta Forward-Backward Sweep method RK4FBSM.

Keywords: Runge-Kutta of order 6, Forward-Backward Sweep method,

INTRODUCTION

Optimal control involves finding control inputs that optimize a particular performance criterion subject to
system dynamics and constraints[1]. The modern formulation of optimal control theory began in the mid-
20th century with contributions from Plethora of authors[2], The Forward Backward Sweep Method
(FBSM) is an indirect numerical method widely used for solving optimal control problems due to its
computational efficiency and ease of implementation[3]. Reviewed the FBSM for both bounded and
unbounded control problems, incorporating various numerical schemes such as Euler, trapezoidal, and
Runge-Kutta techniques[4]. The method iteratively solves the state equations forward in time and the
adjoint equations backward in time, updating the control inputs at each iteration[5]. The Forward-
Backward Sweep (FBS) method is a popular technique for solving optimal control problems, especially
those formulated as two-point boundary value problems by iteratively solving the state and costate
equations forward and backward in time, respectively[6]. According to the FBS method is particularly
effective because it directly integrates the state and costate equations while updating the control policy at
each iteration[7]. The method is proven to be robust and provides accurate solutions for a range of test
problems, demonstrating its utility in practical applications[8].

www.ajms.com
6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

METHODOLOGY
The solution to optimal control problems involves the derivation of the optimal control characterization
and the use of the forward and backward sweep for the state and control trajectories respectively[9]. By
the Pontryagin’s maximum, the optimal control can be analytically derived by the optimality condition
while the state and control variables can be derived numerically using the Runge-Kutta of order six
subject to the adjoint and transversality conditions[10].

1.1: Statement of problem


We considered the generalized Optimal Control problem given below;

(1)
subject to : x˙1 = g1(t,x1(t),x2(t),...,xn(t),u(t)) (2)

x˙2 = g2(t,x1(t),x2(t),...,xn(t),u(t)) (3)

...

xn = gn(t,x1(t),x2(t),...,xn(t),u(t)) (4)

umin ≤ u ≤ umax (5)

Where, (x1(t0),x2(t0),...,xn(t0)) = (0,0,...,0)T ∈ Rn.

The Hamiltonian of the constrained optimal control problem is written as

and the optimality, adjoint and transversality conditions are expressed below respectively as

(Optimality) (7)

(Adjoint) (8)
(Transversality), (9)

1.2: 6th Order Runge-Kutta Scheme


The 7-stage Runge-Kutta of order 6 (RK6) iterative scheme was considered for the development of the
forward-backward sweep Algorithm for the solution of Optimal control problems[11]. The RK6 enhances
the level of accuracy of the results of the optimal control problem with the developed algorithm[12].

AJMS/Oct-Dec 2024/Volume 8/Issue 4 2


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

1.3: Forward-Backward Sweep Method


The derivation of the forward-backward sweep requires the discretization of state, control, and adjoint
variables along the knots t0 ≤ t1 ≤ t2 ≤ ··· ≤ tN, such that ),

), and λji= λi(t0 − jh) for tk= t0 + kh and h = (T − t0)/N is the


Step-length with N number of grid-points.Therefore, for any argument xi in the state vector (
and a unit adjoint variable us for s ∈ {1,2,··· ,m} and the forward sweep of the state
variable using the RK6 method is written as:

(10)
(11)
(12)
(13)
(14)
(15)
(16)
(17)

for the subscript of each argument i= 1,2,··· ,n, r = 1,2,··· ,m, the counter k = 1,2,··· ,N. and the functions

gl, l = 1, 2···7 are once continuously differentiable within the time interval [
and Kil denoting the dynamical function of the i−th component (argument) and the l−th stage. For the
control characterization, the optimal variable is derived using the optimality condition = 0 such that

AJMS/Oct-Dec 2024/Volume 8/Issue 4 3


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

(18)
The interpolating polynomial or spline [8] of the control variable us(.) can be computed as the formula;

(19)
The control variable for the forward(+) and backward (-) sweep are approximated respectively as follows;

(20)
The backward sweep of the adjoint variables using the proposed RK6 method requires the discretization
of the adjoint such that for any argument with a specific control variable us
attached to each state equation is expressed thus:

(21)
Deploying the 7-stage RK6 numerical scheme in the discretization of the backward sweep for the adjoint
variables yields the following:

1.4: RK6 Forward-Backward Algorithm for Optimal Control Problem


Step 1: Initialization Input

Step 2: Forward Sweep for state variables

Compute while k = 0,1,2,...,N do from equations (10) to (17) respectively and sequentially.

AJMS/Oct-Dec 2024/Volume 8/Issue 4 4


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

Step 3: Backward Sweep for adjoint variables


Set j = N + 2 – i and compute λji−1 from equations (22) to (29) respectively Step 4: Control
Characterization Compute control within bounds
from equation (18)
Step 5: Termination criteria
If termination conditions are met go to step 6 otherwise step 7

Step 6: Output xki,λji,u∗i(∀i,j) and end function Step 7: Return Repeat step 2

2: Numerical simulations: Implementation and Results


Example 1: Considering the optimal control problem below

Min J[u] = min∫

x′(t) = x(t) + u(t), (30)

x(0) = 1, x(1) free.

The Hamiltonian function H is defined as H = u(t)2 +λ(t)·(x(t)+u(t)) where λ(t) is the adjoint variable (or
costate). Using the optimality adjoint and transversality conditions yields the analytical (exact) optimal
solution below:

x∗(t) = et, u∗(t) = 0. (31)

The optimal control obtained using the optimality condition, = 0, is given by

(32)

ascertained to be minimum since

The derived costate equation using the adjoint conditions, , given by:
λ′(t) = −λ(t), λ(T) = 0 (33)
Applying the forward Euler, RK4 and the proposed RK6 forward -backward sweep methods (i.e
RK4FBSM and proposed RK6FBSM respectively) yields the results below.

Table1: Result of State variable for example 1

S/N Exact Euler RK4FBSM Proposed RK6FBSM

xA xE |xA− xE| xK4 |xA− xK4| xK6 |xA−


xK6|

AJMS/Oct-Dec 2024/Volume 8/Issue 4 5


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

1 1.1051709181 1.1111111111 5.9401930000 1.1051708333 8.47000 1.1051709181 0.00000


×10−3 ×10−8 × 100

2 1.2214027582 1.2345679012 1.3165143100 1.2214025709 1.87300 1.2214027582 0.00000


×10−2 ×10−7 ×100

3 1.3498588076 1.3717421125 2.1883304900 1.3498584971 3.10500×10−7 1.3498588076 0.00000


×10−2 ×100

4 1.4918246976 1.5241579028 3.2333205100 1.4918242401 4.57600 1.4918246977 0.00000


×10−2 ×10−7 ×100

5 1.6487212707 1.6935087808 4.4787510100 1.6487206386 6.32100 1.6487212707 0.00000


×10−2 ×10−7 ×100

6 1.8221188004 1.8816764232 5.9557622800 1.8221179621 8.38300 1.8221188004 0.00000


×10−2 ×10−7 ×100

7 2.0137527075 2.0907515813 7.6998873800 2.0137516266 1.08090 2.0137527075 0.00000


×10−2 ×10−6 ×100

8 2.2255409285 2.3230573125 9.7516384100 2.2255395633 1.36520 2.2255409285 0.00000


×10−2 ×10−6 ×100

9 2.4596031112 2.5811747917 1.2157168060 2.4596014138 1.69740 2.4596031112 0.00000


×10−1 ×10−6 ×100

10 2.7182818285 2.8679719908 1.4969016230×10−1 2.7182797441 2.08430×10−6 2.7182818285 0.00000


×100

Table 1: |xA− xE|, |xA− xK4|and|xA − xK6| ≡ errors of Euler RK4 & RK6 respectively

Figure 1: Rate of convergence in 10 iters.

Example 2: Considering the SIS Model with Treatment [9]

(34)

(35)

AJMS/Oct-Dec 2024/Volume 8/Issue 4 6


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

I(0) = I0, I(T)free. (36)

The Hamiltonian is given by:

H(I(t),u(t),λ(t)) = ω1I(t) + u2(t) + λ(t)(β(N − I(t))I(t) − (µ + γ)I(t) − u(t)I(t)(37) The optimal control
obtained using the optimality condition, = 0, is given by

. (38)

ascertained to be minimum since

The derived co-state equation using the adjoint conditions, , given by:

λ′(t) = −ω1 − λ(t)β(N − I(t)) − βI(t) − (µ + γ) − u(t), λ(T) = 0 (39)

Applying the forward Euler, RK4 and the proposed RK6 forward -backward sweep methods (i.e
RK4FBSM and proposed RK6FBSM respectively) also yields the results in Table 2 below using the
following parameters: β = 0.05, µ = 0.01, γ = 0.5, N = 100, ω1 = 1 and T = 1.

Table 2: Result of State and Control variables for example 2

S/N Euler convergence Proposed RK6FBSM

xE uE xK4 uK4 xK6 uK6

1 10.0000000000 5.2355651638 10.0000000000 4.5926947060 10.0000000000 4.6363573386

2 8.7650656568 4.6326137300 9.5613737942 4.3167361686 9.5464589222 4.3768363778

3 8.2556597311 4.1600567381 9.4089685710 4.0418362859 9.3440040276 4.1061078144

4 8.1851105244 3.7431700492 9.5201882548 3.7594888052 9.3763319652 3.8164326820

5 8.4592147545 3.3460084781 9.9038244602 3.4602903181 9.6519009702 3.4992076079

6 9.0673116818 2.9449889133 10.6018768364 3.1325900058 10.2060033528 3.1440596831

7 10.0557266500 2.5197980734 11.7007294372 2.7604692418 11.1093962855 2.7374992954

8 11.5303031948 2.0484433716 13.3574883436 2.3201655255 12.4871637697 2.2605946027

9 13.6800933636 1.5026879752 15.8577984930 1.7728678617 14.5571182701 1.6844954512

10 16.8306930352 0.8415968385 19.7510850824 1.0482398348 17.7109254612 0.9609642283

11 21.5547425985 0.0000000000 26.2132226347 0.0000000000 22.7016008493 0.0000000000

AJMS/Oct-Dec 2024/Volume 8/Issue 4 7


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

RK6FBSM
RK4FBSM
6
Euler

0
0 2 4 6 8 10

Figure 2: Rate of convergence in 10 iterations.

Example 3: We considered the model on optimal control and comprehensive cost effectiveness analysis
for COVID-19 [2]

(40)

Subject to the non-autonomous system below

(41)

where ,

Ai >0(i= 1,2,3,4). The derived adjoint equations were

AJMS/Oct-Dec 2024/Volume 8/Issue 4 8


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

(42)

while the optimal control characterizations were;

(43)

Simulating with the following parameters β1 = 0.1233;β2 = 0.0542;β3 = 0.0020;β4 = 0.1101;δ = 0.1980;τ =
0.3085;d = 1/(74.87 ∗ 365);d1 = 0.0104;γ1 = 0.3680;γ2 =0;ψ1 = 0.2574;ψ2 = 0.2798;ψ3 = 0.1584;ϕ = 0.3820
yields the results below.

Table 3: Convergence analysis of State variable (E(t)) for example 3

S/N Euler RK4FBSM Proposed RK6FBSM

EE EK4 EK6

1 1.5000000000 - 1.5000000000 1.5000000000

11 1.4586854415 2.7646377×10−3 1.4582818367 2.7890189 10- 1.4581829510 2.7953366×10−3


3

21 1.4194850125 2.6987961×10−3 1.4187988721 2.7167244 10- 1.4186243717 2.7216273×10−3


3

31 1.3821955578 2.6394372×10−3 1.3813219909 2.6520393 10- 1.3810945185 2.6556630×10−3


3

41 1.3466385402 2.5859736×10−3 1.3456514066 2.5942269 10- 1.3453892655 2.5968128×10−3


3

AJMS/Oct-Dec 2024/Volume 8/Issue 4 9


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

51 1.3126570130 2.5378496×10−3 1.3116129021 2.5425930 10- 1.3113294894 2.5443931×10−3


3

61 1.2801128162 2.4946384×10−3 1.2790541427 2.4967666 10- 1.2787595421 2.4977039×10−3


3

71 1.2488168407 2.4685349×10−3 1.2477535795 2.4713852 10- 1.2474913995 2.4675198×10−3


3

81 1.2184644912 2.4616005×10−3 1.2173844274 2.4656931 10- 1.2171894367 2.4600497×10−3


3

91 1.1893046217 2.3341404×10−3 1.1885613052 2.2797627 10- 1.1883097475 2.2930852×10−3


3

101 1.1685184378 1.2045593×10−3 1.1684734094 1.2114794 10- 1.1676305020 1.2714446×10−3


3

Figure 3: Convergence of E(t) in 101 iterations. Fig 4: Convergence of B(t) in 101 iterations.

DISCUSSION OF RESULTS
In example 1, the rate of convergence of the 3 methods: Euler, RK4 and Rk6 were compared on the state
variable as demonstrated on table 1. It was discovered that the rate of convergence of the RK6 compares
favorably with RK4 with higher level of accuracy after 10 iterations. In similar manner, Table 2 and 3
were used to compare the Iterates for the Euler, RK4 and RK6 forward-backward sweep methods on the
state variables of examples 2 and 3 respectively. Figures 2, 3 and 4 were used to illustrate the rate of
convergences which shows that the RK6FBSM performs excellently well although the computational
efforts is more in terms of rigors of coding and process time.

CONCLUSION
The adaptation of the 6th order Runge-Kutta forward-backward sweep algorithm for solving generalized
optimal control problems with bounded control arrives at an accurate result at a faster rate of convergence
compared to the Runge-Kutta of order four (RK4), due to its stability and higher numerical order of
convergence. This adaptation is essential for handling mathematical models with large number of non-
linear dynamical equations. Therefore, the sixth order Runge-Kutta forward-backward sweep algorithm

AJMS/Oct-Dec 2024/Volume 8/Issue 4 10


6TH-ORDER RUNGE-KUTTA FORWARD-BACKWARD SWEEP ALGORITHM FOR SOLVING OPTIMAL CONTROL MODELS
OF EPIDEMIOLOGICAL TYPE

seeks to provide a more effective and efficient method due to its speed, accuracy, higher rate of
convergence, suitability and versatility for real-time or practical applications such as the Epidemiological
and general Biomedical models (see MATLAB code in Appendix).

REFERENCES
1. Adamu, S. (2023). Numerical solution of optimal control problems using block method. Electronic
Journal of Mathematical Analysis and Applications, 11(2), 8. ISSN: 2090729X (online). Retrieved
from http://ejmaa.journals.ekb.eg
2. Asamoah, J. K., Okyere, E., Abidemi A., Moore, S. E., Sun, G.,, Jin,, Z., Acheampong, E. and
GordonOptimal, J. F. (2022), Control and comprehensive costeffectiveness analysis for COVID-19
3. Banu, M. S., Raju, I. and Mondal, S. (2021). A comparative study on classical fourth order and
Butcher sixth order Runge-Kutta methods with initial and boundary value problems. International
Journal of Material and Mathematical Sciences, 2(1), 8-21.
https://doi.org/10.34104/ijmms.021.08021
4. Berkovitz, L. D. (1962). On control problems with bounded state variables. Journal of Mathematical
Analysis and Applications, 5, 488-498. https://core.ac.uk/display/82704868
5. Guzman D´ıaz, D., Gomez-Aleixandre, J. and Coto, J. (2015). Direct backward/forward sweep
algorithm for solving load power flows in AC droopregulated microgrids. IEEE Transactions on
Power Systems, 30(6), 3151-3160. https://www.researchgate.net/publication/282530636
6. Kirk, D. E. (2004). Optimal control theory: An introduction . Dover Publications . 184-240.
Retrieved from https://dokumen.tips/documents/optimal-control-theoryan-introduction.html?page=2
7. La Torre, D., Kunze, H., Ruiz-Galan, M., Malik, T. and Marsiglio, S. (2015). Optimal Control:
Theory and Application to Science, Engineering, and Social Sciences. Abstract and Applied
Analysis, 890527. https://doi.org/10.1155/2015/890527
8. Lenhart, S., & Workman, J. T. (2007). Optimal control applied to biological models (Chapman &
Hall/CRC Mathematical and Computational Biology Series). Chapman and Hall/CRC. Retrieved
from https://dokumen.pub/download/optimalcontrol-applied-to-biological-models-9781322628394-
1322628394-978-1-4200-1141-8-
9. 1420011413 .html
10. Martcheva, M. (2015). An introduction to mathematical epidemiology (Texts in Applied
Mathematics 61). Springer Science+Business Media New York, p. 237. https://doi.org/10.1007/978-
1-4899-7612-3
11. Pontryagin,L. S., Boltyanskii, V. G., Gamkrelize, R. V. and Mishchenko, E. F. (1962). The
Mathematical Theory of Optimal Processes. Wiley, New York.
12. Rose, G. R. (2015). Numerical Methods for Solving Optimal Control Problems. Master’s Thesis,
University of Tennessee. Retrieved from https://trace.tennessee.edu/utkgradthes/3401.

AJMS/Oct-Dec 2024/Volume 8/Issue 4 11

You might also like