PSOt, particle swarm optimization toolbox for matlab.5 U3 f- T* P/ ~: W" J/ [, w$ e
; ~( `5 k( A( l W
May be distributed freely as long as none of the files are % F. [1 [# g% [/ j( F% ^4 g
modified. 4 z: T8 X8 G c" z) Y' V& e; `' b1 p: _
Send suggestions to bkbirge@yahoo.com 7 y1 Q+ r. H4 B3 y% O- t1 ?& t
+ Y8 O7 ?( O7 w/ y
Updates will be posted periodically at the Mathworks User ; q1 N6 b! [, V4 Q& R+ S1 U
Contributed Files website (www.mathworks.com) under the 3 h- {" U" j9 N* Q# V% ~. j7 k: J
Optimization category.& N1 j/ j8 I3 V# X" N. }
/ v0 X% a/ J: z4 \To install: + L6 w1 b6 r1 K# b0 ?Extract into any directory you want but make sure the matlab 1 e4 Q( Y" D$ z! apath points to that directory and the subdirectories 8 B* r' g) h5 b, @2 w7 k'hiddenutils' and 'testfunctions'. ! w2 w9 n6 v) ~: f) D5 t, L- [7 }3 M5 _: [- B
Enjoy! - Brian Birge, h" T N8 E' c# x, k; o
3 ?$ z9 U) e( U S: w
------------------------------------------------------------- " H! P8 R) G4 f( F5 P-------------------------------------------------------------& \1 r1 n+ N! x, h! D( T8 Y1 K0 E
1 W1 ^. V) U4 h* S' j0 |. GINFO, Y$ j5 i! D, Z9 E
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) & q% E- e$ F2 f( m% xand watch it work!, G; _# ~* U& ]. K! v1 c( C1 q$ P
# f$ U& L, e5 x( y# J
This is a PSO toolbox implementing Common, Clerc 1", and 4 Y3 s1 z& d# l y9 W# f
Trelea types along with an alpha version of tracking changing5 h% H G( u, l8 C5 Q1 L% y
environments. It can search for min, max, or 'distance' of / b5 U. k$ @5 l. _user developed cost function. Very easy to use and hack with ( N3 c5 Q% p- S( w$ R) nreasonably good documentation (type help for any function and 0 l) V: Y2 X: O* m9 a+ S% H4 yit should tell you what you need) and will take advantage of : a- _& R$ g* L' ? `5 W& Hvectorized cost functions. It uses similar syntax to Matlab's 9 w$ n( |- Z$ T8 |. Doptimization toolbox. Includes a suite of static and dynamic 1 {( b. Q/ _% o% {- Q3 f) @8 S6 Stest functions. It also includes a dedicated PSO based neural ' z$ V0 G+ ]# I1 D+ A2 Lnetwork trainer for use with Mathwork's neural network toolbox. - p1 u+ T# e7 }6 a1 |( t* e# a& o6 i# O" d) o- H3 u+ c$ t1 r
Run 'DemoPSOBehavior' to explore the various functions, options, " x& [& k1 w! c( ?4 c
and visualizations. j6 Z8 Q) Z3 d% `& h5 a' J0 c" \5 Z0 G+ [
Run 'demoPSOnet' to see a neural net trained with PSO " E5 S$ j% H; p( h/ G* I- \(requires neural net toolbox).2 x& T2 I. O5 {- T
- H9 a( I$ h1 C+ e9 r: a" r2 K$ t- d5 f' Z
This toolbox is in constant development and I welcome : @* H/ P! ~8 E' [suggestions. The main program 'pso_Trelea_vectorized.m' lists * [- e5 q: \- P& f" c, b3 J
various papers you can look at in the comments. , u' D# C) L+ f* t& e9 _( s+ x# Z9 W* X. ~
Usage ideas: to find a global min/max, to optimize training of # ~9 D ?% }) c5 b' d$ gneural nets, error topology change tracking, teaching PSO, # T! T4 ~. C% W) Z i! p$ `0 Ainvestigate Emergence, tune control systems/filters, paradigm ; Z. {& ]+ R T: G
for multi-agent interaction, etc.3 P4 ^) p4 \: E6 d
' ~6 N' W# y# \* O& x- {# P# U------------------------------------------------------------- : U6 ^5 h8 b' M! w; ?) z-------------------------------------------------------------0 O" `: ^5 t) o+ w3 b5 h& `
4 E+ [0 z: Y N+ R* x
. w* f6 X2 c) L: Q- M" V( W
Files included: " x4 W5 W% x) z5 D- _4 }3 |5 S( \; t+ e ! a9 M5 g8 l0 F. j/ T ' r, Q+ N1 D1 j# c% l6 C5 n' m4 S** in main directory:. C4 P0 o: _' z( T
/ v: D+ Z8 e$ P$ f+ h! `
0) ReadMe.txt - this file, duh 0 S! s+ e- X4 W4 \9 j, e t1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO0 B) ?1 s. s9 a' U: p
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called 1 s9 s4 `3 @0 V' n+ m3) goplotpso4demo.m - plotting routine called by the demo script, useful to see how custom plotting can be developed though this routine slows down the PSO a lot& B2 E% D% D* H& s1 w" j
4) goplotpso.m - default plotting routine used by pso algorithm) x$ o! S1 B) p. t' W; [7 [
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. Z+ [! g& n' N4 T- F . u! C7 F. E2 m7 r) ~/ u* p$ a& _# b4 e5 K" h7 Z6 S
0 T/ \3 P1 R1 d) |
** in 'hiddenutils' - x9 A ]0 u. C, ^: R, h) j; S: M/ g$ X* t* s+ ]. S8 l( V
1) forcerow, forcecol.m - utils to force a vector to be a row or column, superseded by Matlab 7 functions I believe but I think they are still called in the main algo ) l& p1 `3 T& k* d6 e2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible 7 d% H& t' w/ D& i2 W" A3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory% f% _7 Z, a ?9 h2 p
1 E% m0 p6 j5 _: F" C8 N
+ d+ i8 ?, }/ s# i' w- J3 S5 G7 |, I" Y% A
** in 'testfunctions' * I+ z! S6 _0 V4 Q- X6 w0 X0 p$ E+ X1 b- q V# N0 j
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:: F: X3 L8 i2 |9 s% `. w
% P9 q/ u* _+ c
Static test functions, minima don't change w.r.t. time/iteration: : K0 }) Z; q1 F1 {( W 1) Ackley1 E8 e2 |5 H: h+ J5 d( ?& A
2) Alpine# O9 ~% @; f+ f# D
3) DeJong_f2 ! N% k: q' Q/ |6 h- G" n 4) DeJong_f3 , c* `& z6 K$ w8 J* [ 5) DeJong_f4 f4 f+ y$ L5 f, v9 g
6) Foxhole# s- a- i0 m1 i6 I
7) Griewank6 F' d$ r+ w7 l& m
8) NDparabola . [ X6 f( {- ]) z4 j7 i 9) Rastrigin 1 s5 P. F ~3 e' @: L10) Rosenbrock ) E y- d' t' r) S11) Schaffer f6 9 g- M1 f) ]4 o, S) G g12) Schaffer f6 modified (5 f6 functions translated from each other)1 u" j. z7 I3 h) d b! O; F
13) Tripod1 M% S. n- M+ }$ _' R* [) t
% z$ @; q: {' Z [5 W1 jDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): * O/ G- [* ^" i/ s T& }! k) _3 f14) f6_bubbles_dyn $ v" n% x; n, m; c8 B' h15) f6_linear_dyn : L& Z' [0 ` y( f7 c# d2 C/ x0 a16) f6_spiral_dyn/ z7 r2 F0 b `9 `" Y% B
, {8 U' |5 J. c/ ]) ~
# R9 t8 g! O$ k
2 j# x' J1 D' n6 M, |+ q** in 'nnet' (all these require Matlab's Neural Net toolbox) * C7 T# K. I( y) L* G; R 7 L4 U: O& L7 P) Y, L/ P: P y9 D& ? 1) demoPSOnet - standalone demo to show neural net training- d7 B( j# Q2 U; {3 f* I( b
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this- m' h. ^& t2 J) k
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize! f* c. h- @$ t4 T \; }+ r
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run 9 T! [( w1 C* d. V1 o; n9 G+ Y% I