This page was automatically generated by NetLogo 3.1.4. Questions, problems? Contact firstname.lastname@example.org.
The applet requires Java 1.4.1 or higher. It will not run on
Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use
a browser that supports Java 1.4. (Safari works, IE does not.
Mac OS X comes with Safari. Open Safari and set it as your default
web browser under Safari/Preferences/General.)
On other operating systems, you may obtain the latest Java plugin from
Sun’s Java site. General information on the models, including instructions for running them on your own computer, is available from the NetLogo Simulation Information Page. To download this page, do not use "Save As," but right-click (or on Macs control-click) on this link. You also need to download the NetLogo program, which you can do by right-clicking or control-clicking this link.
created with NetLogo
view/download model file: PSO.nlogo
This model demonstrates the Particle Swarm Optimization technique developed by Kennedy and Eberhart (see CREDITS AND REFERENCES below). Particle Swarm Optimization (PSO) uses a population of particles to cooperatively search for the best solution to a problem, represented by positions in a space, where each location has a "quality" ("goodness") determined by some Objective Function or Figure of Merit. It was originally intended as a simple model of socially acquired knowledge, in that each particle's search is guided both by its own private knowledge of the best solution it has found so far and by social knowledge, namely the best solution found by all the particles. PSO is commonly used to search high-dimensional spaces, but in this model we search a two-dimensional space, which is easier to visualize.
Each particle k has a current position Xk, a current velocity Vk, and a remembered best location Pk (all two-dimensional vectors). In addition, all particles know g, the index of the particle that has found the best position so far, so that Pg is the best location that anyone has found. The velocity update rule is:
Vk' = w Vk + Phi1 (Pk - Xk) + Phi2 (Pg - Xk)
where w is an inertia parameter and Phi1 and Phi2 are random numbers uniformly distributed in [0, 2]. They determine the extent to which the particle steers towards its own best solution (Pk) or the population's best solution (Pg). The particle's position is updated by:
Xk' = Xk + Vk'
In addition, if the quality of Xk' is greater that that of Pk, then the individual best is updated, Pk := Xk'. Also, if the quality of Pk is better than the population's best, Pg, then the latter is updated, Pg := Pk.
NUMBER controls the number of particles.
SETUP initializes the particles with random positions and velocities.
GO ONCE and GO cause the particles to update their positions and velocities according to the particle swarm equations.
INERTIA sets the particles' inertia (see HOW IT WORKS).
MAX VELOCITY sets the maximum particle velocity; particles that would have a greater velocity (according to the rules) have it scaled back to this maximum, but without changing the direction.
VARIABLE PHIS? determines whether the random Phi1 and Phi2 values for each particle are determined once, when the particles are created, or whether they are recalculated every time a particle moves. The former gives the particles fixed "personality types" wheras the latter allows them to change dispositions at any time.
COLL. AVOIDANCE? determines whether the particles avoid colliding with each other, and maintain greater diversity and ability to explore. When COLL. AVOIDANCE? is turned on, a particle looks ahead to see if its next step would take it to a location where there is already a particle. If so, it negates its velocity vector, so in effect it bounces backward and continues in this new direction.
INIT BACKGROUND initalizes a noisy fitness (objective function) background, with a maximum level determined by BACKGROUND LEVEL. This is included in the fitness evaluation computation if INCLUDE BACKGROUND? is turned on. Note that SETUP clears the background, so INIT BACKGROUND should be done after SETUP.
TEST FUNCTION selects the objective function to be used. "2007" has a peak at coordinates (20, 07) (upper right). "Two peaks" has a global optimum at (20, 07) and a much braoder suboptimum at (-20, -07).
SHOW OBJ FUNCTION and HIDE OBJ FUNCTION determine whether the objective function is displayed in the background. Click on SHOW after the objctive function is selected and the fitness background is initialized (if you use the background).
BEST X and BEST Y show the best location found so far; MERIT is the quality of the current best solution, and BEST PARTICLE is the particle that found it.
GLOBAL BEST plots the quality of the best solution.
With the "two peaks" test the particles may get trapped by the suboptimum; this is an example of "premature convergence."
Try turning on collision avoidance and setting the max velocity high (10-15). The particles bounce around alot more, but do they find the global optimum better?
Add new test models. Read the PSO literature and try some of the new ideas to improve its performance. Recode the particles to use Netlogo's movement abilities rather than the vector calculations in this simulation.
PSO is related to models of flocking behavior in birds. In what ways is it different?
Particle swarm optimization was invented by Kennedy & Eberhart:
Kennedy, J., & Eberhart, R. ÒParticle Swarm Optimization,Ó Proc. IEEE IntÕl. Conf. Neural Networks (Perth, Australia), 1995. See < http://www.engr.iupui.edu/~shi/pso.html >.
Krink, T., Vesterstr¿m, J.S., and Riget, J. ÒParticle Swarm Optimization with Spatial Particle Extension,Ó World Conference on Computational Intelligence, 2002. This paper describes and tests collision avoidance. See < http://www.evalife.dk >, < krink,jve,email@example.com >.
To refer to this model in academic publications, please use: MacLennan, B.J. (2007). NetLogo Particle Swarm Optimization model. http://www.cs.utk.edu/~mclennan. Dept. of Electrical Engineering & Computer Science, Univ. of Tennessee, Knoxville.