PSOt, particle swarm optimization toolbox for matlab.2 B2 {6 }! j6 }
0 ?' T$ A) C9 j" P+ P# @
May be distributed freely as long as none of the files are 2 K# m$ j: m) ^1 r6 a
modified. 7 F2 n P D5 ~
* D! y0 Z' H L9 T' P7 s" |) z! a2 |
Send suggestions to bkbirge@yahoo.com ( S% I, a: H# D2 ]% A4 N0 b ' [ f% h0 Z( F% o$ s ~9 r1 ~# cUpdates will be posted periodically at the Mathworks User " p- U, O$ P" e5 f1 [7 EContributed Files website (www.mathworks.com) under the " f: `/ {+ M1 k' p, g. u: R% F
Optimization category. # a, G4 C: L; I1 c & U6 L- J. U: L1 D8 RTo install:: L8 J: l+ G' M, S
Extract into any directory you want but make sure the matlab ' O3 ^7 F6 J& a* x( j6 T& U
path points to that directory and the subdirectories & \7 V! ]* ~* v) [) b4 e5 x'hiddenutils' and 'testfunctions'. ) E# ~6 R M) A8 A* M4 X5 d! K5 M
- T5 u: T. ]4 F) L, p4 x8 F& D
Enjoy! - Brian Birge; @# @3 A4 c! V0 W0 j% c/ i6 j
( J4 _+ R( m2 j* I0 u0 V, z-------------------------------------------------------------$ @1 z" J+ r% \8 \
------------------------------------------------------------- ( Y+ l9 `$ n9 {1 T3 w' a9 V3 V7 `( y |4 u3 v
INFO5 }* A3 f; R5 l+ o. I9 S5 ^0 M" s% P1 n
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) * a% n- F) T- }, E1 A' N/ G# \7 Aand watch it work!) \5 j1 ]# ?3 @
+ V5 |6 G6 w+ pThis is a PSO toolbox implementing Common, Clerc 1", and - Q1 \0 `' Y. X6 `" [- D0 Z0 y
Trelea types along with an alpha version of tracking changing ) V* `1 [. V) W$ z) D: cenvironments. It can search for min, max, or 'distance' of , Q: K+ j6 v: d: huser developed cost function. Very easy to use and hack with ( u8 M6 W. e8 v4 T7 j
reasonably good documentation (type help for any function and $ c9 a3 t$ M A" u! K `it should tell you what you need) and will take advantage of + F# f( ?- S7 o( n! y
vectorized cost functions. It uses similar syntax to Matlab's & M! s8 f+ l3 ~& b% K/ ]optimization toolbox. Includes a suite of static and dynamic / P; Y+ l* {% T/ L+ U: a
test functions. It also includes a dedicated PSO based neural ' b! h& k& X5 X! x
network trainer for use with Mathwork's neural network toolbox.: S. O6 B' z, |: X6 H5 [% b
l" |: X. h5 h# Z! v5 ~Run 'DemoPSOBehavior' to explore the various functions, options, 8 m; N+ s# A0 ]/ m$ M4 T9 a' land visualizations. 6 D& L6 I' U6 Y u/ |+ Q- m- @" @
2 x# X6 [8 o- DRun 'demoPSOnet' to see a neural net trained with PSO $ C5 @; P3 K2 b7 R(requires neural net toolbox).! L0 d! I4 B$ S4 @0 j
$ x) J, a% o9 T! n* S
3 x( M) v+ K2 u% \% O* ?
This toolbox is in constant development and I welcome & e6 h- m3 p- ?0 o9 s# h( H5 a; ?suggestions. The main program 'pso_Trelea_vectorized.m' lists : w8 }+ }4 [3 \; s9 I& Svarious papers you can look at in the comments." e: J" }+ [6 A
H3 v+ O2 S; P7 r6 `+ I* aUsage ideas: to find a global min/max, to optimize training of 6 y: z5 h |7 |1 S3 }/ aneural nets, error topology change tracking, teaching PSO, 8 y; z5 [& m) D0 T9 z9 uinvestigate Emergence, tune control systems/filters, paradigm * o5 I) h6 i, p
for multi-agent interaction, etc. + I2 Q1 H ]9 h% m $ ^8 ]5 ?6 j: s-------------------------------------------------------------' x3 z `- Z1 e7 h; n5 l( m$ D
------------------------------------------------------------- 4 O& C! l1 b- E8 q. O7 {7 r" w6 `5 L" H, k, z* d( S' `( i
+ r2 ?: m0 r, s% _9 ` @! e
Files included:/ f7 ^! }3 V J( Z: ?) z5 ?# ]
1 P$ z8 W, x' g * o, q- @% ~! t, ~6 G$ L# Q* ~! b- e** in main directory: + H% w+ x V1 Y/ q, v 7 ^: E4 g9 u9 I; G% H' ]0) ReadMe.txt - this file, duh) O( ?+ Q3 g7 e
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO+ l0 n& e' h4 g3 V% B
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called " F0 V" S7 Z |* {0 `* [/ u3) 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: R$ H7 k6 @, Y) D2 `& [
4) goplotpso.m - default plotting routine used by pso algorithm; P+ Y0 Q% Y7 y5 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. $ Q' f& n/ a1 {8 x' f1 A* B R) O: y, W
# M; H5 ?8 _$ N* w
0 ~/ @/ ~8 j/ D! @( B# t; J** in 'hiddenutils' $ q/ f% t% I* s( i3 r8 p & |# B/ ^3 Z" v3 C# B1) 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+ d: \- W' ^. }" K$ K
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible " [' E. }/ @2 S, a* e9 Q9 |3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory; F. H9 `, d5 a; m+ A9 U
3 ^" Y/ ?# B+ w3 B# ^9 K
- t3 k3 r; \. e( P2 T( t 2 L/ V! \! ]2 x5 V+ V3 l** in 'testfunctions'+ Z" F: {% z5 F3 B5 N, ~4 ~8 }6 W8 W3 M
6 ^# g7 o) o( ?. _+ L0 `) I5 p. ~5 @A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: 6 y) ^/ l$ L, {' S$ W# k# [ , a/ c+ A0 C+ i& D$ e/ `4 kStatic test functions, minima don't change w.r.t. time/iteration:4 ~. c- @/ y: `# g* U: _
1) Ackley4 w$ c a: b, v* L- G; l$ a; _0 A3 b
2) Alpine/ g9 U" h" \( \/ G9 t4 U+ n% ?/ Z! {
3) DeJong_f2+ ?* I4 F) ~6 x% a* l
4) DeJong_f3' n! a7 s0 A' B0 R% o
5) DeJong_f4 9 W" _9 J" J) X1 d 6) Foxhole & j4 @: Y0 k1 U7 i! u+ ^ 7) Griewank2 H- f- F8 O% \! c+ n; ^) @5 j1 _/ q
8) NDparabola- M S+ h8 Q4 f# M* N
9) Rastrigin$ A8 |! q3 D& B) l* K0 |
10) Rosenbrock; B' a% U! m; K# ?
11) Schaffer f6 , n8 w# o% ?) g; A) |! [' ^ o4 ]8 W12) Schaffer f6 modified (5 f6 functions translated from each other)+ t: O! K. T8 B8 Z
13) Tripod7 X" n6 ?6 r r1 t; Z; I6 o
# \9 j- \: W5 g( o C- {; tDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): + e* e* p8 G9 P" J14) f6_bubbles_dyn" v9 e0 g6 { Z7 ~! W
15) f6_linear_dyn3 ?4 D& F6 h! m, O( h9 V5 x
16) f6_spiral_dyn+ k; [4 K% J3 }2 t
7 r' P7 c Z9 J/ [! T7 I9 S# ^( f& n1 U6 v
. p T& [3 u! `5 N** in 'nnet' (all these require Matlab's Neural Net toolbox)2 |/ W% E0 J8 h, }* y0 A) f( `6 w& c
; w9 C) p, x0 p+ G B _
1) demoPSOnet - standalone demo to show neural net training ' S, _# e4 ~& { 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this2 W# V+ y5 j) _* t& B
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize + P( H$ |5 d, _7 z" @4 Z' S* J9 ? 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run6 Z2 G& b+ ?) p, P7 _% {