PSOt, particle swarm optimization toolbox for matlab. ! b: g& i4 @- t7 h$ h" x& c. c3 _3 z B3 ?
May be distributed freely as long as none of the files are 2 b7 a4 J. x7 ?$ j4 X
modified. ! @/ e# M8 C' Q1 m7 t; `! B- R# d V8 p% J
Send suggestions to bkbirge@yahoo.com 9 B8 D9 \4 f1 u3 p& u9 ?5 J
( H# W+ ?3 a/ I l$ S
Updates will be posted periodically at the Mathworks User ; }8 S1 L- `! a- e; P* A+ oContributed Files website (www.mathworks.com) under the 4 Q8 f. D2 P) B
Optimization category. & c3 Z5 U5 o: y8 }8 ?0 s: u$ ~/ n* C# q% h9 b: n
To install: ! M7 _ m. M1 h& Z/ N0 t9 `+ GExtract into any directory you want but make sure the matlab + z9 S2 Q& f0 d S- {
path points to that directory and the subdirectories % @6 ^) X4 p5 y& H+ c! D( i' N6 V
'hiddenutils' and 'testfunctions'. 6 r) o+ x4 Z3 q2 ^& B2 u
+ g4 i7 J: C. H/ d% ^, L% O8 u3 _3 z
Enjoy! - Brian Birge( B; C* h, h) I8 I
+ i6 G* n* y! N, U) d-------------------------------------------------------------8 X7 H' d( R2 d c' i
-------------------------------------------------------------/ t! z$ P d3 U" {
; o# v0 x; m. ^3 M. w9 J
INFO& {+ c7 H0 N- @) d
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) : y3 X2 `- }/ u' Z1 A: {
and watch it work! $ Y+ z5 `( O4 ?# X# P; j& k+ H/ n3 d% C! _' e
This is a PSO toolbox implementing Common, Clerc 1", and ! l9 {. f8 i" a3 x" h- |1 o
Trelea types along with an alpha version of tracking changing - a% y2 G4 d8 {4 y4 qenvironments. It can search for min, max, or 'distance' of ' e& T j7 y3 B6 O
user developed cost function. Very easy to use and hack with . K4 ~3 z. Z. L" k' o! Dreasonably good documentation (type help for any function and ! c4 b4 b% }- ^, H: d9 w+ Jit should tell you what you need) and will take advantage of $ o7 v- t+ `, m2 F. c- r' T
vectorized cost functions. It uses similar syntax to Matlab's : K! x0 f3 i- m" V, U9 goptimization toolbox. Includes a suite of static and dynamic 7 L7 @# n1 f1 i( Ctest functions. It also includes a dedicated PSO based neural ) X0 J, v# g7 e4 c/ Rnetwork trainer for use with Mathwork's neural network toolbox. 4 L4 \- G1 x8 U1 j, h* M8 ? ) T. \4 N% R% J0 }* [* @% d1 ~; z$ XRun 'DemoPSOBehavior' to explore the various functions, options, 0 v6 Q1 [ V7 ~
and visualizations. & }' k) P7 h4 Z' l( M : `8 W9 m. S3 i' ^+ Y$ W- Q% j& pRun 'demoPSOnet' to see a neural net trained with PSO ' p6 `( h# j% M1 o' V(requires neural net toolbox). D5 T r. B( b5 Z5 {
; D$ X4 G! A. F9 M# g p! W9 v& |7 l4 T
This toolbox is in constant development and I welcome 4 `9 d- H u5 N5 Gsuggestions. The main program 'pso_Trelea_vectorized.m' lists 5 w3 S- o' j" E1 k0 z: C
various papers you can look at in the comments.$ V" _1 T, T1 s, m! x
' [ C' m3 X/ b& p/ P
Usage ideas: to find a global min/max, to optimize training of : I, W2 ~7 Q- w& y' `5 ~! C0 M5 f/ yneural nets, error topology change tracking, teaching PSO, % G. Y6 j* C" p: }8 U9 U. N: V# y% c$ hinvestigate Emergence, tune control systems/filters, paradigm " E$ S) h- Q0 B! a: `for multi-agent interaction, etc. - x( c9 g8 h7 A9 N. i! e* J o& u: l% |
-------------------------------------------------------------7 ~# A6 @* L/ \* f
------------------------------------------------------------- 7 _$ w9 b% z( f+ I9 ~ + }0 x6 U% i1 u n p( r* l. k/ K# }/ {9 i( M2 U/ ?
Files included: , c' R8 Z7 m: c+ U* m ( U+ s# Z g" b& {4 U! q3 s5 t8 T g
** in main directory:3 J) I3 i7 o4 W+ k( ]& Y3 j
0 `$ J0 p) n$ N& ^3 w/ |1 r0) ReadMe.txt - this file, duh/ V, {( c6 o$ @7 C- R8 Z* h; i
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO , k7 U( Z4 c. q( M2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called 2 O2 O$ y1 x5 R3) 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 1 Z5 b1 n% {7 e0 R4) goplotpso.m - default plotting routine used by pso algorithm + A9 a4 e3 n& N ?5 n$ f$ @5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.6 C9 L( o; o+ x$ I2 k
3 }$ r7 ^2 W& h; ?3 e4 c) x
) l% Y0 _6 s3 I# O- A( L8 I' b/ l( H: x7 U
** in 'hiddenutils' 5 w7 U. u- j; t9 x( F( E + \' I1 m8 H, X; t: [/ H1) 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 * R. `8 r- r' u2 ^2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible+ z! A) s8 s5 k$ ?
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory 8 H% e9 m" {+ c, z 8 C% z* P+ K6 q" E6 W, Z3 b. `9 i9 \5 I# h8 q
! ^ H5 v' R- @, P) _: D
** in 'testfunctions'5 a' i! H f3 Y
& k' w" ]$ b) a( ]7 C. eA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:! h0 [: ?4 ?1 h$ `* I& g$ x
: M# w$ H, n& H! m1 z
Static test functions, minima don't change w.r.t. time/iteration: : F" h$ j, }& C 1) Ackley8 s0 Y! g( o( N( j( @0 b+ A
2) Alpine . u. v. x) J& ~% y 3) DeJong_f24 ?8 f$ t- M! v. m! R* b, V3 q
4) DeJong_f3 W6 {7 [) {8 o5 Y/ a9 u- X
5) DeJong_f4 ' V3 l8 Z% ^( o* B( \4 h1 v+ h 6) Foxhole/ M5 `" L9 i2 }8 f5 U8 `
7) Griewank+ x% T9 l2 L( i( S! I7 ]" m# P. q
8) NDparabola! H9 [3 i" r, o4 V' Z, H6 ?
9) Rastrigin( `# ^; A5 ^; z1 y' ~1 F3 N* u! L$ l
10) Rosenbrock8 C6 f/ `1 M+ f3 Q% I2 u
11) Schaffer f6 ' {% ~3 m- K* e& v6 x$ u, q) O12) Schaffer f6 modified (5 f6 functions translated from each other)5 i) k1 V9 M% K3 n4 K
13) Tripod, P* X2 C4 m; O" d5 E6 K% z
9 f" Y7 i! X% z
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 1 D1 L a' N P u" D- Q14) f6_bubbles_dyn 4 M* h5 d S" H15) f6_linear_dyn ) a, \% p X" A o5 ~: ^16) f6_spiral_dyn% {# K4 M. p, }) Q& }
5 [6 }9 ~9 n( R2 Q- x# q. @) O+ a4 }+ `3 ^
* x6 O7 N$ V9 o7 F2 y** in 'nnet' (all these require Matlab's Neural Net toolbox)& ~4 h5 M2 M4 Z6 W
Y6 X* Y' m! {- _ 1) demoPSOnet - standalone demo to show neural net training & l$ y; f. |+ f5 U; ~1 {# t 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this ' F) h1 }/ [& S9 X 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize # H! l! Q, N# U; Q$ V! B 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run- f' e2 ~+ Q9 z1 K