Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Page 1
Assessing the scalability of the Angular
Modulated PSO Algorithm against it’s
older brother the Binary PSO Algorithm
By Stuart Reid
10026942
Department of Computer Science
Faculty of Engineering, Built Environment and Information Technology
University of Pretoria
09 March 2013
Page 2
1. Introduction1.1 Problem Statement1.4 Problems and Applications1.5 Overview of approach
2. Background2.1 Relevant reading2.2 Discussion of the Binary PSO algorithm2.3 Discussion of the AMPSO algorithm
3. Implementation3.1 CiLib Algorithms
3.1.1 CiLib AMPSO algorithm XML representation3.1.2 CiLib Binary PSO algorithm XML representation
3.2 CiLib Problems3.2.1 Unimodal and Multimodal continuous valued problems3.2.2 The Nqueens problem3.2.3 The Knight’s Tour Problem3.2.4 Bit strings matching Problem
3.3. CiLib Simulations3.3.1 Spherical Unimodal Problem3.3.2 Schwefel Unimodal Problem3.3.3 Rosenbrock Multimodal Problem3.3.4 Ackley Multimodal Problem3.3.5 Knight's Tour Problem3.3.6 Random bit string matching problem
4. Research results4.1 Unimodal and Multimodal continuous valued problem results
4.1.1 Average fitnesses achieved4.1.2 Average algorithm deterioration4.1.3 Discussion of results
4.2 Knight's Tour Problem4.2.1 Average fitnesses achieved4.2.2 Average algorithm deterioration4.2.3 Performance for dimension = 54.2.4 Performance for dimension = 64.2.5 Performance for dimension = 84.2.5 Performance for dimension = 94.2.5 Performance for dimension = 114.2.5 Performance for dimension = 124.2.5 Performance for dimension = 144.2.5 Performance for dimension = 154.2.6 Discussion of results
Page 3
4.3 Random Bit String Matching4.3.1 Performance for bit string length = 1004.3.2 Performance for bit string length = 2004.3.3 Performance for bit string length = 3004.3.4 Performance for bit string length = 4004.3.5 Performance for bit string length = 5004.3.6 Discussion of results
5. Conclusions
Page 4
1. Introduction
1.1 Problem Statement
CIRG, the Computational Intelligence Research Group, has developed the Angle
Modulated Particle Swarm Optimizer Algorithm, hereafter referred to as the AMPSO
algorithm. The AMPSO algorithm is used to solve binary optimization problems
within a continuousvalued search space.
However, a comparative analysis of the scalability of the AMPSO algorithm against
the Binary PSO algorithm has yet to be performed. In this report we compare the
scalability of the AMPSO algorithm against the slightly older Binary PSO algorithm.
1.4 Problems and Applications
Many real world optimization problems have binary valued solutions or can be
formulated such that solutions can be represented using binaryvalued
representations. For such problems, traditional PSO algorithms that operate in
continuous space are ineffective. Therefore, the development of a new breed of PSO
algorithms capable of solving these types of problems is very valuable. A
comparative study of the performance of Binary PSO algorithm against the newer
Angular Modulated PSO algorithm could help researchers better identify which
optimization algorithm better suits their particular needs.
1.5 Overview of approach
For this study the Computational Intelligence Library (CiLib) was used to run
simulations and gather data on the performance of our selected algorithms on a
number of benchmark problems. Initially the benchmark problems being used to
compare the performance of the Binary PSO algorithm against that of the Angular
Modulated PSO algorithm were:
Page 5
1. A few unimodal and multimodal continuousvalued functions of varying
dimensions with a fixed number of bits to encode each dimension.
2. The Nqueens problem for varying values of N and
3. A bit string matching problem to test how accurately the algorithms could match
randomly generated bit strings for varying bit string lengths.
However, during the study it was identified that there were a number of issues with
the specific implementation of the NQueens function in CiLib. More specifically, the
board is increasingly likely to be incorrectly initialized for increasing values of N. As a
substitute for the NQueens problem this study tested the scalability of the two
algorithms on the Knight’s Tour Problem .1
1 Note: The discrete dimensions of the knight's tour problem is greater than that of the Nqueensproblem, making it an acceptable benchmark to test the scalability of the algorithms against.
Page 6
2. Background
2.1 Relevant reading
The greater majority of our understanding of both the binary PSO algorithm and the AMPSO algorithms has come from combined works of Professor Engelbrecht and his Computational Intelligence Research Group (CIRG). It is highly recommended that any reader of this report obtain a copy of his book, Computational Intelligence An Introduction 2nd Edition.
1. A. Engelbrecht. Computational Intelligence an introduction 2nd Edition, pages 340341.
John Wiley & Sons Ltd, 2007.
2. J. Kennedy and R.C. Eberhart. A Discrete Binary Version of the Particle Swarm
Algorithm. In Proceedings of the World Multiconference on Systemics, Cybernetics and
Informatics, pages 4104–4109, 1997.
3. J. Kennedy, R.C. Eberhart, and Y. Shi. Swarm Intelligence. Morgan Kaufmann, 2001.
4. G. Pampara, N. Franken, A.P. Engelbrecht, Combining Particle Swarm Optimization with
angle modulation to solve binary problems, 2012
2.2 Discussion of the Binary PSO algorithm
The Binary PSO is the result of an attempt by Kennedy and Eberhart to adapt the
traditional PSO algorithm to work in a discrete search space . The general approach 2
for doing this is taking a binary valued optimization problem and ‘mapping’ it to a
continuous valued search space. Then searching for the optimum in the continuous
space the finally ‘demapping’ that value back to the original binary search space.
Binary PSO achieves this by flipping the bits (0 or 1) of a particle position vector.
2.3 Discussion of the AMPSO algorithm
The angular modulated PSO algorithm is a new algorithm proposed by the
Computational Intelligence Research Group at the University of Pretoria’s Computer
Science department. The AMPSO algorithm makes use of an engineering technique
called angular modulation to map discrete binary problems onto a continuous search
space and back again. Angular modulation is used to modulate and demodulate
signals by adapting the angle of a sinusoidal carrier wave to transmit data.
2 The original PSO algorithm was originally developed only to search in a continuous valued search space.
Page 7
3. Implementation
3.1 CiLib Algorithms
CiLib, the Computational Intelligence Library, consists of two primary libraries: the
CiLib source library and the CiLib simulation library. The source library contains
coded implementations of a number of computational intelligence constructs,
algorithms and other relevant features. The simulation library is an XML framework
that provides a ‘frontendinterface’ to the CiLib source library. New algorithms and
simulations can be created and tested using the CiLib simulation library. New
algorithms can be created in between the <algorithms> tags of the CiLib simulation
XML framework. The following tags should at least be specified:
<addStoppingCondition>, <initialisationStrategy>, <entityNumber>, <entityType>,
<velocityProvider>, <inertiaWeight>, <positionProvider> and <topology>
3.1.1 CiLib AMPSO algorithm XML representation
An XML representation of the Angular Modulated PSO algorithm is included below.
Page 8
3.1.2 CiLib Binary PSO algorithm XML representation
An XML representation of the Binary PSO algorithm is included below.
3.2 CiLib Problems
Specific problems that your algorithms must solve can also be defined in CiLib’s
XML framework. In this study we implemented the following problems:
1. Unimodal and Multimodal continuous valued problems for the following
dimensions: 1, 10, 20, 30, 40, 50 and 100
a. The CiLib spherical unimodal problem
Page 9
b. The Schwefel unimodal problem
c. The Rosenbrock multimodal problem and
d. The Ackley multimodal problem
2. The NQueens problem for N={5,8,11,14,17,20,23}, where N^2 is the board size
and N^2 is the dimension.
3. The Knight's Tour Problem for N={5,6,8,9,11,12,14,15}, where N^2 is the board
size and N^2*3 is the dimension.
4. A bit string matching problem to test how accurately the algorithms could match
randomly generated bit strings for the following bitstring lengths: 100, 200, 300,
400, 500, 750 and 1000.
Each problem is implemented in CiLib for both the binary PSO algorithm and the
AMPSO algorithm. For the AMPSO algorithm the usage of continuous function
decorator, Angle Modulation, enable a standard PSO with a binary position provider
to become an AMPSO algorithm.
Page 10
3.2.1 Unimodal and Multimodal continuous valued problems
A representation of the CiLib spherical unimodal problem for the binary PSO
algorithm is included below
A representation of the CiLib spherical unimodal problem for the AMPSO algorithm is
included below
A representation of the Schwefel unimodal problem for the binary PSO algorithm is
included below
A representation of the Schwefel unimodal problem for the AMPSO algorithm is
included below
Page 11
A representation of the Rosenbrock multimodal problem for the binary PSO
algorithm is included below
A representation of the Rosenbrock multimodal problem for the AMPSO algorithm is
included below
A representation of the Ackley multimodal problem for the binary PSO algorithm is
included below
A representation of the Ackley multimodal problem for the AMPSO algorithm is
included below
Page 12
3.2.2 The N-queens problemA representation of the NQueens problem in CiLib for the AMPSO algorithm is
included below
A representation of the NQueens problem in CiLib for the binary PSO algorithm is
included below
3.2.3 The Knight’s Tour Problem
For the Knight’s tour problem, the objective is to maximize the number of squares on
the board visited. This has been specified in the objective in the problem XML (default
is to minimize). A representation of the Knight’s Tour problem in CiLib for the binary
PSO algorithm is included below
A representation of the Knight’s Tour problem in CiLib for the AMPSO algorithm is
included below
Page 13
3.2.4 Bit strings matching Problem
For the bit strings matching problem this study generated 30 random bit strings of
length L = 100, 200, 300, 400, 500, 750 and 1000 and then used a script to
automatically create problems within the XML simulations called bitstring_L_1 to
bistring_L_30.
An example of the output of this process for the binary PSO algorithm has been
included below:
And this is an example of the output for the AMPSO algorithm
Page 14
3.3. CiLib Simulations
For each of the problems and algorithms defined in sections 3.1 and 3.2 simulations
are then defined and run. The only exception to this is the NQueens problem. As
stated previously, implementation errors in CiLib resulted in the data generated
through the simulations being untrustworthy and inaccurate. For this reason, this
study instead ran simulations for the Knight’s Tour Problem.
Each simulation specified the sample size the number of candidates to track in the
particle swarm, the resolution the frequency at which measurements are recorded,
the algorithm to be used, the number of iterations to keep the swarm going and the
problem to be optimized. For each problem we have specified the particular
configurations our simulations used:
3.3.1 Spherical Unimodal Problem
Binary PSO AMPSO
Resolution used 40 40
Sample Size used 30 30
Dimensions simulated 1, 10, 20, 30, 40 and 503 1, 10, 20, 30, 40 and 50
Iterations 4000 4000
3.3.2 Schwefel Unimodal Problem
Binary PSO AMPSO
Resolution used 40 40
Sample Size used 30 30
Dimensions simulated 1, 10, 20, 30, 40 and 50 1, 10, 20, 30, 40 and 50
Iterations 4000 4000
3 Note: despite wanting to run the simulations until 100 dimensions, CiLib would failover and throw stackoverflow errors. Poor implementation of certain components of the library could have contributed to this unexpected behaviour. This error persisted for problems 3.3.1, 3.3.2, 3.3.3 and 3.3.4
Page 15
3.3.3 Rosenbrock Multimodal Problem
Binary PSO AMPSO
Resolution used 40 40
Sample Size used 30 30
Dimensions simulated 1, 10, 20, 30, 40 and 50 1, 10, 20, 30, 40 and 50
Iterations 4000 4000
3.3.4 Ackley Multimodal Problem
Binary PSO AMPSO
Resolution used 40 40
Sample Size used 30 30
Dimensions simulated 1, 10, 20, 30, 40 and 50 1, 10, 20, 30, 40 and 50
Iterations 4000 4000
3.3.5 Knight's Tour Problem
Binary PSO AMPSO
Resolution used 40 40
Sample Size used 30 30
Dimensions simulated 5, 6, 8, 9, 11, 12, 14, 15 5, 6, 8, 9, 11, 12, 14, 15
Iterations 4000 4000
Page 16
3.3.6 Random bit string matching problem
Binary PSO AMPSO
Simulations perdimension
30 30
Resolution used 40 40
Sample Size used 30 30
Dimensions simulated 100, 200, 300, 400, 500 and 750
100, 200, 300, 400, 500 and 750
Iterations 4000 4000
Page 17
4. Research results
Note: for each of the graphs shown below, the orange lines represent the performance of the binary PSO algorithm and the blue lines represent the performance of the AMPSO algorithm
4.1 Unimodal and Multimodal continuous valued problem resultsResults for the simulations run on the unimodal and multimodal functions mentioned in section 3.2 of this study were collated and processed using Openoffice Calc to visualize the performance and deterioration of the AMPSO algorithm against the binary PSO algorithm across dimensions 1, 10, 20, 30, 40 and 50. We will display the fully collated results at a very high level of granularity as the trends at that level are consistent with all lower levels.
4.1.1 Average fitnesses achievedThe below graph illustrates the averaged fitnesses of the spherical, schwefel, rosenbrock and ackley functions across each dimension that the simulations were run for: 1, 10, 20, 30, 40, 50. These are all minimization problems, therefore the smaller the fitness value, the better the overall solution that was found.
Page 18
Page 19
4.1.2 Average algorithm deteriorationThe below graph shows the relationship between the number of iterations in the simulations and on average improvement of the particle swarm across each dimension that the simulations were run for. Calculated as the improvement iteration to iteration of the swarm average fitness.
This graph illustrates succinctly the average rate at which the binary PSO algorithm and AMPSO algorithm converge on a single solution. A negative change represents an improvement since these are minimization problems.
Page 20
4.1.3 Discussion of resultsOn average across the simulations this study performed the following observations
have been made:
The rate of decay in the improvements offered to the fitness of the swarm per
iteration is less in the AMPSO algorithm than in the binary PSO algorithm.
This observation implies that the binary PSO algorithm is more prone to exploitation
and similarly, that the AMPSO algorithm is more prone to exploration. These
observations are consistent with the literature on the AMPSO algorithm and are most
likely the cause of the next observation this study made:
The average fitness of the candidates produced through the AMPSO algorithm are
significantly better than those produced through the binary PSO algorithm.
Through the use of the Angular Modulated strategy we see a greater degree of
exploration occurring within the AMPSO algorithm. This is most likely the contributing
factor to the fact that the fitnesses of the candidates produced by the AMPSO
algorithm are much better than those of the binary PSO algorithm.
Much faster convergence of the binary PSO algorithm
From the first graph it is plain to see that the point at which the binary PSO stopped
being able to improve the candidate solutions of the swarm (the point at which is
converged on some local minima), comes much quicker than that of the AMPSO
algorithm. This is consistent with our beliefs and shows that the AMPSO algorithm
scales considerably better over time than the binary PSO when trying to solve these
sorts of problems.
Page 21
4.2 Knight's Tour ProblemThe Knight’s tour problem is a maximization problem since we want to maximize the number of squares on the chessboard that our knight was able to visit. This is an instance of a Hamiltonian cycle problem. As with the previous problem we will begin by showing the overall performance of the AMPSO algorithm against the Binary PSO from a very highlevel holistic view across the dimensions we tested: 5, 6, 8, 9, 11, 12, 14 and 15 and then delve deeper into the more specific results obtained throughout this study that supported them.
4.2.1 Average fitnesses achievedThe below graph shows the average fitness across each dimension we simulated per iteration. On the Y axis we show the fitness value the average number of squares visited and on the X axis we show the iterations.
4.2.2 Average algorithm deteriorationThis graph shows the improvement of the average fitness across each dimension we simulated per iteration. As with the previous problem, this graph illustrated the average rate at which the binary PSO algorithm and AMPSO algorithm converge on a single solution. Higher values in this graph mean that the algorithm is still optimizing the problem and has thus, not converged.
Page 22
The graphs that follow are each for the specific dimension’s we simulated: 5, 6, 8, 9, 11, 12, 14 and 15. For each dimension we show the average fitness across the swarm and the average fitness improvements per iteration.
4.2.3 Performance for dimension = 5
Page 23
4.2.5 Performance for dimension = 15
As you may have noticed, despite the vast difference between the complexity of the knight's tour problem for N=5 and N=15, the graphs, illustrating firstly the averages best fitness found over time and secondly, the decap of the algorithm in offering improvements to candidate solutions, are very similar. This was the case for every other dimension being tested as well.
Page 24
4.2.6 Discussion of resultsFor all of the simulations this study has performed the following observations have
been made:
In all cases the AMPSO algorithm produced better average fitnesses over any
number of iterations than the Binary PSO algorithm
The Knight’s Tour Problem, as compared with problem 4.3. Random bit string
matching, is a very search intensive problem. The number of open hamiltonian
circuits able to be made by a Knight on a chessboard of any size is still unknown.
Therefore, an algorithm that is better at exploration than another is likely to perform
better in the solving the Knight’s Tour Problem. This is the case between the AMPSO
algorithm and the binary PSO algorithm the AMPSO algorithm does offer greater
exploration. Therefore, it makes sense that the AMPSO has performed consistently
better than the binary PSO.
In all cases the AMPSO algorithm produced more consistent improvements to the
average fitnesses than the binary PSO algorithm over any number of iterations
The majority of the improvements to the fitness function for the AMPSO algorithm
appear to occur within the first 1000 iterations, after which the improvements are
marginal at best. This observation is consistent as the AMPSO algorithm begins to
exploit good candidate solutions within the swarm, but also as velocities and
attractors affecting the degree to which the particles in the AMPSO algorithm
explore, decrease.
In all cases the majority of the improvement in the average fitnesses for the binary
PSO algorithm occurred between the 1200 th and 2200 th iteration and in all cases
these improvements outperformed the improvements made by the AMPSO
algorithm to the average fitnesses in the same range.
This is a rather strange observation. At this point in time, it is unclear why such a
pattern would arise, however, the data shows that this is what happens. A cause
might be that:
a. During that particular interval, exploration of the binary PSO algorithm is
higher than usual and the algorithm is better able to locate more optimal
solutions
Page 25
4.3 Random Bit String MatchingThis problem is a minimization problem, we want to minimize the hamming
distances between tome target randomly generated bit string of a fixed length and
the swarm of bit strings produced by both the binary PSO algorithm and the AMPSO
algorithm. For this problem this study was able simulate 100, 200, 300, 400 and 500
bit long bit strings before cilib crashed . For each length, 30 unique and random bit 4
strings were generated and set as targets for the binary PSO algorithm and the
AMPSO algorithm.
Unlike the previous two problems we will focus only on the results obtained for each
dimension and not attempt to synthesize these results into a holistic view. Two
measures will be presented: the measure of the overall hamming distance (the
fitness) and the standard deviations of the samples of 30 fixed length bit strings
against the iteration.
4 It was a StackOverflow error
Page 26
4.3.1 Performance for bit string length = 100
The first graph below shows the average improvement of the fitness function
averages across the 30 samples against the number of iterations. The second graph
shows the standard deviation of the fitnesses across the 30 samples against the
number of iterations. The 30 samples were each 100 bit long randomly generated bit
strings.
Page 27
4.3.2 Performance for bit string length = 200The first graph below shows the average improvement of the fitness function
averages across the 30 samples against the number of iterations. The second graph
shows the standard deviation of the fitnesses across the 30 samples against the
number of iterations. The 30 samples were each 200 bit long randomly generated bit
strings.
Page 28
4.3.3 Performance for bit string length = 300The first graph below shows the average improvement of the fitness function
averages across the 30 samples against the number of iterations. The second graph
shows the standard deviation of the fitnesses across the 30 samples against the
number of iterations. The 30 samples were each 300 bit long randomly generated bit
strings.
Page 29
Page 30
4.3.4 Performance for bit string length = 400The first graph below shows the average improvement of the fitness function
averages across the 30 samples against the number of iterations. The second graph
shows the standard deviation of the fitnesses across the 30 samples against the
number of iterations. The 30 samples were each 400 bit long randomly generated bit
strings.
Page 31
4.3.5 Performance for bit string length = 500The first graph below shows the average improvement of the fitness function
averages across the 30 samples against the number of iterations. The second graph
shows the standard deviation of the fitnesses across the 30 samples against the
number of iterations. The 30 samples were each 500 bit long randomly generated bit
strings.
Page 32
4.3.6 Discussion of results
The reason for including all of the above seemingly similar graphs is because that
only by viewing all of them is is possible to observe that:
The difference in the average fitness of the solutions produced for increasing
dimensions between the Binary PSO algorithm and the AMPSO algorithm is
narrowing.
This observation implies that the AMPSO algorithm may actually beat the Binary
PSO algorithm for larger bit strings >500 bits long. Further simulations would be able
to prove or disprove this hypothesis. However, preliminary indications in the empirical
data point to this result.
For all of the simulations this study has performed for bit strings of length 100, 200,
300, 400 and 500 the following observations have been made:
The average fitnesses produced by the binary PSO algorithm were smaller and
thus better than those produced by the AMPSO algorithm.
On average the hamming distance between the random bit strings produced in the
binary PSO algorithm were smaller than the hamming distances of those produced
by the AMPSO algorithm from the specified target bit string. This could be as a result
of a number of factors:
a. The approach used by the binary PSO algorithm to determine new positions
(by flipping bits through probability) is more suited to matching binary strings
than angular modulation. or …
b. That through the use of angular modulation (to map between the binary and
the continuous space) the problem has been somewhat altered and the
problem has lost clarity and is thus more difficult to solve.
The standard deviations of the AMPSO algorithm were larger and did not appear to
reach an ‘equilibrium’ as the standard deviations of the Binary PSO algorithm did.
This observation implies that the AMPSO algorithm is better at exploration than the
binary PSO algorithm. This is consistent with our understanding of the potential
benefits provided by the AMPSO algorithm over the binary PSO algorithm. A better
exploration, however, in this case has not resulted in a better solution having been
Page 33
found.
For all of the simulations, the rate at which the binary PSO algorithm converged was
faster than that of the AMPSO algorithm.
This observation ties back into the previous observation. Since the binary PSO
algorithm converges more quickly than the AMPSO algorithm we can hypothesize
that either:
a. Either the binary PSO algorithm is more prone to exploitation this
hypothesis would be consistent with our other findings in previous problems
or that
b. The binary PSO is a more optimal algorithm to finding solutions just for this
specific problem.
Page 34
5. Conclusions
During this study we have simulated the performance of the binary PSO algorithm
and the newer AMPSO algorithm against a number of benchmark functions and
compared their performance in the hope of determining which algorithm offered
more in term of scalability.
The AMPSO algorithm which uses the Angular Modulation technique to map between
continuous and discrete search spaces exhibits a much greater degree of
explorability than the traditional binary PSO algorithm. Also, for two of the three
problem sets the AMPSO clearly outperformed the binary PSO.
However, the AMPSO did not outperform the binary PSO algorithm for the problem of
bit string marching for bit strings of various length. That having been said, the
deterioration of the performance by the binary PSO algorithm for much larger bit
strings was greater than that of the AMPSO which might indicate better scalability for
much longer bit strings.
Additionally, the performance of the AMPSO algorithm on the other two problems: the
Knight’s Tour Problem and optimizing of continuous valued unimodal and multimodal
functions, performance of the AMPSO algorithm over time did not deteriorate as
rapidly as the binary PSO.
Therefore, this study which compared the scalability of the AMPSO algorithm against
the binary PSO algorithm concludes that the AMPSO algorithm is indeed more
scalable than the binary PSO algorithm and also that in the majority of cases (two
thirds) the AMPSO algorithm is also better at producing fitter candidate solutions.
Thank you.