Code covered by the BSD License
...
...
Find the minimum of a function using Particle Swarm Optimization.
...
Particle swarm optimization for binary genomes.
...
Penalty-based constraint enforcement method.
...
Internal toolbox function.
...
Checks initial population with respect to linear constraints. Requires
...
Check the the swarm population against all constraints.
ackleysfcn(x)
Ackley's Function.
binarytestfcn(x)
dejongsfcn(x)
dropwavefcn(x)
evolutioncomplete(options... Plays a notification when genetic algorithm finishes. Requires a
griewangksfcn(x)
Griewangk's function.
heart(x)
For nonlinear constraint demonstration.
initstate(nvars,options,n... Initialize swarm condition. Called by PSO.
langermannsfcn(x)
nonlinearconstrdemo(x)
Nonlinear constraints demo with Rosenbrock's function. Select this
overlaycontour(fitnessfcn... Overlays contour and marks known minimum for demo cases of pso.
overlaysurface(fitnessfcn... Overlays surface and marks known minimum for demo cases of pso. Called by
psoboundsabsorb(state,Ain...
psocalculatepenalties(sta... Calculates the penalty to apply for out-of-bounds particles when using
psocheckpopulationinitran... Automatically adjust PopInitRange according to provided LB and UB.
psocreationbinary(options... Generates uniformly distributed swarm consisting of binary bitstrings.
psocreationuniform(option... Generates uniformly distributed swarm based on options.PopInitRange.
psodemo(DemoMode)
Runs the PSO on a few demonstration functions, which should be located
psogenerateoutputmessage(... Generates output message after PSO is done.
psogetinitialpopulation(o... Gets the initial population (if any) defined by the options structure.
psoiterate(options,state,... Updates swarm positions and velocities. Called to iterate the swarm from
psooptimset(varargin)
Creates an options structure for pso.
psoplotbestf(options,stat... Plots the best, mean, and worst scores of particle swarm.
psoplotscorediversity(opt... Plots a histogram containing the best and mean scores of particle swarm.
psoplotswarm(options,stat... Plots the positions of particle swarm.
psoplotswarmsurf(options,... Shows the evolution of a 2-variable population over a known surface. This
psorunhybridfcn(fitnessfc... Calls the hybrid function defined in options.HybridFcn, from PSO.
quadrifolium(x)
For demonstrating nonlinear constraints. This produces a 2-dimensional
rastriginsfcn(x)
Takes row inputs. If not row, will attempt to correct it.
rosenbrocksfcn(x)
Takes row inputs. If input is not row, will attempt to correct it.
schwefelsfcn(x)
Schwefel's function.
templatefcn(x)
Template for writing custom test/demonstration functions for psodemo.
testfcn1(x)
unitcircle(x)
Unit disk. The vector x should be a row vector. This is to test the
unitdisk(x)
Unit disk. The vector x should be a row vector. This is to test the
void(varargin)
View all files
Another Particle Swarm Toolbox
by
Sam
01 Dec 2009
(Updated
01 Apr 2014 )
Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox.
binarytestfcn(x)
function f = binarytestfcn(x)
% The minimum value of f should be obtained when x = [0,1,0,1,0,1, etc].
if strcmp(x,'init')
f.PopulationType = 'bitstring' ;
else
if length(x) < 2, x(2) = 0 ; end
f = sum(x(1:2:end)) - sum(x(2:2:end)) ;
end
Contact us