You are on page 1of 15

SEMINAR PAPER

at the University of Applied Sciences Technikum Wien Game Engineering and Simulation

Scalability of a parallel implementation of ant colony optimization


by Emanuel Plochberger,BSc 3481, Fels am Wagram Supervisor: Dipl.-Ing. Dr. Markus Schordan Vienna, December 14, 2010

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.

2 Ant Colony Optimization


2.1 Swarm intelligence
Swarms in nature often show complex movement and strategic behaviour. A ock of sh coordinates the movement to swim to certain points or to ee. Also bird swarms y together with high speed and nd their way as a swarm. Termites construct, very ecient and fast, large complex hills. Taken the swarm size and the limited communication and planning abilities of single insects or animals into account, these tasks are impressive. 1 The "`collective intelligence"' is generated by the amount of individuals, behaving on simple rules. Emergent and stigmergic behaviour creates the knowledge base of the swarm. As a result complex strategies are possible, which couldn't be made by one agent. The collective acts versatile to dierent activities, is robust to negative impacts and is a self-organizing structure.[4] Motivated by the results in complex problems, the dierent concepts of swarms are observed and studied to be applied in the eld of articial life. Simple life forms are replaced by agents, and the behaviour is adapted to solve optimization problems. To adjust the algorithms to the dierent problems, the problem has to be modeled to be illegible for the agents. Therefor swarm intelligence inspired algorithms have the same advantages like their natural schemes.

2.2 Ant Colony Optimization


The ACO is inspired by real ants on the way from the nest to food sources. Though an individual ant is a simple creature and limited in sense of orientation and communication, an ant swarm will nd a short way to the desired destination. The individuals start blind in an area and search alone for a track to the food source. On the way back to the lair it sets pheromones on the way, these pheromones aect other ants on their search. The trail increases and changes his shape, depending on the number of ants walking on the way. Due to the fact that more ants can walk on a shorter track in the same time, when uniformly distributed, an optimal trail emerges with increasing pheromones. In gure 2.1 this concept of the pheromone trail is shown. In the beginning (a) ants move from lair (A) to the food source (E). After a barricade blocks the direct way (b), the ants are confronted with forks on point B and D. This will force the swarm to split up fty-fty, due that the length of the ways to H and C are now unknown. In the next step (c) more ants reach the target when they pass C, while ants on path H haven't passed the obstacle. This leads that more ants mark C and the probability to go on the shorter path increases.
1

Swarm Intelligence: 2010

Literature Overview,

www2.ece.ohio-state.edu/~passino/swarms.pdf,

17.

November

CHAPTER 2.

ANT COLONY OPTIMIZATION

Figure 2.1: Example of an ant trail [1]

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.

ANT COLONY OPTIMIZATION

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.

ANT COLONY OPTIMIZATION

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)

2.2.4 Path selection

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]).

3.1 Synchronous Parallel Processing Ants


This parallelization strategy was studied by Bullnheimer, Kotsis and Strau [2]. The most simple approach to parallelize the sequential ant algorithm is to process the behaviour of single ants in parallel. Due to the fact, that ants search autonomous and independent, the communication overhead is minimized to the validation point, where the solutions are gathered and compared. At gure 3.1 this strategy is simplied shown.

Figure 3.1: Synchronous parallel processing ants

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.

3.2 Partially Asynchronous Parallel Processing Ants


To reduce communication overhead Bullnheimer, Kotsis and Strau [2] propose partially asynchronous strategy. Every worker holds a set of ants and processes a number of iterations independent of other workers. Partially asynchronous means that the independent calculated trails are synchronized at regular intervals. This strategy is shown at gure 3.2. Due to the reduction of information updates, local iterations might miss good trails calculated by other workers. So the ratio of local iterations to global updates, aects the quality of the solution.

CHAPTER 3.

IMPLEMENTATION

Figure 3.2: Asynchronous parallel processing ants

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.

4.1 Computational Experience


4.1.1 Parameters for ACO

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)

The ratio of speedup to added processors equals the eciency:


ef f iciency = speedup P

(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

Cycles 50 50 100 100

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

Cycles 50 50 100 100

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

Table 4.3: Results of speedup and eciency

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

You might also like