PSOt, particle swarm optimization toolbox for matlab. 6 C+ f8 ~1 ^- V2 O& o- m$ B9 W 4 b6 ^0 M: A4 C7 EMay be distributed freely as long as none of the files are 7 L) G8 y5 J, E0 S$ H
modified. 9 e& W' n, i1 _0 w0 L
# E2 r8 _2 j8 p' s6 L2 L5 |
Send suggestions to bkbirge@yahoo.com 5 B+ |) K0 C6 D( j8 @3 U3 r
% e. g: R9 I' Y" B
Updates will be posted periodically at the Mathworks User 3 l$ I9 Y! t( @# T% F% B3 JContributed Files website (www.mathworks.com) under the # E, h2 H3 B5 c! R E8 w
Optimization category.) b1 h- z% T1 Q1 h
% w; v# U% C* x3 ^
To install: ' A/ m% P- e6 ]# `Extract into any directory you want but make sure the matlab W1 e( k3 u; `+ z: i% x% N0 n8 ^8 hpath points to that directory and the subdirectories ) T! |0 r; J3 c. Z2 w; Y/ I4 m4 U4 ]
'hiddenutils' and 'testfunctions'. 5 ~7 M: [ S1 \$ C& q- P6 |( c3 p5 [
0 k& |& v; K! q4 S+ ~
Enjoy! - Brian Birge4 ?7 u( l+ O# ]5 s; ~' a. ?
# T1 A2 C2 ?5 ^/ ]) @-------------------------------------------------------------& e! N. l# C6 ?' p k+ Y0 z: R
-------------------------------------------------------------: U( r# O. x- k$ P
; s7 X3 [; `8 z7 ]INFO / d! H9 I G8 K) w# g5 \# |, f- |& hQuick start: just type ... out = pso_Trelea_vectorized('f6',2) ' ~* J9 T) [% v4 _* m1 k. Qand watch it work! F$ T- f) M: f1 B, A0 \
7 p' t" ], o7 H2 W4 F" x( sThis is a PSO toolbox implementing Common, Clerc 1", and & z( }4 O2 p2 {4 h0 z& W
Trelea types along with an alpha version of tracking changing* c* A6 i$ _1 A
environments. It can search for min, max, or 'distance' of 2 E' H' Y2 f/ q. Kuser developed cost function. Very easy to use and hack with % [ {5 \' Y# Q9 v1 v( ~reasonably good documentation (type help for any function and _$ l3 }' |" w- {- |it should tell you what you need) and will take advantage of / A9 x& M! ^; h) F/ A& u6 `) mvectorized cost functions. It uses similar syntax to Matlab's* i- K( ?0 O& E2 p9 M% w
optimization toolbox. Includes a suite of static and dynamic 0 J3 y. H9 V# G$ P. M
test functions. It also includes a dedicated PSO based neural , c c3 h" F4 n3 X3 [" U
network trainer for use with Mathwork's neural network toolbox. ) w6 G: p" p0 f7 ~5 F& T. }2 Q+ Q/ _; e6 e- Q
Run 'DemoPSOBehavior' to explore the various functions, options, , T* m" E( o. z; V( K" A3 @4 T
and visualizations. / O5 e% |. K9 v6 B5 S% D( [% d7 ]/ j' ^8 o
Run 'demoPSOnet' to see a neural net trained with PSO ) U9 o3 V+ F! G4 w5 W(requires neural net toolbox). 3 U; V4 X: U1 e7 a6 g& l; ` 0 V8 F1 y8 a" [1 k! q; l1 D: Q2 s0 n
This toolbox is in constant development and I welcome * t8 |) D% s; D! [1 q- D
suggestions. The main program 'pso_Trelea_vectorized.m' lists : ?: c. _5 ~2 t8 e' H$ ~
various papers you can look at in the comments. 6 k5 @' w" Q: S/ N9 e1 O0 I1 a6 o 4 y7 w9 a7 U8 ~6 Y- ]4 k; ?Usage ideas: to find a global min/max, to optimize training of 2 q8 B, X. y" s; N( f
neural nets, error topology change tracking, teaching PSO, " ?, j8 r4 c9 F' T$ U3 ~3 r+ l. binvestigate Emergence, tune control systems/filters, paradigm 6 K' Q8 H" j, k% d7 O6 ?7 D( Ffor multi-agent interaction, etc.$ g: H0 ~' F% X; y
* k* T2 q% e& S! }/ N* F7 }-------------------------------------------------------------" _) I& E# Y; Z2 a6 o# q
------------------------------------------------------------- 5 [& G4 R1 U7 T9 e& X" z! g# ?2 _* z4 {( h
7 o; n: f; y4 Y
Files included: 8 y1 [ t! t6 S) U R' W, C& |/ K0 K & x- `) g1 O! w6 m4 t9 Y* l; a0 T) G: r3 f
** in main directory: & _; x5 ^* A+ q. w' [- \/ ] 1 N2 B6 N' a) F/ t; G; u! i0) ReadMe.txt - this file, duh 4 o X. e9 l" a3 d* w: t* x. d1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO& [5 }6 C1 e8 _) b: |, n1 z: o
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called - u: w7 R% v5 W! _# R3 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 * {7 F- ^4 ?4 i; G# F4) goplotpso.m - default plotting routine used by pso algorithm ( Y% V- N7 K g$ V$ O( b7 g7 F5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.2 o% [# b' b' k: ]
- i- A/ C* }+ F- o
2 I! z0 Z% }9 R9 V+ m8 g 6 i3 n: r0 N. `: ~** in 'hiddenutils'$ A! j& f; {! H! n, ^$ d. c
# \2 m4 m* v3 o) f- s @
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 0 Q. T) @. s+ F7 Z7 q/ q2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible" W9 c) S4 V# E2 D2 b% F [0 L. e
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory ' Q; r; @, B$ r. n; X" I+ h8 o/ D& Q 9 ?: g% k2 ^3 H" z+ @# ]2 Z4 b$ d u% ~' E1 l
; w$ _8 W; ^. l' Z3 a
** in 'testfunctions' ( ~' Z W, x [7 m 5 C+ z! }+ w8 B2 ~. V0 LA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:/ ~+ r0 r5 v: W
7 P% _( {; l9 p' ZStatic test functions, minima don't change w.r.t. time/iteration:# x. a* e2 [) H, g8 @3 H& C) `7 m
1) Ackley! y) _6 Z" x7 r" m8 Q z/ L! W6 u
2) Alpine: w. Z' e. Q) k! `- H
3) DeJong_f2* j/ {- I" @$ m+ m( C7 O
4) DeJong_f3 # m0 _9 i: v4 N: `7 Z. z 5) DeJong_f4 ~* K2 V' _+ u 6) Foxhole+ Y2 t& q1 Z) r' P% f# Y
7) Griewank / I1 B; z! _& W5 ] 8) NDparabola: l' m7 i- ^/ a. `$ J6 ]# _! B
9) Rastrigin 6 V6 D( h# L" t4 ?; W& ^10) Rosenbrock* C* n) |! B) a
11) Schaffer f6 5 w: J b+ L! W+ P F. J12) Schaffer f6 modified (5 f6 functions translated from each other) 0 T( [4 ?' Q- \: V$ \# }& |/ Y13) Tripod * r1 z# d, S( h# F/ w5 _* y% \0 f" E! _* ^5 ^5 O
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 9 M" E/ _# Y& T3 ~14) f6_bubbles_dyn : @! s v- M3 y+ [15) f6_linear_dyn( m0 t2 m+ O6 Y: A4 k
16) f6_spiral_dyn ; d& y; h: c% N5 ] ; O) A! w+ o ]% a1 X' t4 p , I* x( t0 {# y2 b' x, o5 Q 4 G( p/ o4 ~6 T/ o( p! |0 T** in 'nnet' (all these require Matlab's Neural Net toolbox); p6 a& f& o" I8 G3 G
~: L1 g- A+ c; v 1) demoPSOnet - standalone demo to show neural net training , t" Y7 A$ s1 B- Y 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this# X: H: U5 |% I# a& D: b3 O
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize , N9 o! R2 r1 W 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run ! P! u. t2 z, n; T) d) i) M' E1 X9 ~2 K; N0 w