7th IEEE International Conference Humanoid, Nanotechnology, Information Technology Communication and Control, Environment and Management (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Section 12-16 November 2013 Hotel Centro, Puerto Princesa, Palawan, Philippines
A Genetic Algorithm Approach to Swarm Centroid Tracking in Quadrotor Unmanned Aerial Vehicles Reiichiro Christian S. Nakano, Argel Bandala, Gerard Ely Faelden, Jose Martin Maningo, Elmer P. Dadios Electronics and Communications Engineering Department, Manufacturing Engineering and Management Engineering Department De La Salle University, Manila, Philippines
[email protected],
[email protected] Abstract—One of the trademark behaviors of a swarm is aggregation. Aggregation is the ability to gather swarm members around a specific point in space. The goal is to keep an object, stationary or moving, at the center of the swarm. This paper presents a novel approach to centroid tracking in robotic swarms. Genetic algorithm is used in quadrotor unmanned aerial vehicles to keep the object being tracked at the center while minimizing two parameters: the distance travelled by each quadrotor and the distance of each quadrotor from the object. Centroid tracking was found to have an average error of 0.0623568 units for swarm populations ranging from 10 to 100 with the lower swarm populations exhibiting lower errors. Convergence did not exceed the maximum of 23 milliseconds for populations less than 30. These results show that the algorithm is well-suited for implementation in swarms with lower numbers of quadrotors.
being proposed. The second part will discuss in detail each component of the genetic algorithm. The third part will show the results of the experiments performed with the algorithm. Finally, the last part will provide a conclusion and discussion of the results. II. GENETIC ALGORITHM Genetic algorithms are search algorithms based on the concept of evolution in nature and survival of the fittest. Instead of blindly throwing out coordinates, the algorithm will select the best solutions in an initially random population and continuously “breed” them together for the purpose of improving each solution. This method of solving the problem will add some direction to the search and will at some point reach convergence to a plausible solution [13] [14].
Index Terms—Swarm, quadrotor, genetic algorithm, centroid, tracking, aggregation
Start
I. INTRODUCTION A common sight in nature is that of moths hovering around a particular light source or bees protecting their hive by attacking and swarming around potential threats. In both cases, the goal of the swarm is to keep an object, stationary or moving, in its center. This behavior is imitated in swarming robots using swarm algorithms [1] [2]. Swarm behavior is defined as the collective behavior of a group of individuals of the same species that tend to aggregate together and accomplish a common goal [3] [4] [1]. Aggregation is the tendency of the swarm to converge at a particular point in space. This behavior is one of the most basic swarm behaviors and is commonly found in nature such as in bacteria and flocks of birds [5] [6]. Swarming algorithms are important in that there is no leader and each member moves independently based on its goal and the relative position of other members of the swarm. [7] In this paper, the simulated swarm will aggregate and keep a particular point in its center. Each member will move around and adjust their position accordingly with the location of a moving or stationary centroid. Swarm algorithms for aggregation have been proposed before, using techniques such as fuzzy sliding mode control, [8] [9] and local interaction with actuator saturation [10] [11] [12]. Swarming algorithms for different behaviors are also discussed in detail for quadrotor unmanned aerial vehicles [6]. To solve this problem, genetic algorithm was used to find the next position of the quadrotors. The complete discussion of the system is arranged as follows: the first part will give a brief overview of genetic algorithm and a flowchart of the system
978-1-4799-4020-2/14/$31.00 ©2014 IEEE
Initialize random population of N solutions to the problems/coordinates
Randomly match parents to produce N children.
Use fitness function to choose top N best chromosomes from a total of 2N parents and children
Delete/kill off N least fit chromosomes.
Introduce mutation
No
Check whether an acceptable solution been found Yes
End
Figure 1. Genetic Algorithm Flowchart
Figure 1 shows the flowchart of the genetic algorithm used in this paper. There is an initial population of solutions that serve as the first generation in the algorithm. Each solution is a set of coordinate points that represent the next position of all
7th IEEE International Conference Humanoid, Nanotechnology, Information Technology Communication and Control, Environment and Management (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Section 12-16 November 2013 Hotel Centro, Puerto Princesa, Palawan, Philippines
the quadrotors being simulated. The details of the genetic algorithm are discussed in detail in Chapter 3. III. ARCHITECTURE OF THE SYSTEM The algorithm takes as input the initial positions of the quadrotors and outputs their next positions. The algorithm is designed to be used in practice with accurate positional sensors as the source of the initial position of the quadrotors. After this, the algorithm will run and the final position of the quadrotors will be output. The size of the swarm to be used for simulation is scalable from 10 to 100. In a Cartesian coordinate system, each quadrotor is assigned a point as its location. Each quadrotor is allowed limited proximity with one another to avoid collisions. The input parameters are the initial coordinates of each quadrotor and the coordinates of the centroid to be followed by the swarm. The program outputs the next coordinates of each quadrotor. A. Chromosome The problem being tackled by the genetic algorithm is the determination of the future coordinates of each of the n quadrotors being simulated. It follows that a single solution to the problem will consist of n Cartesian points, where the points represent the future position of all the quadrotors being simulated. Due to the nature of the problem, one chromosome must consist of n groups of three floating point numbers, where n is the number of quadrotors being simulated. The three floating point numbers represent the x, y, and z coordinates of the future position of each quadrotor.
Figure 2. 2-dimensional visualization of a chromosome
Figure 2 shows a visual representation of a chromosome for ten quadrotors. Each blue dot on the graph represents a quadrotor. For the sake of discussion, the chromosome is shown here only from the top view. The quadrotors must not be too close to each other in order to avoid collisions. Therefore, a quadrotor’s position should not be less than a specified distance from another quadrotor. In this paper, the clearance is arbitrarily chosen to be one unit. Based on this condition, the quadrotors generated will maintain a one unit distance from each other.
B. Reproduction Given two parents, A and B, two children, child A and child B, were generated. First, each child was made an exact replica of either parent A or B. Child A was made by entirely copying chromosome A while child B was made by entirely copying chromosome B. After this, the algorithm used an averaging function to “merge” a few of the quadrotors from each parent and pass this down to the child.
Parent A
Child A
Parent B
Child B Figure 3. Reproduction with n=10
Figure 3 shows an example of offspring generation with 10 quadrotors. In Parent A and Parent B, one of the quadrotors is highlighted red while in the Child A and Child B, the same quadrotor is highlighted green. In addition, child A and child B both show two unfilled circles that represent the original positions of the quadrotor in parents A and B. It can be seen that child A is an exact duplicate of parent A except for the position of new quadrotor. The new position of the quadrotors is at the midpoint the location of the same quadrotor in both parents. On the other hand, child B is an exact duplicate of parent B except for the position of the green quadrotor, which is determined in the same way as in child A. It must be noted that every child is also tested for the requirement that any individual quadrotor must be more than one unit away from every other quadrotor in the swarm. Any child not fulfilling this requirement is discarded. C. Fitness Function In order to find the best solution out of each of the numerous solutions that will be generated in the running of the algorithm, a fitness function is needed to quantify the effectiveness of each chromosome in solving the problem at hand. In this paper, a chromosome is judged based on the distance of its centroid from the coordinates of the object being tracked, the average of the distances travelled by each quadrotor, and the average of the distances of each quadrotor from the centroid.
7th IEEE International Conference Humanoid, Nanotechnology, Information Technology Communication and Control, Environment and Management (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Section 12-16 November 2013 Hotel Centro, Puerto Princesa, Palawan, Philippines
The distance of the centroid of the new swarm position from the coordinates of the object being tracked can be calculated as follows. First, consider (X, Y, Z) to be the Cartesian coordinates of the new centroid of the swarm. Then: ݀ ൌ ඥሺܺ െ ݔ ሻଶ ሺܻ െ ݕ ሻଶ ሺܼ െ ݖ ሻଶ
(1)
Where x0, y0, and z0 are the x-coordinate, y-coordinate, and z-coordinate of the object being tracked and d is the distance of the new centroid of the swarm from the location of the object being tracked. The average distance to be travelled by each quadrotor can then be calculated in the same way by using the initial and final positions of each quadrotor. The symbol Δ is assigned to the average value of the distances travelled by each quadrotor. The average distance of each quadrotor from the object being tracked can be calculated in a similar manner using the final positions of each quadrotor and the coordinates of the object being tracked. δ is then found as the average of the distances of each quadrotor from the object being tracked. A fitness function F can then be defined as F = αd + βΔ + χδ,
the algorithm from converging too fast to a less than optimal solution.
(2)
Where α, β and χ are weighting constants assigned to d, Δ, and δ to adjust the algorithm’s tendency for finding chromosomes with more accurate centroid tracking, less distance traveled by each quadrotor, or a more tightly packed swarm of quadrotors. In the analysis of data in the next chapter, α was set to 15, while β and χ were left as unity. This arrangement was found to perform and converge well in practice and is thus fixed in the genetic algorithm presented in the paper. It is straightforward to show that in this algorithm, the lower the value of the fitness function of a particular chromosome, the better it performs as a solution to the problem. D. Selection After the children have been generated, the genetic algorithm will select the best chromosomes from the pool of parents and children and kill off the rejected chromosomes in order to keep the population at the same number as it was before. The population number used in the genetic algorithm presented in this paper is fifty chromosomes. In order to preserve the best chromosomes in the population, the top fifty chromosomes in the group of parents and children with the lowest fitness function values were automatically placed in the population for the next generation, after which the remaining chromosomes are discarded. This simple method of selection was chosen because of its fast execution time requiring only a bubble-sort algorithm. E. Mutation It has been discussed that mutation is required in order to keep the gene pool fresh and prevent potentially useful genes from disappearing from the population. In the genetic algorithm shown in this paper, mutation was required to keep
Figure 4. Chromosome undergone mutation
Figure 4 shows a chromosome that has gone through mutation. The red dot represents the quadrotor that was chosen randomly to go through mutation while the circle represents the old position of the same quadrotor before mutation. It can be seen that the y-coordinate of this quadrotor in the chromosome was changed from 3.55 to -3. The value to which it is changed is completely random. At first glance, the change introduced by the mutation process might not seem very significant. However, due to the infinite search space of this particular problem and the limited number of chromosomes in the population, it was found that constantly adding new genetic material from the search space and into the current gene pool was crucial to prevent the algorithm from converging too quickly into a less than optimal local maximum. Special care is taken to prevent the fittest chromosome in the population from being mutated. IV. EXPERIMENT RESULTS Several parameters relating to the genetic algorithm are tested here in order to assess the program’s effectiveness. A. Centroid Tracking To quantify the centroid tracking performance, trials were conducted to test the average error of the algorithm. One trial consisted of one hundred separate runs of the algorithm for a given number of quadrotors and the error for each run was calculated as the distance of the centroid of the result of the genetic algorithm from the location of the object being tracked. More trials were then conducted for different numbers of quadrotors. For every trial, the number of generations the genetic algorithm ran was 30. Table 1. Centroid Tracking Results (α=15, β=1, χ=1)
Number of Quadrotors 10 20 30 40 50 60 70 80 90 100
Average Error of 100 Runs of the Genetic Algorithm (Units) 0.026173 0.041306 0.055336 0.054169 0.062468 0.067190 0.082854 0.078457 0.074995 0.080620
7th IEEE International Conference Humanoid, Nanotechnology, Information Technology Communication and Control, Environment and Management (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Section 12-16 November 2013 Hotel Centro, Puerto Princesa, Palawan, Philippines
Table 1 shows the results of the trials conducted to test the accuracy of the centroid tracking of the genetic algorithm. It can be seen that for larger values of quadrotors, the average error grows bigger. However, the average error for a swarm of 100 quadrotors still remains below 0.1 units. The graphical representation of this is shown in Figure 5.
Where F is the normalized fitness function value and x is the number of generations. C. Program Runtime The runtime of the program is dependent mainly on two changeable parameters: the number of quadrotors being simulated and the number of generations to be run. The effect of each parameter was explored and analyzed below. Table 2. Program Runtime Results (30 Generations)
Number of Quadrotors 10 20 30 40 50 60 70 80 90 100
Figure 5. Centroid Tracking Accuracy
B. Effect of Number of Generations The number of generations that the algorithm takes before converging to a solution was also tested. An experiment was set to run the program for a thousand generations and record the normalized fitness function value at the end of each generation.
Runtime (milliseconds) 5 12 23 38 53 76 102 126 162 197
The runtime of the genetic algorithm was recorded starting from the generation of the initial population to the determination of the best-fitness chromosome in the last generation. The results were then tabulated in Table 2.
Figure 7. Number of Quadrotors Runtime Test Result
Figure 7 is a visual representation of the values listed in Table 2. At first glance, it is clear that the graph is not really linear. A good-fit equation for the graph is
Figure 6. Convergence test
Figure 6 shows the result of the experiment using a simulation setup of one hundred quadrotors. The fitness function value for each generation is normalized with respect to the value of the fitness function at the last generation. This value is then considered to be the best possible result of the fitness function with a normalized value of 1. It is obvious that one can get higher values when the algorithm is run for more generations but the trend of the graph and the impracticality of running the algorithm for more generations in a real-time application make it reasonable to assume that the solution found in generation 1000 is already the optimal solution that can be found by the program. A best-fit curve for the graph of the normalized fitness function value to the number of generations was generated. This is also shown in Figure 6 as the red line. The equation is: F = −0.929x-0.3028 + 1.11
(3)
T = 0.0271x1.926 + 3.446
(4)
Where T is the program runtime in milliseconds and x is the number of quadrotors being simulated. Table 3. Program Runtime Results (30 Quadrotors)
Number of Generations 20 40 60 80 100 120 140 160 180 200
Runtime (milliseconds) 15 27 45 62 74 90 101 116 138 151
7th IEEE International Conference Humanoid, Nanotechnology, Information Technology Communication and Control, Environment and Management (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Section 12-16 November 2013 Hotel Centro, Puerto Princesa, Palawan, Philippines
The same method was applied to determine how the runtime of the program varies with the number of generations of the program.
Figure 9 is the result of the simulation of 30 quadrotors following a centroid of (30, 30, 30). The centroid of the coordinates calculated by the genetic algorithm was (30.007107, 29.951099, 30.014622). The number of generations was set to thirty. The runtime of the algorithm was recorded at 24 ms.
Figure 8. Number of Generations Runtime Test Result
Table 3 and Figure 8 show the effect that the number of generations has on the runtime of the program. One can observe that the resulting graph is almost linear. This result is expected because the time it takes the algorithm to run through a single generation does not vary from generation to generation. Therefore, every additional generation executed by the program will increase the runtime by the same amount. The best-fit line is given by: T = 0.7542x – 1.067
Figure 10. Simulation Example
Figure 10 is the result of the simulation of 100 quadrotors following a centroid of (0, 0, 0). The centroid of the coordinates calculated by the genetic algorithm was (0.001812, 0.035475, -0.058425). The number of generations was set to thirty. The runtime of the algorithm was recorded at 204 ms.
(5)
Where T is the program runtime and x is the number of generations run by the program. D. Graphs of Results This paper will be incomplete without at least a few examples of the results plotted and visually represented in a three-dimensional coordinate system. The following figures show both the initial positions of the quadrotors and the final positions of the quadrotors that have been calculated by the genetic algorithm. The initial positions are represented by the green rings while the final positions are represented by the blue filled circles.
Figure 11. Simulation Example
Figure 11 is the result of the simulation of 100 quadrotors following a centroid of (0, 0, 0). The centroid of the coordinates calculated by the genetic algorithm was (0.001159, -0.000826, -0.001263). The number of generations was set to 100. The runtime of the algorithm was recorded at 656 ms. Figure 13 and Figure 14 were given the same set of initial coordinates and centroid but given a different number of generations. The difference in the result is noticeable but not very drastic. This supports the data gathered in the convergence test and the curve of the normalized fitness function value plotted with respect to the number of generations. Figure 9. Simulation Example
7th IEEE International Conference Humanoid, Nanotechnology, Information Technology Communication and Control, Environment and Management (HNICEM) The Institute of Electrical and Electronics Engineers Inc. (IEEE) – Philippine Section 12-16 November 2013 Hotel Centro, Puerto Princesa, Palawan, Philippines
Figure 12. Simulation Example
Figure 12 is the result of the simulation of 50 quadrotors following a centroid of (-20, -20, -20). The centroid of the coordinates calculated by the genetic algorithm was (19.929068, -20.005068, -19.896784). The number of generations was set to 30. The runtime of the algorithm was recorded at 55 ms.
swarming algorithms when the high cost of making numerous robots is a major consideration in the application. The convergence test revealed that the algorithm approached an upper limit as the number of generations increased. It also showed that for most purposes, the algorithm does not need to be run for more than thirty generations to obtain an acceptable result. In fact, the normalized fitness function value reaches 67.1 percent of its maximum after only 12 generations. After 30 generations, this value is already at 81.17 percent of its maximum. Knowledge of this trend, together with the linearity of the runtime with the number of generations, will allow one to set the appropriate number of generations according to the application requirements. For future works, the possibility of using genetic algorithm may be explored for other swarming behaviors such as foraging and flight formation. Also, additional rules may be added to the fitness function to model real-life situations better, such as the avoidance of certain ranges of coordinates when there are obstacles in the way. REFERENCES
V. CONCLUSION This paper presented the possibility of using a genetic algorithm as a swarming behaviour algorithm, particularly as an aggregation and centroid tracking algorithm. The effectiveness of program was evaluated using two main parameters: the accuracy of centroid tracking and the effective runtime of the program. The centroid tracking accuracy test yielded an average error of 0.0623568 units in tracking the object the algorithm was assigned to follow. This was tested from ten to one hundred quadrotors. It must be noted, however, that this result was obtained with the weighting constant α equal to 15. Recall that the fitness function of the genetic algorithm had weighting constants that affect the tendencies of the program to favor accurate centroid tracking, minimum travelled distance, or swarm aggregation over one another. The genetic algorithm will provide more accuracy in centroid tracking if α is made larger. However, one must be aware of the reduction in optimization for the other two parameters being considered. The designer must choose the correct balance of the weighting constants depending on the application and the task being performed by the quadrotors. The test also showed that the average error increased as the number of quadrotors was increase. The runtime test showed that the relationship between the runtime and the number of generations was linear while the relationship between the runtime and number of quadrotors was a power function with exponent 1.926. For ten quadrotors and thirty generations, the average runtime was 5 ms while for one hundred quadrotors and thirty generations, the runtime rose to 197 ms. The results of the runtime test and the centroid tracking accuracy test suggest that the algorithm is best suited for swarms with smaller number of members. This is in sharp contrast with other swarming algorithms whose performance increases as the number of members in the swarm increases [8]. This gives the genetic algorithm an edge over other
[1]
G. Beni, "From Swarm Intelligence to Swarm Robotics," in Swarm Robotics, Springer, 2004, pp. 1-9.
[2]
T. Balch, "Communication, Diversity and Learning: Cornerstones of Swarm Behavior," in Swarm Robotics, Springer, 2004, pp. 21-30.
[3]
L. Wang, H. Shi, T. Chu, W. Zhang and L. Zhang, "Aggregation of Foraging Swarms," in AI 2004: Advances in Artificial intelligence, Springer, 2005, pp. 766-777.
[4] T. Schmickl, C. Moslinger and K. Crailsheim, "Collective Perception in a Robot Swarm," in Swarm Robotics, Springer, 2007, pp. 144-157. [5]
E. Sahin, "Swarm Robotics: From Sources of Inspiration to Domains of Application," in Swarm Robotics, Springer, 2004, pp. 10-19.
[6] A. A. Bandala, R. R. P. Vicerra and E. P. Dadios, "Swarming Algorithm for Unmanned Aerial Vehicle Quadrotors," Journal of Advanced Computational Intelligence and Informatics, vol. 8, no. 5, 2014. [7] V. Gazi and K. Passino, "A Class of Attraction/Repulsion Functions for Stable Swarm Aggregations," IEEE Conference on Decision and Control, 2002. [8]
V. Gazi, "Swarm Aggregations Using Artificial Potentials and Sliding Mode Control," IEEE Conference on Decision and Control, 2003.
[9] R. R. Nair and L. Behera, "Swarm Aggregation using Artificial Potential Field and Fuzzy Sliding Mode," American Control Conference, 2012. [10] A. Gasparri, G. Oriolo, A. Priolo and G. Ulivi, "A Swarm Aggregation Algorithm based on Local Interaction for Multi-Robot Systems with Actuator Saturations," IEEE/RSJ International Conference on Intelligent Robots and Systems, 2012. [11] A. Gasparri, A. Priolo and G. Ulivi, "A swarm aggregation algorithm for multi-robot systems based on local interaction," IEEE International Conference on Control Applications, 2012. [12]
A. Leccese, A. Gasparri, A. Priolo, G. Oriolo and G. Ulivi, "A Swarm Aggregation Algorithm based on Local Interaction with Actuator Saturations and Integrated Obstacle Avoidance," IEEE International Conference on Robotics and Automation, 2013.
[13]
M. A. Ferreira and H. K. Lee, Multiscale Modeling: A Bayesian Perspective, Springer, 2007.
[14]
M. Cepin, Assessment of Power System Reliability: Methods and Applications, Springer, 2011.