Artificial Bee Colony Algorithm
Artificial Bee Colony Algorithm
Abstract: This paper presents a linear quadratic optimal controller design for a nonlinear inverted pendulum. Linear Quadratic Regulator
(LQR), an optimal control method, is usually used for control of the dynamical systems. Main design parameters in LQR are the weighting
matrices; however there is no relevant systematic techniques presented to choose these matrices. Generally, selecting weighting matrices
is performed by trial and error method since there is no direct relation between weighting matrices and time domain specifications like
overshoot percentage, settling time, and steady state error. Also it is time consuming and highly depends on designer’s experience. In this
paper LQR is used to control an inverted pendulum as a nonlinear dynamical system and the Artificial Bee Colony (ABC) algorithm is
used for selecting weighting matrices to overcome LQR design difficulties. The ABC algorithm is a swarm intelligence based optimization
algorithm and it can be used for multivariable function optimization efficiently. The simulation results justify that the ABC algorithm is a
very efficient way to determine LQR weighting matrices in comparison with trial and error method.
This journal is © Advanced Technology & Science 2013 IJISAE, 2015, 3(1), 1–6 | 1
The inverted pendulum system used in this study consists of a
motor driven cart and a pendulum hinged to it, as shown in (Figure
1). The inverted pendulum system model used in this paper has
been suggested by Ogata [12]. The main aim of the controller is to
stabilize the pendulum as to keep pendulum upright position in
response to a change in cart position. Designed block diagram of
control system is shown in (Figure 2). Linear quadratic optimal
control where weighting matrices are selected by the ABC
algorithm can be used to determine design variables; integral gain
constant 𝐾𝑙 and feedback gain matrix 𝐾.
Assume that the rod is massless and the pendulum mass is
concentrated at the end of the rod. 𝜃 is the angel of the rod from
vertical line and the control force 𝑢 is applied to the cart. Also
assume that the sampling period 𝑇 is 0.1 𝑠, 𝑔 is 9.81 𝑚/𝑠 2 and
the following numerical values for 𝑀, 𝑚 and 𝑙:
Figure 1. Inverted pendulum system [12]
M 2kg, m 0.1kg , l 0.5m
x1 , x2 , x3 x, x4 x
x1 x2 (1)
Figure 2. Block diagram of control system
x( k )
u K ( k ) x(k ) K l v (k ) K Kl (11)
v(k )
2 | IJISAE, 2015, 3(1), 1–6 This journal is © Advanced Technology & Science 2013
vector), respectively. 𝐺 and 𝐻 are 𝑛 × 𝑛 and 𝑛 × 𝑟 matrices, 𝑃 must be a positive definite, or for asymptotic stability a positive
indicate the constant system. 𝐾 is state feedback matrix. semi-definite.
At steady-state, the overall system dynamics with constant gain According to main design parameters of the linear quadratic
and integral feedback is described by the state equation which is a optimal control problem which are weighting matrices 𝑄 and 𝑅,
combination of (Equation 8) through ( Equation 11): the quality of the controller design depends on the choice of these
matrices. However, there are no relevant systematic techniques to
x(k 1) G 0 x(k) H 0 select weighting matrices. This goal is performed by trial and error
v k 1 v k u k r k (12)
CG 1 CH method in general. Although it depends on the designer’s
1
experience, it is highly time consuming and selected values for
weighting matrices cannot establish a direct effect on the desired
In (Equation 12), it is assumed that the reference is a step change particular control system specifications.
hence 𝑟(𝑘) = 𝑟(𝑘 + 1). According to the importance of selecting weighting matrices 𝑄 and
Let us define 𝑅, selection of these matrices is performed by the ABC algorithm
in this paper.
G 0
Gˆ 4. The Artificial Bee Colony Algorithm
CG 1
The Artificial Bee Colony (ABC) algorithm was introduced by
H Karaboga in 2005 as a new method which is based on the
Hˆ intelligent behavior of honey bee swarms finding nectar and
CH
sharing the information of food resources with each other in the
field Swarm Intelligence to solve to optimize numeric benchmark
Kˆ K Kl functions [13]. Then it was extended by Karaboga and Basturk and
presented to exceed other recognized heuristic methods like
x Genetic Algorithm as well as Differential Evolution algorithm and
xˆ Particle Swarm Optimization [14], [15]. The ABC algorithm has
v
the advantages of strong robustness, fast convergence and high
flexibility, fewer control parameters and also it can be used for
0
Dˆ solving multidimensional and multimodal optimization problems
1 [16], [17].
In the ABC algorithm, the colony of artificial bees contains three
Therefore, the last equation can be written as follows: groups of bees: employed bees, onlooker bees and scout bees. An
employed bee memorizes the quality of the food source and finds
xˆ k 1 Gˆ HK
ˆ ˆ xˆ k Dr
ˆ k (13) a food source by modifying this information. Employed bees share
the food source information with other bees on the dance area.
The (Equation 13) is the state equation of the closed-loop control Onlooker bees watch the dance of employed bees within the hive
system. Its output equation is and find the food sources using the information provided by
employed bees. Scout bees search new food sources around the
ˆ ˆ(k ) [0]r (k )
y(k ) Cx (14) hive randomly. Both onlookers and scouts are also called
unemployed bees. The number of employed bees is equal to the
where 𝐶̂ = [𝐶 0]. number of food sources since each employed bee is associated with
Linear quadratic optimal control problem may be stated to find the one and only one food source. The position of a food source means
optimal input 𝑢 sequence that minimizes the quadratic a possible solution to the problem and the nectar amount of a food
performance index which is defined as: source corresponds to the fitness of the associated solution.
The general scheme of the ABC algorithm contains four phase;
1 * initialization phase, employed bees phase, onlooker bees phase,
J x (k )Qx(k ) u* (k )Ru(k )
2 k o
(15) and scout bees phase. Detailed pseudo code of the ABC algorithm
is as follows [18]:
1. Initialize the population of solutions
where Q is positive definite 𝑛 × 𝑛 matrix and 𝑅 is positive definite 2. Evaluate the population
𝑟 × 𝑟 matrix. The notation ( ∗ ) indicates complex-conjugate 3. cycle=1
transpose of a matrix. Matrices 𝑄 and 𝑅 are selected to weight the 4. repeat
relative importance of the performance measures caused by the 5. Produce new solutions (food source positions) vij in the
state vector and control vector, respectively. neighborhood of 𝑥𝑖𝑗 for the employed bees using the
The state feedback gain matrix is defined as follows: formula 𝑣𝑖𝑗 = 𝑥𝑖𝑗 + Φ𝑖𝑗 (𝑥𝑖𝑗 − 𝑥𝑘𝑗 )(k is a solution in the
neighborhood of 𝑖 ,Φ is a random number in the range
Kˆ ( R Hˆ *PHˆ )1 Hˆ *PGˆ (16) [-1,1] ) and evaluate them
6. Apply the greedy selection process between xi and 𝑣𝑖
7. Calculate the probability values 𝑃𝑖 for the solutions 𝑥𝑖 by
which is obtained by solving the following Ricatti equation: means of their fitness values using the following
equation
P Q Gˆ *PGˆ Gˆ *PHˆ ( R Hˆ *PHˆ )1 Hˆ *PGˆ (17)
fiti
Pi SN
(18)
By the sense of Liapunov, for a stable matrix (𝐺̂ − 𝐻
̂𝐾̂ ), the matrix fit
i 1
i
This journal is © Advanced Technology & Science 2013 IJISAE, 2015, 3(1), 1–6 | 3
In order to calculate the fitness values of solutions we
employed the following equation
1
if fi 0
fiti 1 f i (19)
1 abs f if f i 0
i
K 64.9346 14.4819 10.8475 9.2871 Moreover, based on these matrices, feedback gain matrix 𝐾and
Kl -0.5189
integral gain constant 𝐾𝑙 are determined as follows:
os % 0 0.1038
004
ess 2.3938 10 5.3479 10009
f sum 4.8989 1.6002
4 | IJISAE, 2015, 3(1), 1–6 This journal is © Advanced Technology & Science 2013
References
[1] K. J. Aström and K. Furuta, "Swinging up a pendulum by
energy control," Automatica, vol. 36, no. 2, pp. 287-295,
2000.
[2] J. Anderson, "Learning to control of an inverted pendulum
using neural networks," IEEE Control Systems Magazine,
vol. 9, no. 3, pp. 31-37, 1989.
[3] A. Kuo, "The six determinants of gaint and the inverted
pendulum analogy: Adynamic walking perspective," Human
Movement, vol. 26, pp. 617-656, 2007.
[4] S. Jeong and T. Takahashi, "Wheeled inverted pendulum type
Figure 4. Cart Position and Pendulum Angle for Trial and Error Method asistant robot: inverted mobile, standing and sitting motions,"
in IEEE/RSJ International Conferance on Intelligent Robots
and Systems, 2007, 2007.
[5] D. E. Kirk, Optimal control theory: an introduction, New
Jersey: Prentice-Hall, Inc., 1970.
[6] M. Athans, "The status of optimal control theory and
applications for for deterministic systems," IEEE
Transactions on Automatic Control, vol. 11, no. 3, pp. 580-
596, 1966.
[7] R. E. Kalman, "When is a linear control system optimal?,"
Journal of Basic Engineering, vol. 86, pp. 51-56, 1964.
[8] H. Kwakernaak and R. Sivan, Linear optimal control systems,
New York: Wiley-Interscience, 1972.
[9] J. V. D. F. Neto, I. S. Abreu and F. N. Da Silva, "Neural-
genetic synthesis for state-space controllers based on linear
quadratic regulator design for eigenstructure assignment,"
Figure 5. Cart Position and Pendulum Angle for Proposed Method
Trans. Sys. Man Cyber. Part B, vol. 40, no. 2, pp. 266-285,
2010.
Since the matrix P is positive definite, the closed-loop control [10] C. P. Bottura, J. V. da Fonseca Neto, "Parallel eigenstructure
system is stable. That is, all eigenvalues of Gˆ HK
ˆ ˆ lie inside assignment via LQR design and genetic algorithms," in
of the unit circle in the following: Proceedings of the American Control Conference 1999. Vol.
4. , San Diago, 1999.
z1 0.2077 [11] S. Mobayen, A. Rabiei, M. Moradi and B. Mohammady,
"Linear quadratic optimal control system design using
z2 0.77628 + 0.28782i
particle swarm optimization algorithm," International Journal
z3 0.77628 - 0.28782i of the Physical Sciences, vol. 6(30), pp. 6958-6966, 2011.
z4 0.75904 [12] K. Ogata, "Quadratic Optimal Control Systems," in Discrete-
Time Control Systems 2nd Edition, Englewood Cliffs, NJ,
z5 0.72792 Prentice-Hall, 1995, pp. 566-633.
[13] D. Karaboga, "An idea based on honey bee swarm for
The performance results are presented in (Table 1). Also plots of numerical optimization," Erciyes University, Kayseri,
position of the cart and pendulum angels as unit-step response of Turkey, 2005.
designed system has been is in (Figure 4) and (Figure 5) for both
control systems. Cart position is indicated by solid line and [14] D. Karaboga and B. Basturk, "An artificial bee colony (ABC)
pendulum angle is indicated by dotted line in these figures. Both algorithm for numeric function optimization.," in IEEE
simulations are performed on the nonlinear pendulum model given Symp. Swarm Intelligence, Indianapolis, 2006.
by (Equation 1) through (Equation 5). [15] D. Karaboga and B. Basturk, "On the performance of artificial
bee colony (ABC) algorithm," Applied Soft Computing, vol.
6. Conclusion 8, no. 1, pp. 687-697, 2008.
[16] D. Karaboga and B. Basturk, "A powerful and efficient
In this paper, the ABC algorithm based linear optimal controller
algorithm for numerical function optimization: artificial bee
design for nonlinear inverted pendulum has been presented. The
colony (ABC) algorithm," Journal of Global Optimization,
ABC algorithm has been employed to determine linear quadratic
vol. 39, no. 3, pp. 459-471, 2007.
optimal controller weighting matrices. Using the ABC algorithm
has been proved to be effective and feasible to select weighting [17] D. Karaboga and B. Akay, "A comparative study of Artificial
matrices for nonlinear pendulum controller design more than trial Bee Colony algorithm," Applied Mathematics and
and error method. Also it has been shown that it can optimize Computation, vol. 214, no. 1, p. 108–132, 2009
multiple time domain control system specifications such as settling
time, overshot and steady state error.
This journal is © Advanced Technology & Science 2013 IJISAE, 2015, 3(1), 1–6 | 5
[18] "Detailed Pseudocode of the ABC Algorithm," 14 October [19] R. Coban , "A fuzzy controller design for nuclear research
2008. [Online]. Available: reactors using the particle swarm optimization algorithm,"
http://mf.erciyes.edu.tr/abc/pub/PsuedoCode.pdf. [Accessed Nuclear Engineering and Design, vol. 241, no. 5, pp. 1899-
1 March 2014]. 1908, 2011.
6 | IJISAE, 2015, 3(1), 1–6 This journal is © Advanced Technology & Science 2013