PSOt, particle swarm optimization toolbox for matlab. , j' i' K# E4 V9 s( ]! U& y8 @* g) L9 g. m& y: B/ a
May be distributed freely as long as none of the files are 6 `, w& J2 E6 Q$ U, @% X" B8 Omodified. $ ~& N9 B5 n) ~$ T! f
: e9 }+ E" ~# d+ d; w/ L0 J
Send suggestions to bkbirge@yahoo.com * J9 N2 O! J a9 `4 }4 D4 e # X1 x1 [: D7 B a3 qUpdates will be posted periodically at the Mathworks User , g" u) z3 I" z4 L- _9 ^. }Contributed Files website (www.mathworks.com) under the |- _% j- ?5 x5 C/ o" [Optimization category.- q. Y1 _* F9 `+ H1 Q7 q ?4 W
/ | u2 O4 P) T9 H& i3 H7 O
To install: / s5 I5 f) C6 W+ u NExtract into any directory you want but make sure the matlab ( L5 T( q$ p7 B& c2 [) m
path points to that directory and the subdirectories : Q2 L0 [& u* t: N& H8 D
'hiddenutils' and 'testfunctions'. $ V. l4 Q7 L2 B
5 @/ H: k6 q( y9 @
Enjoy! - Brian Birge 5 R9 H1 X1 |0 S; @8 t3 o3 G 9 D9 Z! A4 y$ R7 f6 L5 M/ O, {& C; x------------------------------------------------------------- ) A- A* D0 r' Q+ `------------------------------------------------------------- * q+ ~9 ^% N' ]6 t; Q; o " L5 Z7 [$ W+ n: F. q; jINFO / ?& P l( z# c& Z3 y0 l' z" DQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 8 Z e; F* o& s# i7 d+ land watch it work!! V4 h! a* M( R; N% @
: {# ~* d2 i+ @) D2 {9 ^This is a PSO toolbox implementing Common, Clerc 1", and 0 [/ s1 P4 g! ?; `4 n5 q, _5 G4 q4 k% qTrelea types along with an alpha version of tracking changing5 b9 O9 H8 H& e0 G
environments. It can search for min, max, or 'distance' of ; J+ ]9 }; U9 c. f: g9 wuser developed cost function. Very easy to use and hack with 2 y$ p/ X/ j( r# O! V1 R6 `reasonably good documentation (type help for any function and1 F! j' Y: g& d! T5 P' E. ]1 d& V
it should tell you what you need) and will take advantage of 3 x& L, m1 w) C7 Fvectorized cost functions. It uses similar syntax to Matlab's' c; |9 }5 c) G) r7 m5 \5 X+ R
optimization toolbox. Includes a suite of static and dynamic % D# J4 ] f" z4 U
test functions. It also includes a dedicated PSO based neural ' E7 |; X7 m% W$ Ynetwork trainer for use with Mathwork's neural network toolbox.: W5 j3 q8 T1 f6 `! l
[0 E+ l7 P1 |3 `9 Z. LRun 'DemoPSOBehavior' to explore the various functions, options, 4 K; v/ x! [- F1 [' K1 @and visualizations. 4 i& X; J+ M/ b
, v! ]; n& ^2 W6 |: q% pRun 'demoPSOnet' to see a neural net trained with PSO 6 A, N/ {; B5 t( N
(requires neural net toolbox).! U; P: |( O& e, o" X
* {6 q5 ]' O) \ R* V+ q1 a3 i" [2 E# B( l
This toolbox is in constant development and I welcome ! M; B" E. g& e/ c. q* _
suggestions. The main program 'pso_Trelea_vectorized.m' lists " X+ X W$ v% t1 H+ b& ~6 Yvarious papers you can look at in the comments. 3 ]+ E- g# B9 b6 {* H% r + C% ~& A; E" G% y g( X, [- I! QUsage ideas: to find a global min/max, to optimize training of - m1 U3 |* D B, |. Eneural nets, error topology change tracking, teaching PSO, 0 g6 ?, M% o& a! [ X* b2 K9 e
investigate Emergence, tune control systems/filters, paradigm 2 V: z5 o) d; ~* s/ o- T5 Sfor multi-agent interaction, etc. " B4 m$ u" p% E: X4 e" D$ d4 h2 a+ U; ~' X- n
------------------------------------------------------------- & { Q" t# u& N3 Y: [7 n; i& B------------------------------------------------------------- 1 T; v' i' a$ Z" [ 6 X9 \7 j8 n6 D : X+ A% k4 F+ H2 d, i8 wFiles included:/ ~4 a6 x2 F3 X" x3 j S/ c5 P
; j7 }% U3 O$ j4 b7 n E; p0 ?- N9 q
** in main directory: 3 P+ b) T* q. j% r , n& [1 h$ M: Y, N0 B& e' \% S. U$ B0) ReadMe.txt - this file, duh1 X3 m- ^9 n- I2 n* D
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO! _, `8 d0 T! _/ H; ~% M) o
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called & O7 x- S% k7 ` O) V2 J) n( b! Q3) 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; G& ^( U6 m: ? ]$ S6 v, N
4) goplotpso.m - default plotting routine used by pso algorithm ( P$ l$ U+ v$ P& u5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.+ j9 C4 K/ `: L
& Z( C0 u; C0 i+ S8 K) b( {9 o7 s! X3 I
7 W o' q% c5 L1 V5 q. y** in 'hiddenutils'- Y6 i1 b* F, A( h O* F& M
5 i+ p; u y9 F4 t1) 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 Q% `& d; _/ S2 V! I$ ~2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible' }2 S$ N5 x" f7 y3 n2 V
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory# `' ? [# S1 s& I9 x
& S. V/ e% b$ I2 r$ S \7 y4 M. X
# z9 _0 D# z% U3 g9 H- _+ r% e9 n0 X9 x
8 {: R) Q1 K" D
** in 'testfunctions'3 J+ k9 B: v0 P6 `3 n* [3 O* G% H
4 s- S0 G2 I. h( ~9 Y: y
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: u* }& g+ s% S9 ^) Y) e& R 6 ~0 `5 `7 F& c3 ?2 t1 {Static test functions, minima don't change w.r.t. time/iteration: ( ]( I8 o* t' @- E8 h 1) Ackley 5 D2 D2 Z/ [) N( i1 F1 c 2) Alpine ; p6 n7 X" @+ v6 B( _% K1 i 3) DeJong_f2 % `7 c$ a9 u/ t' `1 Q8 n7 ^- u 4) DeJong_f3 / b5 b+ `1 G3 |: h& V 5) DeJong_f4 $ D! N+ R' }+ l* r4 h. ], H 6) Foxhole. S: Q0 g& c8 D' r
7) Griewank 3 B1 t5 s% Q, i# Y 8) NDparabola ( }% `% G8 @6 Q) x+ l8 z9 p5 e 9) Rastrigin" B b( @4 ^" `
10) Rosenbrock . _6 H0 H9 w% A; ]' j0 d7 k11) Schaffer f6: n6 r& a; z0 m5 _8 t" r
12) Schaffer f6 modified (5 f6 functions translated from each other)5 c& u8 ~/ T/ z
13) Tripod 7 ? l4 n) Y$ U6 @2 ?: g/ E' U, w! }7 E; }* B$ }1 Y
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 5 V5 P1 ?+ Z$ V14) f6_bubbles_dyn ( }; B) A3 s: |15) f6_linear_dyn + r. F% V: Z8 ]# Y! {) F& S2 ^5 c16) f6_spiral_dyn 5 v/ S! P" @, O; F) y6 ?; W, q) J 5 _ r1 V+ M! h, h# I2 S- a. f1 P# f6 Y0 g+ F& y8 }) p' |
$ o, O" P- [& i& m+ |, F* U** in 'nnet' (all these require Matlab's Neural Net toolbox) 2 }" m* M" C% F3 c ' H' ]3 M; ?3 `$ p0 | 1) demoPSOnet - standalone demo to show neural net training# }/ o0 G+ S; e/ h6 T
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this , z; w/ Y. j/ K; E: j2 o4 |4 { 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize2 h. N8 B2 x! Z2 O' H
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run $ i( R# K+ G2 G7 o9 O8 x, f ; }/ |( u4 t5 o: }$ o, j8 q7 t" A6 ~8 d+ N4 S& H. e