PSOt, particle swarm optimization toolbox for matlab.: |" u9 Z) E3 V3 _' s% Z. A
* G! ]& c3 ?8 O# q$ _6 i- E0 F. p
May be distributed freely as long as none of the files are & V" S/ b( ]& w% q6 J: z8 y$ h
modified. ! ^. @% `" y3 \9 u. a3 z 0 z! y# n! K8 C& _3 w ]Send suggestions to bkbirge@yahoo.com 1 h# N4 P, U$ v& ~, d
- t3 J( y# h$ e3 P8 _' K3 u
Updates will be posted periodically at the Mathworks User 5 Q- V M' p# ~0 H' S
Contributed Files website (www.mathworks.com) under the : ?& I' y! G9 r0 Z) lOptimization category.7 o1 g# P# y7 x c' @2 ^6 @3 j1 s
0 ]: D2 k# _# X! o
To install:- K: q+ _) d9 o1 T6 k
Extract into any directory you want but make sure the matlab / y5 i* m+ @; r9 ~! |" K ^! R" vpath points to that directory and the subdirectories ! G% a. m; Z( b V
'hiddenutils' and 'testfunctions'. 5 v4 {; _9 w! I1 \: V- f/ w# p9 h, _: h0 z& _
Enjoy! - Brian Birge' \- ^" G! I7 p6 @. H/ X7 n1 K
7 i9 P; m' W- k7 }------------------------------------------------------------- 5 V7 ]+ Q9 p* b' }& C6 P7 O-------------------------------------------------------------) t0 j8 W! U$ @* }5 J1 @- l
% l1 R/ }! X! K4 y h( B: ~
INFO # P# B) j" ^$ d9 Y8 z: `( E) gQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 9 e$ x( M* [9 D
and watch it work!" g$ E3 ^+ F( y( g# c1 A* ~. L( X
/ |4 f$ A* \6 U5 X' v. jThis is a PSO toolbox implementing Common, Clerc 1", and 8 c6 x0 A' i% z5 b7 |. I
Trelea types along with an alpha version of tracking changing0 U# Y+ C$ I+ W3 [5 A
environments. It can search for min, max, or 'distance' of " w h" y7 x8 ?6 x" s1 L
user developed cost function. Very easy to use and hack with : C0 [! U& f! }' Q. \$ breasonably good documentation (type help for any function and 6 |7 N9 w/ P) f& B; ]9 ~8 r6 Bit should tell you what you need) and will take advantage of & J m4 w/ S$ k1 b- @
vectorized cost functions. It uses similar syntax to Matlab's ' s) b4 K* \( |: l Q1 u! l1 Moptimization toolbox. Includes a suite of static and dynamic ' g" c* R) [. F2 j9 }, q* _! f: A
test functions. It also includes a dedicated PSO based neural : g: R( b1 z3 U" V. A- l8 {. g5 inetwork trainer for use with Mathwork's neural network toolbox.. L/ f% R# _: l) m$ l
7 i# S9 L7 a9 s! T6 U5 H* O* Y2 @. r
Run 'DemoPSOBehavior' to explore the various functions, options, 7 U3 P( J, d0 R0 n! Q5 yand visualizations. 1 z$ M, U f0 D W6 {6 ]0 I
9 T( v- g/ [; L0 P
Run 'demoPSOnet' to see a neural net trained with PSO 0 f" y1 _# t! D' @7 c( @
(requires neural net toolbox).: ], x o; O" Y/ ?- C
0 a7 Y7 X8 }2 z# n% b5 \" f% Q9 F$ K1 ^! D4 h7 e
This toolbox is in constant development and I welcome $ Z' b2 V1 U$ s4 o, p8 Z; Y, D3 w
suggestions. The main program 'pso_Trelea_vectorized.m' lists 3 j) J$ s0 `9 e: D
various papers you can look at in the comments.; t2 |& ]- [3 n: V# X+ W
8 L, w5 p1 k/ n5 [" Q! |
Usage ideas: to find a global min/max, to optimize training of 3 n4 P- R, U. K$ v
neural nets, error topology change tracking, teaching PSO, 2 g# W' [+ n x& m8 linvestigate Emergence, tune control systems/filters, paradigm 4 P8 t9 _3 E1 X1 a( }: N9 p7 b* a
for multi-agent interaction, etc.5 C6 K* H4 h) h; z8 X+ F8 R
: a' k" |( k. U7 }9 e' v' F$ ?-------------------------------------------------------------' K9 D. Q2 ~7 g0 m' P& P( `
-------------------------------------------------------------/ p8 J2 D$ _7 x/ a8 G" A
* o- @+ p1 M/ N 6 b$ x+ i& ]) N0 {( wFiles included: Q; t6 l" g, |+ f
% B* H7 X! d$ E' D" \; ^7 ?; U
" l5 P8 f- @; |4 c2 m( p** in main directory: , W1 Q1 W# e- e x5 p% t* J+ S8 L# l: |& e5 C
0) ReadMe.txt - this file, duh/ `# c ]2 O3 @ B/ N
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO / ~% a+ Y+ z* ?5 L2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called8 n( N9 Y X( |. i
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 lot 1 j B! H8 a3 @4) goplotpso.m - default plotting routine used by pso algorithm0 O G9 {# i) n' a( ]' B
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes." m4 r: ~8 } t7 q/ K) C# S& u
2 G+ ^' e7 t8 O
4 `- q* K; J# j! q ?- b. g" o6 z' q; i
** in 'hiddenutils' ( E& k" q" s# F1 }/ c* d: T- L. O* M( q5 g% h9 H
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 C! b: U3 e, E9 R$ G& v9 Z2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible ( h$ h- V( d8 N) w1 | I3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory7 R! i4 R( D8 \' r- D
3 l' M3 R) m1 DA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: " W5 h6 v& E% ]6 b) r7 B4 V2 F' e2 k
Static test functions, minima don't change w.r.t. time/iteration: ; X) Y2 L+ C6 ]0 n: ` 1) Ackley: r& d3 n. j$ P
2) Alpine, |3 C8 d* k% n
3) DeJong_f2: B- E3 a2 S0 f6 c
4) DeJong_f3 : R$ V; x- T$ X, z- e 5) DeJong_f4 1 {" N- W, n: r+ t& J/ e! v 6) Foxhole 3 m0 t/ F9 @# C! `) P; ~; Z 7) Griewank 9 j( G7 N6 s' a; r+ N: y 8) NDparabola r5 K$ p2 S' C5 @% L
9) Rastrigin % s: u' O. v( `6 k5 r10) Rosenbrock 0 ~" a& [3 n; J# a9 O+ X, `11) Schaffer f6( o* O6 ?' T" L; H! j5 o# K
12) Schaffer f6 modified (5 f6 functions translated from each other) , U1 [+ f" T% V6 U8 Y4 K" P2 p' ^13) Tripod4 z I$ g$ ?0 r
! s' \6 F1 b; B2 g- `8 e
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): ; i" D/ E) G' \7 G0 ?6 ?( z# X14) f6_bubbles_dyn ( A6 z/ X$ R. p" u, r* o15) f6_linear_dyn ) u5 U$ a9 Z; h& z$ \16) f6_spiral_dyn G) e! c* t& F: Y1 O t: _ 4 n# q- Q7 f: a: @7 |; t- t, W' j
, y& K1 A2 A% {5 H
** in 'nnet' (all these require Matlab's Neural Net toolbox)4 L( J0 @! Z+ ?8 \, o' J
4 [3 u' t% S6 i5 V$ x$ g 1) demoPSOnet - standalone demo to show neural net training 7 N1 u2 r8 Q" W# M 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this ! a* y4 `0 L3 E+ I% W 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize / M/ B4 c" V1 ]% {8 y" u2 K5 M 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run, ~% B7 q# q9 @9 i* S/ a- b
; B8 p) T: b; z5 |1 M