PSOt, particle swarm optimization toolbox for matlab. * k- J2 K& S, Z$ }0 s! q1 ? k3 M3 T# E" Y$ X% w1 M& X( s
May be distributed freely as long as none of the files are 5 g ]9 U/ x/ }; O9 L6 E" R) M
modified. 2 ^! h7 F+ x( {/ |9 Z6 C, Z" d
* r) G) O3 ]. @$ Y: F C
Send suggestions to bkbirge@yahoo.com $ R9 d8 K1 W0 R: ?& D / M3 D' {9 [5 \* QUpdates will be posted periodically at the Mathworks User 7 d) e" k) i7 m: N2 E) P5 H/ j
Contributed Files website (www.mathworks.com) under the 4 G, Y1 g* d, o4 m7 ?
Optimization category. 7 L' V8 P, ?9 M7 D4 I& Q6 y- I! j3 F! f T4 z
To install:7 u$ K3 A$ r# q1 V
Extract into any directory you want but make sure the matlab 6 U% E9 ~. H, Epath points to that directory and the subdirectories , h: a! {& n9 R# j5 O: K( H1 G. f9 m'hiddenutils' and 'testfunctions'. 7 A) o3 {2 M, _ e+ ? & M( D& Y" x: o$ fEnjoy! - Brian Birge ) k% w9 B0 Q& b: v6 c2 I8 j 3 @4 k1 s4 t6 ? j& p, Y------------------------------------------------------------- ) k2 ]$ C3 p& }1 s4 Z! K-------------------------------------------------------------8 w+ T& ]! X7 |" k3 H
. G+ Z. T4 I' T& Y1 y0 N
INFO + E& a+ W0 K) J7 r- v- PQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 4 @- a6 \4 {0 m' ~8 j+ ~ h; N
and watch it work! % O: I) S$ ?! o+ r# y5 O5 M6 J0 Q! j1 F1 b& a2 }; `% o2 m
This is a PSO toolbox implementing Common, Clerc 1", and 4 S6 b6 g# ?' n/ t4 T9 o
Trelea types along with an alpha version of tracking changing% a0 A5 m0 G" l) ?! S1 b8 f
environments. It can search for min, max, or 'distance' of 3 [! w# ]3 p4 g6 A uuser developed cost function. Very easy to use and hack with + M4 i; \8 f0 |- a' areasonably good documentation (type help for any function and# j2 l2 e% B# t5 N1 n
it should tell you what you need) and will take advantage of $ ~7 x7 e+ ~2 Y/ j8 b$ [vectorized cost functions. It uses similar syntax to Matlab's6 j0 Y# w5 ?" G* d( s8 ~
optimization toolbox. Includes a suite of static and dynamic " v! s6 h8 ~& G/ I3 X9 Ntest functions. It also includes a dedicated PSO based neural ! M% ^. K) C1 b8 b- Dnetwork trainer for use with Mathwork's neural network toolbox. # p0 ~ O7 h$ D( A0 J ) S7 e/ W5 v; f. D5 {" j7 B! P% v0 KRun 'DemoPSOBehavior' to explore the various functions, options, ; X- {9 U2 p- }) T9 ~2 ?) J. I( @, wand visualizations. & z1 }4 X3 B" B( j3 O; c. H
- i+ v) l+ W) G* s" @3 [Run 'demoPSOnet' to see a neural net trained with PSO & Y& i/ c3 ?1 g
(requires neural net toolbox)./ x! T6 Y- q7 r, b4 A
2 f+ A M1 T! C3 r) u1 `' K+ V0 G+ ` S {: W2 K" h
This toolbox is in constant development and I welcome , V, l9 f( T" u5 B: i2 S' m
suggestions. The main program 'pso_Trelea_vectorized.m' lists 2 r( A* ]8 \# d8 ~' `3 nvarious papers you can look at in the comments., y, |) ~) K: S, n& S$ g3 C, @
* `7 H" E2 [. `4 Q8 d
Usage ideas: to find a global min/max, to optimize training of 4 C9 l |) \4 n: q6 bneural nets, error topology change tracking, teaching PSO, ) a# r. H i/ I, ~
investigate Emergence, tune control systems/filters, paradigm 8 d7 z5 F$ K, `: _, d2 ^) e/ \for multi-agent interaction, etc. ) y1 k) b$ {8 D/ E* }: ?8 r* s' M1 u6 }5 w# z
------------------------------------------------------------- - p( h9 i) b9 c8 K$ Q G8 B5 `6 m2 ^8 j-------------------------------------------------------------3 {$ A# @7 r8 f
) ]2 p/ p1 K! k) X( w; R5 w/ t+ X- L- p. J2 ^
Files included:/ E( q2 Z/ P, R, \
1 |) p3 g8 T7 s8 b {4 g5 i# v
$ y1 ?. b' n* ^4 X; f
** in main directory: : ?# U6 }# q+ x1 @) D0 m5 W7 ?% Q3 o+ C8 f+ Z
0) ReadMe.txt - this file, duh# z# C( v+ M$ T% L1 `/ D! z9 S
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO ; k+ v5 P. F% i9 ?; M a7 U2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called3 _, E$ W1 z% K8 {
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 lot1 C5 Y6 ]# e! Y' Z% W
4) goplotpso.m - default plotting routine used by pso algorithm Q: y6 d1 H2 t* x8 M& |9 ]5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes./ e( T7 B: s6 }% f. d. F
3 [& c# s. w, T/ \% f* n) a! u( I& j0 v
C h9 p( m. p5 W! I, }** in 'hiddenutils' 3 Q! A& s* y* }8 m g+ Z; X* a: W. O% w! Y1 f9 P, J
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 ; @8 H& ]. H: h, k2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible / M& C2 ]3 m- M' P4 M4 i3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory 5 t# H7 x6 m9 Q& V" J( g6 o/ l' m) |' N0 b
1 {; Z6 a4 Q5 [- b1 T: U0 w
4 I; G# q! t/ {- s0 u# C6 B9 ^
** in 'testfunctions' $ Q/ K4 ?! s$ J2 U6 y z: x ! B& v: N$ a: @6 LA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: R* n `0 n: V4 q9 Y# D/ x- G
! \+ H7 M, w/ c0 R
Static test functions, minima don't change w.r.t. time/iteration: / g; p6 `4 A7 z } g# |" l8 V 1) Ackley & t$ E5 B ]5 K/ j 2) Alpine ! T4 r9 [; t+ z 3) DeJong_f2% S3 B% w. T1 J# Z/ _3 T
4) DeJong_f3 ) _+ Z8 R [% ` 5) DeJong_f4 Q8 E `: X1 V8 z2 N' P 6) Foxhole$ ?. t) s$ j# c! m V
7) Griewank$ p/ [2 a, X' s0 \4 H1 c
8) NDparabola * l9 C% @" k0 `3 @3 i 9) Rastrigin 1 C5 z9 ^) A3 Y10) Rosenbrock: A3 K" F/ I% {' m6 U# M3 J
11) Schaffer f6' E6 s3 m2 C6 n6 a6 x L, @
12) Schaffer f6 modified (5 f6 functions translated from each other) 8 ^! r9 C+ `5 V7 {+ e! ~- ?13) Tripod) h7 W5 V4 T; m3 Q k! v
8 _- f% T- l" i2 G8 |
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):! B# H0 W, r2 |1 w+ j9 z
14) f6_bubbles_dyn, a3 w3 T9 ]: i/ M9 x' i6 H7 `
15) f6_linear_dyn( G% j2 y! |. _
16) f6_spiral_dyn- X; O7 S% t1 a @* w% d8 C# V" T2 F
. O5 z0 D) I) V e7 X2 w
# ]' X5 b* i) V/ E9 s4 \. ~! N6 m. |. \& P) n
** in 'nnet' (all these require Matlab's Neural Net toolbox)! E0 K w! G s5 l; o
% ?% P- b$ |) s& s2 _0 V' U
1) demoPSOnet - standalone demo to show neural net training+ O9 {: s9 N; `' x2 o
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this+ A) W5 f8 T- O5 K4 i
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize; \# M( T1 j7 v( J8 W
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run" K/ {" i: U3 A- Z8 f
8 L' v' A7 Y% f% y" G( T+ F
. C* C* V9 t" `6 G' K