PSOt, particle swarm optimization toolbox for matlab. ; S& E" s, \2 b# L, G2 i U c F7 c8 K8 [2 q4 t4 MMay be distributed freely as long as none of the files are . u1 R4 |, v& i0 `+ qmodified. / k) Z0 `/ f0 D* L: \7 p5 ^ 7 |* X" p ?0 S# BSend suggestions to bkbirge@yahoo.com 3 o" F7 r/ X) s. J) P
' U8 _: n0 H1 |7 ~ J% _" l, cUpdates will be posted periodically at the Mathworks User 6 r) v |5 y+ T: ^% jContributed Files website (www.mathworks.com) under the 8 d& F+ z u! @& G2 gOptimization category. / k$ v7 ?0 }; ^) O$ N" g" X% [- j9 }; E+ B" \
To install: & o% E9 f+ q% k J" `2 G- f- tExtract into any directory you want but make sure the matlab - X) [8 v6 G* bpath points to that directory and the subdirectories 8 T) w4 z: I( J" F( t/ Y6 O p1 m
'hiddenutils' and 'testfunctions'. * N4 o! K1 s* J, @, m4 J7 U. I* g: ]! c8 z
Enjoy! - Brian Birge 3 P8 u/ R3 |3 c+ N. A4 F [7 E6 }4 g& @-------------------------------------------------------------- }) u% A6 N" }: ?+ c; w
-------------------------------------------------------------) R) ~+ r7 W3 `$ J
8 z- j) u( \; S' J; X9 h6 A
INFO $ m7 |6 y. v) f: z! B( I$ b& qQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 2 ~- P2 b+ |4 R+ g8 a* Zand watch it work! 7 B9 j* B0 W+ S) z 5 `# E) @2 _- s, e! H OThis is a PSO toolbox implementing Common, Clerc 1", and . V+ X! E6 ~% z, Z' [3 M7 X6 P# |
Trelea types along with an alpha version of tracking changing & v+ F4 c; R1 y! d7 l# xenvironments. It can search for min, max, or 'distance' of $ n* [2 [# P' H" C' T! [) p8 o/ n: l
user developed cost function. Very easy to use and hack with 3 U+ k( E- t: @# a/ d
reasonably good documentation (type help for any function and ! Z; E; @% I4 @" ?# K e: I$ Zit should tell you what you need) and will take advantage of + g$ N! M P/ z: f* r$ \vectorized cost functions. It uses similar syntax to Matlab's 5 }9 ?5 g2 R$ {$ [$ @5 l9 L3 ioptimization toolbox. Includes a suite of static and dynamic 4 B- y; k6 @1 B+ C$ f
test functions. It also includes a dedicated PSO based neural 5 m+ e" R/ d3 @6 A. [
network trainer for use with Mathwork's neural network toolbox." u' e* L; K1 d& h) d5 U9 C
- J7 A( ?, G. Z" C
Run 'DemoPSOBehavior' to explore the various functions, options, 1 x: P# b% a4 @9 [4 c: N$ A; M3 L* C4 [
and visualizations. ( y7 E* @5 s+ P: Z5 _( ~! X: d/ H ' I* P6 b u) ~1 y, w3 gRun 'demoPSOnet' to see a neural net trained with PSO 6 v9 X$ \; I- Q2 Z: k/ B" y' B(requires neural net toolbox). 4 m% P# u: s( c; ?8 D( I- s* G2 I$ W% V3 j6 Z% C2 Q }
* t7 i6 v2 c; l$ s4 hThis toolbox is in constant development and I welcome $ _/ c% D6 O$ i9 r' M: Fsuggestions. The main program 'pso_Trelea_vectorized.m' lists ' C5 L* G! { W
various papers you can look at in the comments. / \+ q0 ~" j; M7 k; A % ?- `3 @$ Q* t* I9 z5 t8 G; G( oUsage ideas: to find a global min/max, to optimize training of - A \- C K) a6 x% W _" Z* N
neural nets, error topology change tracking, teaching PSO, + s) G2 Z/ F* e; F: P7 k3 z' A, ]investigate Emergence, tune control systems/filters, paradigm + x" j8 p1 S+ D3 w
for multi-agent interaction, etc.5 b. B3 V; ^' Q; \: o3 h, M
2 m; U' a+ s4 F0 m. q& G* n------------------------------------------------------------- & ]6 ], T5 d/ B2 f2 m1 ]------------------------------------------------------------- & O- }6 Y1 k/ [# Z- Z 2 `& a: P1 S1 y# p ; y5 d( U" j3 R( N3 d0 A) h# lFiles included:; O: Q. X7 b1 s) Z/ U
9 y% x @* W0 q% z0 L7 K1 j1 V* A3 h) v: h8 i' V
** in main directory: $ F( X- P0 F* Y. N+ y4 X0 K% n( f ) t, x& @% \3 m( x4 d1 W7 L( {9 y* U0) ReadMe.txt - this file, duh( p: ]- J" J+ f3 k8 R
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO2 Y. L! Y, a( `2 H: o* x
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called& v: Z) v# ]( B p
3) 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" k! Q- O0 Y2 S) J. q& d& ^$ a( j
4) goplotpso.m - default plotting routine used by pso algorithm4 s5 G. d4 o& Q4 Q
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.: F% y& J( m2 ?3 n8 E( ]/ H
# |' g7 v. R U' \0 T$ ~. B' \+ \ z8 Y. }8 q ] v% \
8 D. }5 Q7 j+ m) ]9 a. P** in 'hiddenutils'4 `7 B2 d, @+ v1 G
& `0 _5 s3 `/ Q0 P) q ?3 h+ C! o1) 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; b4 {6 E0 M0 f2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible 2 v: R, D+ a5 ^' b" z/ e3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory , Y2 P! h1 f6 T3 A* E6 d9 h& B1 w6 r% t
, e; L. c( C+ z: |7 K" p2 J" M$ u k& n1 l3 ?% a- o: F7 T
** in 'testfunctions'2 P; o" V0 q2 ]' C p8 _
6 L, S+ ^- A5 V$ c2 b% ?5 iA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:7 I- S, |' E2 N9 T7 F- Z
$ O8 c& b2 F/ @5 zStatic test functions, minima don't change w.r.t. time/iteration:$ A( v( z6 ?9 F
1) Ackley; ?, ]2 n- T0 x
2) Alpine " X% C" B- \$ U* w 3) DeJong_f2 6 A& Y3 n2 n+ f4 A3 D$ N 4) DeJong_f3( H; O, c' W6 b6 |1 q0 t; I
5) DeJong_f4 9 H' ~. S- a: U 6) Foxhole* g' i9 M D' |5 D, @
7) Griewank k) k' P2 C( U 8) NDparabola; u; p0 e8 | R
9) Rastrigin2 E) q" `" G& O( ~& I
10) Rosenbrock + D G! M4 m$ E2 v6 N11) Schaffer f6. l3 @3 m" x( a
12) Schaffer f6 modified (5 f6 functions translated from each other)+ V" [0 \% i% ~) u
13) Tripod! t* Q$ L% i {
- U- Q; T; m% C/ n8 w; g0 E8 C) P
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): ' o- ^% |* {3 X; |1 T: s# U4 K14) f6_bubbles_dyn3 j7 `3 a, t0 ?
15) f6_linear_dyn ) q$ I4 u4 {) J1 j16) f6_spiral_dyn 0 g9 Q4 q& j" ^8 @ F: o 6 C/ G/ L& @- m5 @; P2 R5 U8 Y2 R% U& j3 S9 R5 q4 b ?7 R' X
% b# _2 m/ F3 D" ^7 m
** in 'nnet' (all these require Matlab's Neural Net toolbox)( r% G. t8 Q1 W: S1 {0 h
4 a2 V4 `$ y2 k0 W
1) demoPSOnet - standalone demo to show neural net training; ~$ D) B- n _& o& W8 R- v1 O
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this+ ]4 j( r& H X5 x6 f: r/ i1 f
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize. | W, d; A1 t. x; e3 ~. x" {7 ]
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run3 N! x7 y5 b- H+ ?7 L1 t
4 A3 i" K4 Q1 ?& R