You are on page 1of 4

Back Propagation Neural Network Based on Artificial Bee Colony Algorithm

Feihu Jin, Guang Shu


Department of Computing and Science, Harbin University of Science and Technology, Harbin China fhjin88@163.com
AbstractThe artificial bee colony algorithm is a novel simulated evolutionary algorithm. The artificial bee colony algorithm has positive feedback, distributed computation and a constructive greedy heuristic convergence. Back propagation is a kind of feed forward neural network widely used in many areas, but it has some shortcomings, such as low precision solutions, slow search speed and easy convergence to the local minimum. The combination of artificial bee colony algorithm and back propagation neural network is adopted so that a nonlinear model can be identified and an inverted pendulum can be controlled. Simulation results show that the extensive mapping ability of neural network and the rapid global convergence of artificial bee colony algorithm can be obtained by combining artificial bee colony algorithm and neural network. Keywords; artificial bee colony; neural network; system identification; inverted pendulum system

network, combining the two aspects to solve the nonlinear model identification and the control of inverted pendulum. II. THE PRINCIPLE OF ARTIFICIAL BEE COLONY ALGORITHM

I.

INTRODUCTION

Bee colony can always easily found good nectar source. German biologist Frisch found that the bees dance to communicate the information of nectar source[8]. Employee bee return beehive and dancing; the bees crawl along a straight line, and then turn left, moving as figure eight and swinging their belly, which is called the waggle dance. The angle between the gravity direction and the centre axis of the dance is exactly equal to the angle between the sun and food source. The intelligent behavior of the dance consists of 3 basic parts: employee bees, onlooker bees EF, scout bees UF. Three behavior patterns are defined: the search for nectar, honey recruitment and abandoning nectar.
EF1 EF2
nectar source A

The research on neural network is very active and has been made considerable progress in recent years. Neural network has complex nonlinear mapping ability, function approximation and large-scale parallel distributed computing ability. The most common application of neural network is multilayer feed forward neural network model. Among them, back propagation(BP) algorithm is widely used because of its rigorous and high universality. Because the BP learning algorithm is used with gradient descent algorithm, training usually takes a long time to converge, and will inevitably encounter the local minimum problem. Artificial bee colony(ABC) algorithm is a novel simulated evolutionary algorithm. The algorithm was firstly proposed by Turkish scholar Karaboga[1]. ABC was successfully applied to some practical problems, such as unconstrained numerical optimization[2,3], constrained numerical optimization[4,5], digital filter design[6], aircraft attitude control[7], and made a series of good experimental results. Artificial bee colony algorithm and neural network are combined in this paper. The algorithm has the extensive mapping ability of neural network and global convergence and fast heuristic learning characteristics of artificial bee colony algorithm, avoiding the slow convergence speed of neural network and easy to fall into local minimum. This paper uses artificial bee colony algorithm to learn the weights of neural

UF S S potetial R R S S hive EF2 EF1 dance area A dance area B UF EF1 UF

EF1

EF2

unloading nectar A EF1

unloading nectar B EF2 UFEF1


nectar source B

Figure 1. The behaviour of honey bee searching for nectar

(1)Nectar source. Nectar represents the various possible solutions: the nectar value depends on a variety of factors, such as distance between honey and honeycomb, the amount of concentration energy and the difficult level of getting energy. Use the digital quantity "benefit" to measure the nectar source characteristics. (2)Onlooker Bees EF. Onlooker bees are contacted with nectar which is they are working. Bees carry the specific source information. The information includes the distance of nectar source and honeycomb, the direction, the benefit of nectar.

978-1-4673-1773-3/12/$31.00 2013 IEEE

