PSOt, particle swarm optimization toolbox for matlab. : V" ]: E; V6 Q% s4 @+ |) H- p" H7 s/ J) b5 r3 g; I
May be distributed freely as long as none of the files are 2 U& T% j a, Lmodified. 7 A, M, ?! C0 n6 w) w. V " K0 d7 R3 j6 ?/ V3 x8 tSend suggestions to bkbirge@yahoo.com ( A: C% D; f0 K/ ^
1 f: u$ U' m( f( i
Updates will be posted periodically at the Mathworks User c( L/ Y- j2 K: d; \
Contributed Files website (www.mathworks.com) under the # O& C( I: n# v" yOptimization category. ' K! `3 m6 R) ]+ j2 ?8 T: i3 `- n ^* A# P/ e+ I$ q0 F3 n- e
To install: * i$ b% Q7 G& H) b4 {Extract into any directory you want but make sure the matlab " s$ Z ]3 A o( U
path points to that directory and the subdirectories ) @7 t" P- _% E7 ]'hiddenutils' and 'testfunctions'. . k) {+ z4 m7 b' ?6 p9 B. t. ~
; `8 G6 p' ^0 x3 f; W7 P5 R. D6 V4 f9 J
Enjoy! - Brian Birge - V C V2 C$ K( S; t) p9 g. d9 [* k3 V- C" _6 O
------------------------------------------------------------- - m6 U* F% m: U-------------------------------------------------------------, R) r4 T1 d! V; T
2 h! M0 S. ?! I$ N, N- C
INFO9 f: a0 V* o; `3 j0 [4 r4 l6 _) o
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) * ~9 h0 t7 D2 |3 G
and watch it work!/ Q m6 X+ a' g: }
" e8 F/ ?$ V @. qThis is a PSO toolbox implementing Common, Clerc 1", and - N0 P2 c5 P1 H; ~" I' E
Trelea types along with an alpha version of tracking changing3 ]4 l6 N4 c3 N( J/ b
environments. It can search for min, max, or 'distance' of * `! D) m# e/ J
user developed cost function. Very easy to use and hack with 4 l) P, S7 n' \2 w; t/ A1 Greasonably good documentation (type help for any function and # d6 s( ?& \3 tit should tell you what you need) and will take advantage of . F* B/ q+ X% C$ _
vectorized cost functions. It uses similar syntax to Matlab's + V: v4 M3 {* j. x) @3 q6 R) K% noptimization toolbox. Includes a suite of static and dynamic ! I; O- x8 ?$ ]" o9 u0 H! w
test functions. It also includes a dedicated PSO based neural 5 o1 {& U9 c; ` u$ U' l
network trainer for use with Mathwork's neural network toolbox. 9 k: ~. r& l, r( _$ H, M+ u 8 x! G$ T4 z5 i1 yRun 'DemoPSOBehavior' to explore the various functions, options, x$ |" h' t$ ]( E( f' band visualizations. % f8 i7 O! e2 i% _
- s/ z# {: O* ~" z0 n: D
Run 'demoPSOnet' to see a neural net trained with PSO / O+ |6 C# q8 W6 Z(requires neural net toolbox). I. T* G' r. \6 }
. f; G4 b) M1 \6 `) M- [
5 G) i- B: _) \+ O
This toolbox is in constant development and I welcome 0 @& d7 S" t' ?! a# f+ H4 j _$ osuggestions. The main program 'pso_Trelea_vectorized.m' lists ; r O! Y: O4 u! | e! @
various papers you can look at in the comments." V+ ^2 }% i$ D* h! M
2 [9 i$ @. |9 |8 d; a: sUsage ideas: to find a global min/max, to optimize training of 3 Y. K5 H$ Y! H8 L( Vneural nets, error topology change tracking, teaching PSO, 3 T3 m |/ E l$ S* h- C# \investigate Emergence, tune control systems/filters, paradigm 5 T" ]: ]5 i5 e) b# ufor multi-agent interaction, etc. ) r h& y" X) } L! f* { * s' d! H' f$ S& j H1 X2 t------------------------------------------------------------- " n! Z* j0 C( b& b------------------------------------------------------------- 2 _, N1 _- K3 d) U- D6 A$ H! g$ W' D8 g5 y o1 @
- g- S$ W% y- Q. J) N; B0 n
Files included: 0 Z9 b5 ]( `6 c w1 L4 u; P" b6 h- F, N$ Q3 u3 d8 G8 I! i; v
0 q) [$ ~7 ?, _* g: _
** in main directory: ; u m z9 y: _( ?& X9 u4 g; b( U. T2 A! _# t
0) ReadMe.txt - this file, duh I; N3 C( I$ o$ d1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO + ^8 R& N4 n" B2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called6 |. ^0 c1 d9 P9 o2 t
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 : }7 Y% V: r* W3 |8 O4) goplotpso.m - default plotting routine used by pso algorithm7 B B8 a. `0 l4 v z1 |$ A7 _* `
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.& \/ r# N3 b- Y4 F7 I) A5 m, e& i
1 |1 o4 v# ]' r, T' Y3 a4 G4 ]4 v& W
. r5 H: g h. }$ ?* D) }** in 'hiddenutils'* h+ t# e0 ]2 p9 q3 G
3 y' A5 m3 g$ ` Q8 }; n7 Y" l
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 2 L9 n3 Y! p5 O2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible7 P5 {0 _1 R6 g% p
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory % Q* |5 n- C; X2 g: j& O 3 h1 s9 }6 i0 E8 a8 K! P. D% W0 k) k" }; t5 m6 f) W& M
, z+ H! b+ i4 S3 Y** in 'testfunctions' - V0 C( F- _0 c0 f 2 g5 @+ S7 h, [5 I9 w! ~6 y, }) cA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:2 w. {: u# }) B
+ }2 {7 Y# a% l8 C# p0 T1 w
Static test functions, minima don't change w.r.t. time/iteration: - N: m1 i, C+ m# M2 y @ 1) Ackley # n, U6 l, x* X5 ?1 I4 w 2) Alpine2 G& v3 X* D' e+ b
3) DeJong_f2 $ W5 V) l: n0 L6 H d5 W 4) DeJong_f3 7 ]$ a5 `# J/ E4 b) D 5) DeJong_f4' ~% W0 Z# C! F4 Y' P! j. ]+ M
6) Foxhole + P9 I& }+ k# p! Z; g& c ?0 P8 _ 7) Griewank 4 S# J5 Y7 d5 g! _ 8) NDparabola ) v3 C$ [: w0 I& m/ H/ M3 b 9) Rastrigin ! x, }$ T! _3 ?8 v- w10) Rosenbrock& `2 i D& T5 W: e" q- [: P
11) Schaffer f6! r& T: b8 |+ M# j* p8 u. i
12) Schaffer f6 modified (5 f6 functions translated from each other) $ [4 r$ C9 P2 X+ d* u13) Tripod( s* n6 g+ f0 p) x( B: ^
. e# G; d T x J9 @7 U- p1 kDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):" R4 W+ Q6 _6 x C5 i
14) f6_bubbles_dyn: |; s" F" y9 D: R, ~: n
15) f6_linear_dyn1 M% g. f! r# l! [$ ~
16) f6_spiral_dyn 5 K# N- h& R8 E( z$ r) z- `: G$ Z5 a6 W. K! B" c) M
: N7 g; r+ q) m& _$ J: _2 i( O8 _' U# G
** in 'nnet' (all these require Matlab's Neural Net toolbox)! E5 R: H7 h s. k* `
+ z8 z- f$ A/ Q0 K$ I$ p- B 1) demoPSOnet - standalone demo to show neural net training8 e4 g7 M: f9 b* ~; }3 ~
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this : X) C7 h+ Y: S/ `. K9 J% m 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize " d6 r; o' S- D% G6 a* w' o 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run' ^6 ^" a( Y) o9 I$ R {
* R8 y- g/ }, l- Y4 U2 ^9 t