PSOt, particle swarm optimization toolbox for matlab. # W1 e9 H! M9 y |3 D" `- r. A2 p6 F x. ?
May be distributed freely as long as none of the files are - U* |2 l, F- Y0 b, h$ s3 q$ tmodified. * }# R, Y5 Y8 Y( k; ]
! f& F5 ?2 C* NSend suggestions to bkbirge@yahoo.com . d8 T8 ^$ k- E
6 v9 f ~* ^3 q6 I/ v+ U- E+ _
Updates will be posted periodically at the Mathworks User 1 f4 t9 R! K' \" i4 C0 wContributed Files website (www.mathworks.com) under the # A& C9 Y0 A' UOptimization category.$ Y4 E7 f. g1 u3 A1 ^6 N! V" l/ e
( J6 J3 s) X4 t( @% JTo install:: r0 v; [+ H, p' k$ N
Extract into any directory you want but make sure the matlab ) `( x, e G, ~# ~ A. Npath points to that directory and the subdirectories ( b5 D Q; n3 }: k6 ^
'hiddenutils' and 'testfunctions'. , O: n d) Z+ q* A$ B. X% B5 U$ _8 o/ J( E# s/ }/ o. {2 x5 K
Enjoy! - Brian Birge6 d, V# X( D" L: ?2 m9 \
' E/ f7 j4 y+ M) G% E/ |( S$ b p: a-------------------------------------------------------------# k- i. ]/ \- _$ p3 N) { R% {7 q
-------------------------------------------------------------. D& c- [) X" ?
* L) x/ u N* A' hINFO1 E7 Q- x3 h) n) r
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) & v: @0 p8 T6 l! ]and watch it work!4 ], ^2 \* ]* c" e$ A- [/ z
4 |3 y5 P& ] ^- E) F1 EThis is a PSO toolbox implementing Common, Clerc 1", and 6 x2 n. |- j5 ^
Trelea types along with an alpha version of tracking changing 5 d' C9 R v' @9 Z* f4 Uenvironments. It can search for min, max, or 'distance' of 3 D: M. a2 N9 a h6 h0 i Ouser developed cost function. Very easy to use and hack with # X) v% y* x3 d& }8 {2 l: X# ]reasonably good documentation (type help for any function and9 _+ O/ d% G$ U) \! z
it should tell you what you need) and will take advantage of # n2 M; A* f0 ~ |! ~2 d/ M
vectorized cost functions. It uses similar syntax to Matlab's3 O0 g! c! ]( ^- _/ K
optimization toolbox. Includes a suite of static and dynamic 7 `# Z$ Q) R) o6 {1 ytest functions. It also includes a dedicated PSO based neural : A) r4 b; r$ ]
network trainer for use with Mathwork's neural network toolbox. . r' F# u9 M3 p2 ?$ p. A4 o' C, j % S/ D/ X6 U9 x5 O6 Q. y5 O2 `Run 'DemoPSOBehavior' to explore the various functions, options, 7 a/ [9 r6 M6 F# ?6 Aand visualizations. 6 i/ T0 ?* b3 J" O0 J . d. ^5 v I; G4 h( x4 f5 `& {Run 'demoPSOnet' to see a neural net trained with PSO : x6 I Q8 \0 ^. e$ e/ z3 w
(requires neural net toolbox). - q/ B3 F1 u! ~, g" c t( ^+ M; d a0 j
7 y) E/ F; i: ^) ^& o3 P
This toolbox is in constant development and I welcome & q8 i9 ~; _0 k4 Q
suggestions. The main program 'pso_Trelea_vectorized.m' lists - Z6 R, L- u* ?( \: p! @2 Vvarious papers you can look at in the comments. ) u/ ?. M5 q: W8 c0 { + D7 Z8 F+ b4 l% _8 U/ dUsage ideas: to find a global min/max, to optimize training of 4 {+ z3 D! v+ a! a0 w7 |' Xneural nets, error topology change tracking, teaching PSO, + h* N0 D% L6 q7 R) a, x# ]- winvestigate Emergence, tune control systems/filters, paradigm # i `8 B! S$ u& l
for multi-agent interaction, etc. % ?" Y& i+ m0 @+ L& X" r' Y9 s- o- t1 B% o* a: C
-------------------------------------------------------------% C8 j: U) T- l, T5 u4 O
------------------------------------------------------------- m% ?5 o3 A& M# Q/ p/ t1 Y 4 V% z+ B( ^5 V6 A" q $ X6 y( k( x! j# D4 E; ~4 r" F BFiles included: ( j0 Z1 B' S& i+ A: P5 L" r* ^7 ?" \4 h+ h: \% U
1 Y0 o- U* \7 r$ n
** in main directory:; Z: Y; B, j$ o ]* @2 k
. `5 n: R; n8 Q# ]0 f# j( y0) ReadMe.txt - this file, duh9 G4 W1 E* F9 q5 R* r0 a
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO , G' ]5 m; v8 M2 q% s f; p3 s2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called " `. k( V6 L9 I. p3) 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( I/ Q0 I9 A" s/ Y, {" Y
4) goplotpso.m - default plotting routine used by pso algorithm $ l' n+ s; U3 T( Z- u5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.5 b d- r0 A/ z" M- k9 ]$ L9 k
0 T1 z; Y) B' m& B8 h! z2 b/ i$ j0 | ! l2 {1 z5 r1 b9 d7 z: h; m: c 1 Q2 V/ t* B! U** in 'hiddenutils' / Z% G; S/ ]* n 9 j0 m# `0 @4 ]+ p" w/ H& K4 r1) 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 ( @, f j6 ^- e+ k: j2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible1 R1 J+ j" P/ Z* b9 _- D* q5 m) [2 Q
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory 0 Q7 B# q8 W3 X% p* A/ b( H& E6 E2 _9 I2 I. C& E1 P
/ e3 y( b/ g ^1 d
! k/ \ v+ I# U% a& U** in 'testfunctions'5 g) {- l/ i2 _% f1 i# ^
& Y7 u8 i4 Y9 R$ i' }
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: . a8 {# F, h" L" \- s ! H7 V+ i: R- J$ {" XStatic test functions, minima don't change w.r.t. time/iteration: 3 i3 f6 K$ l7 k- W8 L: f; y 1) Ackley 6 E% @) n# X+ j8 i7 | 2) Alpine- `/ B- ]" `6 p u* O) W& A
3) DeJong_f2 # m7 `' ?. Y6 f- y! I7 P( b 4) DeJong_f3 , c t: w3 D' N& Y1 ^ 5) DeJong_f46 n& o8 e+ N& U C1 d5 g8 }
6) Foxhole - M+ W/ S1 c7 k 7) Griewank4 Y. m9 I& Y R+ J y
8) NDparabola 9 V- g3 x- {+ F9 V7 i! q9 g$ {" Z; t 9) Rastrigin * |6 T, I& w5 o0 F" R- y10) Rosenbrock1 R7 C% O4 P* p4 h9 f
11) Schaffer f6 9 ?) N" ?0 _5 s! Z- }2 E1 o4 b c; u12) Schaffer f6 modified (5 f6 functions translated from each other) ! u! @6 y# u6 d7 k' B) K' }' N13) Tripod % W* x% L% h, [+ p$ y" g7 C8 z6 b# ?. C' r, B% _
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):9 B' h3 T) K* }8 Y/ i1 J [& a
14) f6_bubbles_dyn) Z" C3 _+ e* b( p0 v- u& t
15) f6_linear_dyn2 Z$ q: G- j( E; N# t2 h: q, ~9 a
16) f6_spiral_dyn& d0 _( E; W. W# a
7 Z: | f- F% F4 J: m , s# r/ n( K$ _8 N" E( x% t' L/ K# i# o' F7 @
** in 'nnet' (all these require Matlab's Neural Net toolbox) % J: V; a! f5 ?( a6 c 2 ?2 f) M2 m: r3 G ~ 1) demoPSOnet - standalone demo to show neural net training7 ?8 ], F" k7 h: }
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this- S( K6 w% |9 e0 C+ h% T/ \2 Z
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize! w9 J1 O3 {2 e
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run 3 V* I6 K/ ^; o! H+ M/ y & @- c+ B% P/ T# Q8 j2 N3 \7 B9 O% p: M' g& ]) Y9 y