They communicate through swing dance to share information with other bees. Some bees became leading bees according to the path length and nectar amount in certain proportion. (3) Scout bees UF. The Scout bees are searching for nectar source. They can be divided into two kinds: the investigating bees that are searching for the new nectar source near the honeycomb and the following bees that are waiting in the honeycomb, and searching nectar source through sharing the information of onlooker bees. The working diagram of collecting bees is shown in Fig.1. Suppose two honey nectar sources A and B have been found. At the beginning, the worker bees have nothing about information of nectar source. They has two possible choices: (1)Give up nectar and become scout bees(UF), began to search nectar source spontaneously(near in 'S' line) due to an internal incentive or possible external factors. (2)It can be recruited and start searching for nectar(the 'R' line) according to the obtained information after observing the other bees waggle dance. After the scout bee found new nectar source, bees remember the nectar source location rely on their own ability, and quickly began to gather honey, therefore, Scout bees become onlooker bees. Bees spit the flower sweet juice into an empty hives after returning to the hive. These bees have the following options. (1)Give up honey, become scout bee(UF). (2)Return to the same source, swing dance to recruit other partners(EF1). (3)Do not recruit other bees and continue to gather honey(EF2). At the initial time, all bees have no any prior knowledge about nectar sources, whose role is scout bee. After searching to a food source, the scout bees return to dance area of honeycomb. The scout bees can transform into any of the above bee according to benefit of nectar source. Changing principles are as follows: (1) When the acquisition of food sources is relatively low, it can become onlooker bees once again and search near the food source. The result is giving up the last collecting food source. (2) When the income rank of collected food source is less than the critical value(such as ranking in 50%), it can become following bees after watching dance, and go to the corresponding food source for honey. (3) When the income rank of collected food source is higher than a critical value, it becomes leading bee, continues in the same food source for honey, and dances in the district to recruit more employee bees to the corresponding food source. III. TRAINING NEURAL NETWORK USING ARTIFICIAL BEE COLONY ALGORITHM

values I pi . Assume the total number of bees is population size of onlooker bees is Limit is searching number limit.

N s , where

N e , the population size of scout bees is N u , the maximum number of iterations is Tmax ,

The onlooker bees set out to find nectar source. Each bee chooses a value. All bees select a group set of neural network weights. Then, the bees look for food sources, searching cycle number limit is T. The leading bees make a neighborhood search for the corresponding food source and compare the nectar amount between two food sources, then choose food source of higher nectar amount. After all leading bees have finished searching, they back into the dance area and communicate the information of food source to recruit follow bees. The following bees choose the food source according to the obtained information. The more nectar the food source has, the greater probability it is selected. Subsequently, like the onlooker bees, the following bees search neighborhood area and select a better solution. The main steps of artificial bee colony algorithm in this paper are: STEP1: Initialize firstly: randomly generate solutions

Ns

( X 1 ,..., X N s ) , specific random feasible solution


j j j X i j = X min + rand (0,1)( X max X min )

X i is
(1) where

j {1, 2,..., D} are D weights of network and thresholds, calculate the output of network and use the top N e

of solutions as the initial employee bees X(0). STEP2: The bees X i ( n) in step n search for a new location in the current position vector nearby, search formula is

Vi j = X i j + i j ( X i j X kj )
where They are generated randomly, 1,1], and ensure V S .

(2)

j {1, 2,..., D}, k {1, 2,..., N e } and k i, k , j .

i j

