Professional Documents
Culture Documents
at the University of Applied Sciences Technikum Wien Game Engineering and Simulation
Abstract
This paper measures the scalability of an implementation of the ant colony optimization. Therefor the usefulness and functionality of the ant colony optimization algorithm is explained. To parallize the algorithm dierent parallelization strategies are listed. The experiment will implement the ACO for a sequential approach and modies this implementation to be able to run in parallel. The measurements of this experiment is compared and the eciency of the parallel implementation evaluated.
Contents
1 Introduction 2 Ant Colony Optimization 1
2.1 Swarm intelligence . . . . 2.2 Ant Colony Optimization 2.2.1 Agents . . . . . . 2.2.2 Algorithm . . . . 2.2.3 Formulas . . . . . 2.2.4 Path selection . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
2 2 3 4 4 5 6 7
3 Implementation
3.1 Synchronous Parallel Processing Ants . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Partially Asynchronous Parallel Processing Ants . . . . . . . . . . . . . . . . . . 4.1 Computational Experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Parameters for ACO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4 Implementation
9 9 9
5 Conclusion Bibliography
11 12
1 Introduction
In this paper an implementation of Ant Colony Optimization (ACO) is tested for scalability. This paper compares the performance of an standard implementation to an adapted implementation, which is processed parallel on multiple processors. ACO describes an algorithm for solving combinatorial optimization problems inspired by a swarm intelligent based approach. In swarm based algorithms simple agents solve complex problems by the emergent collective intelligence. In this approach the agents (ants) simulate the behaviour of an ant swarm searching food sources. Independent ants merge simple solutions to optimize complex problems, like traveling salesman problem (TSP) [1]. The population based characteristics makes the algorithm adaptable for parallelization. To t the ACO to parallel processing, some key points have to be taken into account: (1) The algorithm steps which can be parallel and executed independent; (2) The information which is needed for every sub processing; (3) The results of the sub processes; (4) Methods to exchange the results, when the sub processes are cunjucted. The eciency of the parallelization and the implementation are dependent on the chosen methods. Authors have studied various parallelization strategies for the ACO algorithm. Some of these strategies are introduced in this paper, synchronous or asynchronous strategies [2], or parallel processed ants [3]. This paper introduces the idea of ACO and the algorithm to nd a path on a map, an overview on strategies to parallelize the ACO algorithm and the key points which have to be considered when implementing the algorithm. One of these parallelization strategy is implemented to solve path planning on a static map. The results of the implementation are compared to a slightly dierent algorithm processed with a single core.
Literature Overview,
www2.ece.ohio-state.edu/~passino/swarms.pdf,
17.
November
CHAPTER 2.
2.2.1 Agents
In ACO agents, later referred to as ants, represent the real ants and search for solutions for the certain problems. These ants are based on natural ants, but adapted to t computational processes.
The main differences to real ants [1]: discrete world memory
Articial ants live in an articial world. The time and the movement of ant are discrete. Agents have memory and are able to store their solution, e.g. paths. The ants are able adjust the power of their trail, so they mark their solution dependent on it's quality. Articial ants can be modied with more abilities than their natural model and are not completely blind.
valuation
capacities
CHAPTER 2.
Behaviour of ants [5] The ant is independent and nds a solution for itself. The ant decides just valid states. After nding a solution it is valuated according to the quality marked.
2.2.2 Algorithm
The ACO is processed in cycles (ant-cycle). Each cycle the best solution is improved and the trails approximate more to the optimum. Goal of the algorithm is to plan a path in a graph. This section deals with the algorithm, the following section shows the needed formulas. 1. Initialization The initialization is at t = 0 and sets the conditions and starting values. All edges are initialized with a starting trail (ij = c), the distance between the nodes is calculated, m ants are set on the starting position, the graph size is n nodes, each ant sets the destination and a maximum number of cycles is dened. 2. Movement Each ant nds a way to the destination. It decides which way to go dependent on the probability of (2.4). In the rst cycle each node has the same probability. This step is repeated until the ant nds the target or the path has exceeded a maximum value. 3. Valuation After all ants have moved, each ant calculates it's path length and sets it's trail on the world map. The strength of the trail (2.3) is dependent on the shortest path found. The strength on each edge ij (t + n) is increased by ij . 4. Cycle When there were less than needed cycles, another cycle is started at 2. Time is set to t = t + n, the ants are reseted to starting condition and ij set to 0. 5. Shortest After the wanted cycles, the shortest path found in this cycle equals an nearly optimal path at the best.
2.2.3 Formulas
The important thing of this algorithm are the formulas and which constants are used. In this section the formulas are explained.
Trail[1]
After a cycle each edge is marked with a trail intensity. The intensity on edge ij , linking node i and j , is calculated with this formula:
ij (t + n) = ij (t) + ij
(2.1)
ij (t) is the trail on edge ij at time t, which is increased by ij . The coecient represents
the evaporation of the trail, preventing unlimited cumulation of the trail intensity.
CHAPTER 2.
ij is the sum of the trail intensity on the edge of all ants (k) from cycle.
k ij = m ij k=1
(2.2)
k Each ant calculates it's intensity ij with an constant Q divided by it's found path length. When k no path was found, ij = 0. k ij =
Q or 0 Lk
(2.3)
To nd a path, an ant moves from node to node, until the current node equals the destination. Which node to move next, depends on the probability of the edge heuristic ij and the trail intensity ij . Due to the tradeo of trail versus heuristic, ants explore shorter paths and and rene the the search. The ratio between trail and heuristic is determined by the parameters and .
pk (t) = ij [ij (t)] [ij ] k [ik (t)] [ik ]
(2.4)
3 Implementation
Based on autonomous behaviour of agents, swarm algorithms are inherently highly parallelizable. Which parallelization strategy is applied most ecient, depends on the computing platform and objective.[6] This paper focuses on two parallelization strategies for the ACO. The parallelization strategies described in this paper were studied by Bullnheimer, Kotsis and Strau [2], Randall [3] and Stzle [6]. These strategies were implemented and tested to solve the Traveling Salesman Problem (TSP,[7]).
CHAPTER 3.
IMPLEMENTATION
Without the communication overhead, the speedup of synchronous parallel processing ants would reach an optimum. Assuming that the system size (N ) is unlimited Bullnheimer, Kotsis and Strau [2] calculate the speedup for solving a TSP:
Sasymptotic (m) = Tseq (m) O(m3 ) = = O(m) Tpar (m, ) O(m2 )
(3.1)
Tseq (m) = O(m3 ) The complexity of the sequential algorithm for problem size (swarm size, number of ants) m Tpar (m, ) = O(m2 ) The complexity of the parallel algorithm for size m and unlimited
system size
Considering the fact that the number of processing elements is much smaller than the typical swarm size, one processing element (worker) would execute a set of ants. Due to the calculation and distribution of the new trails after each ant cycle, the overhead slows down the performance and impairs the parallelization benets. According to Bullnheimer, Kotsis and Strau [2] the speedup is (also considering limited system size):
S(m, N ) = O(m3 ) O(m3 /N ) + Tovh (m, N )
(3.2)
Tovh (m, N ) The overhead on the communication is dependent on the architecture of the
system.
CHAPTER 3.
IMPLEMENTATION
4 Implementation
To measure the scalability of a parallel implementation of the ACO, the performance of path planning executed in a single process is compared to the performance of path planning with multiple processors. As a parallelization strategy Synchronous Parallel Processing Ants (described in section 3.1) is implemented. As a parallelization framework OpenMP is used. The author assumes that OpenMP distributes the ants uniformly to the processors.
To compare the dierent ACO implementations most of the parameters have to be equal. The quality of the solution and execution time to handle the cycles, depend on these parameters. The exact purpose of the parameters is shown in chapter 2 Ant Colony Optimization.
= 0.75 (each cycle 25% of the trails are vaporized) = 0.70 = 0.25 trail:heuristic ratio = 3:1 map size = 30 x 30
4.1.2 Results
To compare results, the starting point and the end point of the search never changed. Each experimental series was executed 5 times and the average results compared. According to Randall [3], the most common way to measure the eectiveness of a parallel algorithm the speedup has to be calculated. In his paper he calculates it by the formula:
speedup = time_to_solve_the_problem_with_a_single_processor time_to_solve_the_problem_with_P _processors
(4.1)
(4.2)
The results of the experiments run with a single core are shown in table 4.1. The time is measured in seconds, and the solution quality is the lengh of the calculated path. In table 4.2 the performance results run with 4 processors are listet. The speedup and eciency is described int table 4.3.
CHAPTER 4.
IMPLEMENTATION
Swarm Size Average Execution Time (s) Average Solution Quality Single Core 50 92.13 89.27 100 183.53 90.01 50 186.99 91.25 100 367.12 89.01 Table 4.1: Results on a sequential algorithm
Swarm Size Average Execution Time (s) Average Solution Quality Single Core 50 55.56 87.92 100 107.68 91.18 50 115.62 92.84 100 226.14 91.09 Table 4.2: Results of a parallel algorithm, with 4 processors Cycles 50 50 100 100 Swarm Size Speedup Eciency 50 1.66 0.41 100 1.70 0.43 50 1.62 0.40 100 1.62 0.40
10
5 Conclusion
The solution quality of an ACO is highly dependend on the cycles and swarm size. By ecient parallel processing units, more cycles and larger swarm, scan the search space in the same time, so the solution quality can be improved. Due to the natural parallelization of population based algorithms, the implementation of a parallel processing ACO is simple. The results of the measurements show, that the parallelization overhead is very high in the Synchronous Parallel Processing Ants Algorithm. The dierent parallel strategies which can be applied to the ACO, will probably improve the eciency of parallelization of the algorithm.
11
Bibliography
[1] V. M. u. A. C. M. Dorigo, The Ant System: Optimization by a colony of cooperating agents. Berlin, Germany: Springer-Verlag Berlin Heidelberg, 1996. [2] G. K. u. C. S. B. Bullnheimergo, Parallelization Strategies Germany: Springer-Verlag Berlin Heidelberg, 1998.
for the Ant System.
Berlin,
[3] A. L. M. Randall, A parallel implementation of ant colony optimizationg. Orlando, FL, USA: Academic Press, Inc., 2002. [4] L. Pintscher, Schwarmintelligenz. Karlsruhe, Germany: Universitt Karlsruhe, 2008. [5] G. C. u. L. G. M. Dorigo, Ant Algorithms for Discrete Optimization. Brussels, Belgium: MIT Press, 1996. [6] T. Stzle, Parallelization Strategies for Ant Colony Optimization. Springer-Verlag, 1998. [7] V. C. W. C. D. Applegate, R. Bixby, The traveling salesman problem. Princeton, NJ: Princeton University Press, 2006.
12