PSOt, particle swarm optimization toolbox for matlab. * i4 }, ^$ _) q; ~6 d! |5 a " n$ S5 D) z3 `+ cMay be distributed freely as long as none of the files are # K- E. ]/ s- [) A$ t
modified. 9 P. [) C8 v7 H6 _7 g
8 x) ]6 K+ \. _Send suggestions to bkbirge@yahoo.com + @/ K' n3 g4 Q3 U
/ V! i, G- I4 d T8 y
Updates will be posted periodically at the Mathworks User $ n* Z; l! G0 V" d q7 U0 t
Contributed Files website (www.mathworks.com) under the # t: E3 U3 i) ROptimization category. 6 I2 t$ K L& I. w* C* m% s7 ~% O6 w6 j2 O7 V
To install: + f! l4 ~/ F9 Z ^: ~% S8 GExtract into any directory you want but make sure the matlab 4 g) l8 v/ _# W7 h) Z" H0 J
path points to that directory and the subdirectories 4 w1 c. L" K5 ]& w'hiddenutils' and 'testfunctions'. / O* E' e3 J" x5 F# J ?& I9 u* N# k k/ t; y' Y( E7 t
Enjoy! - Brian Birge5 B# G$ g9 m9 h8 s* P# L" u* N
' [/ @: J. t7 U3 G. L; ?4 o------------------------------------------------------------- : m% c1 q5 V; i3 a t------------------------------------------------------------- % ], U2 U: W5 r: z& o % s. {) o" b, L' L g$ U+ ] RINFO . J% V! L. C. n* ]2 rQuick start: just type ... out = pso_Trelea_vectorized('f6',2) - m: S C N N
and watch it work!' M; K F2 p! K3 e. F. x
. y4 h! D0 @ q
This is a PSO toolbox implementing Common, Clerc 1", and 9 u R- W4 H, H# ETrelea types along with an alpha version of tracking changing : u1 S: `0 C2 S8 B. V/ \1 Q7 }environments. It can search for min, max, or 'distance' of # R8 j) ^8 \7 |/ ~/ Euser developed cost function. Very easy to use and hack with ; \ T$ u. T4 \2 kreasonably good documentation (type help for any function and 9 `: }( s" e( e" r' ~it should tell you what you need) and will take advantage of 9 V1 I$ H8 n+ \
vectorized cost functions. It uses similar syntax to Matlab's - t+ E: U" f7 h6 V# _) Q' C4 yoptimization toolbox. Includes a suite of static and dynamic : k! L( B9 i: u2 f, p4 A/ Dtest functions. It also includes a dedicated PSO based neural * Z# P1 Q3 |9 O: o* Z+ {! ?- bnetwork trainer for use with Mathwork's neural network toolbox. 1 W4 ] @, e" R! U" t# F 8 e, E) l v$ f2 A5 YRun 'DemoPSOBehavior' to explore the various functions, options, 2 N" V, Q" K2 e4 X6 B8 F. w0 mand visualizations. : Z2 ^7 I! V8 B5 `2 N \& Q4 t& }
3 W* o. I$ Y- P" N4 J7 H% v7 l
Run 'demoPSOnet' to see a neural net trained with PSO 0 T5 I) i: ?) h(requires neural net toolbox).7 V1 z6 D. I# d1 n3 N3 x
$ ]4 @7 S$ b% V/ @/ Y$ M1 }8 Y. z' f. ?& n/ t8 E
This toolbox is in constant development and I welcome ! B1 h- J7 _+ b- E5 C' f
suggestions. The main program 'pso_Trelea_vectorized.m' lists ) S2 f) E. K! A% A9 {, p
various papers you can look at in the comments.) L/ z: A% Q+ ~
5 F( S9 n" t: ?4 o2 _
Usage ideas: to find a global min/max, to optimize training of & b. C) L6 u2 L) Hneural nets, error topology change tracking, teaching PSO, - c2 r) M3 ^3 O4 b3 B/ p' W2 ^& P: b& K/ r
investigate Emergence, tune control systems/filters, paradigm 5 S3 _5 t' {% F+ u( G& nfor multi-agent interaction, etc. , I o# A- j/ A( U, d" Z4 a/ T3 `; q" X
-------------------------------------------------------------+ [8 x* u3 e e
-------------------------------------------------------------; B6 ~/ @6 ~" d; l! \
6 B1 A, l; S/ L' f
$ n6 X- [* c& w/ m% U4 g" ^" {
Files included:/ q, `$ V! O; M6 v
! r5 {" k( B4 ]: Z8 k0 `) g6 L
, N% c* S* n* d- f( b+ ?** in main directory:% ^% l. J7 A, T: k" i# o; N) y
4 f: r+ \3 w3 U: S i- f: G9 A
0) ReadMe.txt - this file, duh. _8 ?2 o+ u' ?- A) i6 e/ Y+ E
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO; D- w# S1 n: r- R, L
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called ! n$ y" y+ e( [( k- s1 A3) 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& X( |& m8 [ c/ Q9 q7 G) h
4) goplotpso.m - default plotting routine used by pso algorithm- ^! _. P4 g3 W7 d& M0 s, j. V. w
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.- \7 T0 y2 q4 z3 J
\2 Y d6 h8 k F. V
0 i3 k& n# _7 I4 j* s
0 p' S: V) v. |* a* W* @* C** in 'hiddenutils' 7 B) e- B- q5 a0 f 0 N2 l" {6 O7 Y- Y" ]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 t: Q) P' P: k2 u* w3 b
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible $ o9 N) q( z( ^) I1 k* x2 R3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory / S6 q3 ~- Y' v; J6 d! p3 r" @2 B* E5 q5 K9 G- D
7 P+ J. V( a2 f5 p: B6 u7 }; k3 L {
** in 'testfunctions' % e0 Q; o3 T3 \) I! U' Y/ t+ K K- j3 `2 y
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:% S% x1 r* F' f% |8 E
+ K P7 D, ? @
Static test functions, minima don't change w.r.t. time/iteration: 4 n3 |) [. R: z q' Y1 P6 f 1) Ackley3 E% p3 J7 B# Y0 I
2) Alpine% J* h+ b' J7 s7 [, [
3) DeJong_f2 3 h/ j- i# u$ T. A0 @3 H5 F 4) DeJong_f3 ' L {8 { d" i5 N) {4 Q 5) DeJong_f4! D% t- K$ _4 |8 t- W" g
6) Foxhole * `9 B: j4 M; [; U) M 7) Griewank3 q8 }' H0 h; ]) Q1 J; a6 @
8) NDparabola! K- E# ~' E: [6 @8 x# t6 F
9) Rastrigin y& @& {/ Z7 d$ R
10) Rosenbrock; M/ T, T; ?& v+ @& q5 d, ]4 g
11) Schaffer f6 0 h& M1 q: J, k12) Schaffer f6 modified (5 f6 functions translated from each other)+ K6 q0 V5 q# _4 {8 W2 W- r( w- E
13) Tripod: g0 b# _$ W3 l: J( n
+ N4 L m5 p4 Q% t2 Y1 X
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): ' V% e! g' H8 i14) f6_bubbles_dyn. e9 J2 i i, c0 N
15) f6_linear_dyn 9 g9 L0 C. q) T( i16) f6_spiral_dyn' v2 E9 E5 `: C7 S9 k6 N
/ W1 F; N- }* T
, \" q- |5 h* b% I; ^4 v5 j
! ^0 O: A& B+ ]( |
** in 'nnet' (all these require Matlab's Neural Net toolbox) 5 Y4 l% C4 F' k# ~# Q9 Q 7 T4 ^3 l2 V1 T3 T# B 1) demoPSOnet - standalone demo to show neural net training9 ?+ [* o9 f! W; F" h8 Y+ U, Q
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this/ t+ [! b4 R4 D% B+ v9 c
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize6 A; H& p; J0 u3 v* ^! [
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run5 }9 L! [# A. B* K) ~! `$ {/ v
* ]4 P: j3 r, \8 _. B; q
$ X8 b* U; g' u