is a random number in [-

Most neural network uses gradient descent method for training, such as back propagation algorithm. This algorithm has defects such as the long time to converge, falling into local minimum easily. Artificial bee colony algorithm is a global optimization heuristics algorithm, so it can train the weights of neural network to avoid the deficiency of BP algorithm. The main idea of this algorithm is: assume that the network have D parameters including D1 weights and D2 thresholds. First of all, the neural network parameter is set to D random non-zero

In a certain sense, the search is a stochastic mapping from the individual space to the individual space Tm : S S and the probability distribution is only related to the current position state X i ( n) , but unrelated to the position before the state and time n. STEP3: Select a better fit to retain to the next generation of population between new position vector Vi and X i using the greedy choice operator, Ti : S S . The probability distribution is
2

P {Ts ( X i ,Vi ) = Vi

} = {0, f (V

1, f (Vi ) f ( X i ) i ) < f (Xi )

(3)

The greedy choice operator ensures that the population could retain elite individuals, make the direction of evolution not retreating and distributing. Ts is independent of moment n. STEP4: The following bees select working bees according to bee population fitness values, and search a new location in its neighborhood (like STEP2). The selection operator is to select an individual within populations. The probability is

algorithm parameters are N s =50, N e = N u =25, Limit=100. Neural network parameter PI is random number in [-2 2], Tmax =2000, Limit=100. The colony gets the ideal results after 120 times of learning. Training results shown in Figure 1, where "*" is the ideal output; "+" is output of the neural network after training the network. Real outputs and sample outputs are coinciding basically.
1 0.8 0.6 0.4 0.2 0 -0.2

Prob(Ts1 ( X ) = X i ) =

f (Xi )

-0.4

f (X
m =1

Ne

(4)

-0.6 -0.8 -1

10

11

It means a random mapping Ts1 : S e S . The probability distribution is unrelated to the time n. STEP5: Like STEP2 and STEP3, note the final update after seeding swarm optimal fitness value f_best, and the corresponding parameters ( X 1 ,..., X D ) . STEP6: If the search time Bas reaches a certain threshold Limit and still can't find a better position, then randomly initialize the employee bees position.
j j j Xmin + rand(0,1)( Xmax Xmin ) Basi Limit (5) Xi (n +1) = Basi < Limit Xi (n)

Figure 2. Sample output and desired output of neural network

STEP7: If the bees all converge to a value or the cycle number T >= Tmax, then end the cycle, and output the best fitness and corresponding parameter. Otherwise go to STEP2. IV. COMPUTER SIMULATION RESULTS

B. Inverted Pendulum Control Inverted pendulum is a typical nonlinear, instability object. The research of inverted pendulum can be attributed to multivariable nonlinear unstable system research. Its control methods and ideas are widely used to the general industry. This case learns the weights of the neural network system with artificial bee colony algorithm, and controls the inverted pendulum by a neural network controller. As shown in Figure 3, there is a belt wheel car, its top hinge is a rigid inverted pendulum, the vehicle can move left or right along a straight line which is bounded, while the pendulum can move freely in the vertical plane. At any time, the state of the system is made up of four variables; car position X translational velocity of

 , pendulum deviated from the vertical direction angle trolley X and the oscillating angular velocity .
Inverted pendulum motion equations are as follows:

In order to verify the feasibility of training neural network with artificial bee colony algorithm, and extend this algorithm to practical applications. The authors made the identification of nonlinear systems and the inverted pendulum control experiment. A. Nonlinear System Identification Approximated with artificial bee colony algorithm studying for three layer feed forward neural network for nonlinear x function e sin( 2x) . Input sample interval is [0,1], the step is 0.1, then there are total of 11 pairs of input and output samples. For approach the identification of the nonlinear function, train the neural network with artificial bee colony algorithm. The input and the output layer of neural network have one node, hidden layer have four nodes, hidden layer and output layer excitation function is nonlinear sigmoid function. The network connection weights number D = 13. Artificial bee colony

 =

 2 sin ] ( M + m) g sin cos [ F + ml (4 / 3) ( M + m)l ml cos 2    = F + ml[ sin cos ] X ( M + m)

(6)

(7)

Among them, the car 's quality is M=0.5kgthe quality of inverted pendulum is m=0.2kg the length of pendulum is l=0.6macceleration of gravity is g=9.8m/s2, F is the control force of neural network outputs. Ignore the friction of the trolley and friction of the inverted pendulum. The input layer of neural network controller has four nodes, the output layer has one node, and the hidden layer has five nodes. The four nodes of the input layer receive four state value of the inverted pendulum system respectively; the excitation function of the hidden layer is symmetrical sigmoid function; the excitation function of the output layer is a linear function. The network connection weights are D=31, neural

network parameters PI are random number between -50 and 50, N s =80, N e = N u =40, Tmax =2000, Limit=100.

l u=F

The initialization options of inverted pendulum system are: ] =[-1,-0.2,0,0]. Set sampling period t = 0.02s.  , [ X , , X The simulation results are shown in Figure 4 and Figure 5. In the control process, the inverted pendulum can effectively control the swing of range less than 3 degree, trolley position deviated from the center point less than 0.2m, which meet the control requirements. Table 1 is the comparison of ABC neural network algorithm with general BP algorithm. The data in the table are average results to run 10 times, which is the same as the operating environment. The ABC neural network algorithm and general BP algorithm are compared. The learning time of ABC neural network is much less than general BP algorithms. The running time of this algorithm is about 29% and 36% less than general BP algorithms. The BP neural network trained with ABC avoided the problem of slow convergence. V. CONCLUSION

0
Figure 3. Inverted pendulum

First, learn neural network controller with artificial bee colony algorithm off line through 600 generations of the iteration, get more ideal controller, and then use this controller for inverted pendulum control system. After Inverted pendulum initial states are given by the neural network controller, the neural network controller exerts force F towards the left or towards the right to the car seat, as long as possibly (100s), the car is maintained in the pre-defined trajectory boundaries(1m), and do not let the pendulum put down, that less than a predefined vertical deviation angle range (e.g.,10 degrees ).
3 2

-1

BP neural network is trained by artificial bee colony algorithm is used to control field. Computer simulation realizes the nonlinear identification and control of inverted pendulum problem. From the simulation results, we can see the neural network in this paper has both advantages of artificial bee colony algorithm and neural network. It has extensive mapping ability of neural network, but also significantly improves the calculation efficiency. Artificial bee colony algorithm research has just started, and there are many problems to be solved, but the simulation result shows that the artificial bee colony algorithm has very broad application prospects in neural networks control area. REFERENCES

-2

-3

10

20

30

40

50

60

70

80

90

100

[1] Figure 4. Angle change of inverted pendulum


0.2 0.15 0.1 0.05

[2]

X/m

[3]

-0.05 -0.1 -0.15 -0.2

[4]
10 20 30 40 50 60 70 80 90 100

Figure 5. Position change of inverted pendulum

[5]

TABLE I. Control problem Nonlinear identification Inverted pendulum

THE COMPARISON BETEEN BP ALGORITHMS AND NEURAL NETWORK ALGORITHM BASED ON ABC Algorithm BP ABC neural network BP ABC neural network Learning cycle times 1893 128 7298 578 Running time(s) 83 59 583 372

[6]

[7]

[8]

D. Karaboga, An idea based on honey bee swarm for numerical optimization, Technical Report-Tr06,Erciyes University, Engineering Faculty, Computer Engineering Department 2005. D. Karaboga, B. Basturk, A powerful and Efficient Algorithm for Numerical Function Optimization: Artificial Bee Colony (ABC) Algorithm, Journal of Global Optimization, Volume:39, Issue:3,pp. 459171, November 2007. D. Karaboga, B. Basturk, On The Performance Of Artificial Bee Colony (ABC) Algorithm, Applied Soft Computing,Volume 8, Issue 1, pp. 687-697, January 2008. D. Karaboga, B. Akay, A modified artificial bee colony (ABC) algorithm for constrained optimization problems Applied Soft Computing, Volume 11, Issue 3 , pp. 30213031, April 2011. A. Singh, An artificial bee colony algorithm for the leaf-constrained minimum spanning tree problem, Applied Soft Computing, Volume 9, Issue 2, pp. 625-631, 2009. N. Karaboga, A new design method based on artificial bee colony algorithm for digital IIR filters, Journal of the Franklin Institute, 346 (4), pp. 328-348, 2009. C. Xu, and H. Duan, Artificial bee colony (ABC) optimized edge potential function (EPF) approach to target recognition for low-altitude aircraft, Pattern Recognition Letters, pp. 1759-1772, 2010. Frisch K V. The dance language and orientation of bees. Cambridge: Harvard universit press,1967

You might also like