PSOt, particle swarm optimization toolbox for matlab.9 b! X8 D" |5 \
* H) j8 {; s0 d" ]
May be distributed freely as long as none of the files are " _8 e/ h! h( }, \1 p6 H6 q2 K
modified. 9 [( n6 ]" F! y, Y
" n. r8 o2 z) }0 w* `8 NSend suggestions to bkbirge@yahoo.com 1 Y$ [' Y" q' e4 X# o" _ D; [, K8 k) z
Updates will be posted periodically at the Mathworks User % R) W: S9 X$ m% d: x# j+ M4 J
Contributed Files website (www.mathworks.com) under the ! Z8 {! _3 Y9 m& XOptimization category.1 p1 o( A! T3 C" c/ r' P
3 ^9 x7 a) S: ?6 nTo install: % k* t+ i1 v2 l" i: ?Extract into any directory you want but make sure the matlab ' k6 k- n/ E8 J$ @+ [: ~0 qpath points to that directory and the subdirectories \. l; U& ^, O9 q. u& l* ~( u0 e'hiddenutils' and 'testfunctions'. u2 q- t0 b3 o0 U$ @3 s) h4 K$ R+ o/ M' P% V+ j1 x$ m* Q' a
Enjoy! - Brian Birge # M8 [; q( C! B2 _) h* E" w1 R/ q+ Q' c. E
------------------------------------------------------------- + R W3 F+ \6 Y0 [ g' B-------------------------------------------------------------5 ?: b5 p* l# {3 I
. g& K c. W9 B2 Y0 g3 dINFO _& x" E: y x' m. q HQuick start: just type ... out = pso_Trelea_vectorized('f6',2) - _$ i# W$ h. Mand watch it work!, f6 o, S- c. h, O
6 Z. y. N/ n( N$ I* [' T, z- i& vThis is a PSO toolbox implementing Common, Clerc 1", and % L2 ]' G3 Z. h( T! G9 y7 M i* nTrelea types along with an alpha version of tracking changing; n" O0 H* N7 `; n- c8 R
environments. It can search for min, max, or 'distance' of 8 B# @ x! z* m
user developed cost function. Very easy to use and hack with 9 C9 P. P. S3 F, G- U
reasonably good documentation (type help for any function and . x' i( p% f' [, c' T" f( T1 qit should tell you what you need) and will take advantage of 2 e5 w8 M& X7 b3 C
vectorized cost functions. It uses similar syntax to Matlab's 6 d0 T+ Q! Z! Y8 x8 c6 r0 w% H; Eoptimization toolbox. Includes a suite of static and dynamic 5 Z( ~$ ?) B b( X8 S6 M! Q" R
test functions. It also includes a dedicated PSO based neural 4 ^2 o! r& H4 L* D8 |5 c% s7 hnetwork trainer for use with Mathwork's neural network toolbox.$ [! A$ A* P( i* M' ?
$ W! r& j3 B2 B, oRun 'DemoPSOBehavior' to explore the various functions, options, ' n; ~+ j. q# m
and visualizations. ( v: T' ^+ y' z, R% _* d; s/ j: h. e
/ i/ q' `* U6 s( x" G
Run 'demoPSOnet' to see a neural net trained with PSO ; X2 [6 z$ M; w5 k
(requires neural net toolbox).( |" W: e! s2 H
/ h4 r- b7 D5 b) H: m4 A$ F: R
1 y6 w' P! y$ f( n6 Z: f
This toolbox is in constant development and I welcome # d/ e' P0 s; V6 O' P" F' H
suggestions. The main program 'pso_Trelea_vectorized.m' lists ; _- b% Y( c, w9 P
various papers you can look at in the comments.% L( [3 m$ ]2 V( `+ A8 F+ F
' x. G7 \2 c5 n, b
Usage ideas: to find a global min/max, to optimize training of . `7 b* y: b" A) | y6 j) b2 S! rneural nets, error topology change tracking, teaching PSO, ( d3 L+ ~! R0 Pinvestigate Emergence, tune control systems/filters, paradigm , S) w* g# A, l# M+ ]7 D9 Qfor multi-agent interaction, etc.. p& K3 ?8 m# _2 G
6 [# O1 ]! k! K1 S9 y, C
------------------------------------------------------------- & A* X0 l9 a; K T4 S6 `3 L$ c0 {-------------------------------------------------------------" l& v- k- I) N' F
& D$ l" d3 `) ?+ h
- r) w6 q# M4 l/ B) q2 l; p) ? ZFiles included:+ w1 Q5 h& z+ K t7 |$ o, c
v2 I. l- T5 f( _7 E # O% S# a' u! S0 M2 _% i** in main directory:0 }% R: o: n# w( }8 W
! N# J! Y0 E) H; M/ J- z0) ReadMe.txt - this file, duh 9 I5 L. j: B2 X8 z5 H: e1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO) N3 |5 Y" Y" B {
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called8 w( [# ~% N) }8 _$ M
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 + S( {! a% j& ]) h3 n' M/ `4) goplotpso.m - default plotting routine used by pso algorithm , |# k$ ?8 D4 j+ S- H- K" {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# V& ~( T9 F- {* U& I5 D" l$ {$ l1 R
3 q* |. q" [1 K0 l4 _, F/ B0 a" \
: e ~1 Y8 f- f8 }
** in 'hiddenutils' ! y. b" o8 ^& s% N9 p% P! j" l0 i 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 , C- u& z) F: b0 X8 j0 c2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible 7 T, n2 N; m( E3 B3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory ( u, w6 _" G- }, b9 ^ 4 a' U) u1 W1 y! L+ }( ? 8 I# \/ B! U' [6 A! n& S1 b9 b) C/ d ( [- o [3 l; a- |5 i/ Z& C+ t** in 'testfunctions'4 c8 N) N8 E/ c0 V) F6 `/ c5 p6 k0 q
; z+ e* O& n2 k1 R3 b* A. N6 L/ |
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: U! `5 P# {$ o0 X! e7 K8 k- V1 B( Z$ c" f+ N( g) B; I
Static test functions, minima don't change w.r.t. time/iteration:) p' T% e# Q; Z" u8 ]* \0 S7 U
1) Ackley5 E! ^' Q, K* G3 [
2) Alpine, l" i6 ]. v% C
3) DeJong_f27 L2 ]" t% N7 w V. w4 e+ u
4) DeJong_f3 {$ N" ` y0 z
5) DeJong_f48 o3 j& x3 C& b6 C4 N
6) Foxhole 0 j; u5 b( j- i, G5 }' V5 q4 } 7) Griewank 8 h8 h4 m0 M; l, _: v! R! J 8) NDparabola % q5 c4 Z f8 c) q 9) Rastrigin : {8 ?" v$ B3 h) ?$ Q10) Rosenbrock ) Z; g+ Q8 [; {11) Schaffer f6 2 b" W6 M- O) `2 @9 [; p& M12) Schaffer f6 modified (5 f6 functions translated from each other)1 h3 Z7 f; \% ?# n, I. C
13) Tripod% `& M' b# B; e0 `* t
9 h" {7 |/ L: n h* H# ODynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):5 z1 Z" O9 h( f0 z
14) f6_bubbles_dyn 7 ^, g" c. f: h8 T15) f6_linear_dyn, M0 [3 M. t v! p6 o
16) f6_spiral_dyn 9 e) e5 S2 K( N f+ ~" u; I% L9 r6 C0 _
; m1 @+ ~" p1 z7 z: }: I* w ^9 ?; f o) j* u
** in 'nnet' (all these require Matlab's Neural Net toolbox) 7 A) G9 N R0 ?5 ~8 ^! a S7 U$ j0 e; L0 P( [5 `3 l
1) demoPSOnet - standalone demo to show neural net training6 B! g" s. A" q, W
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this / v8 z7 j w$ c0 }# y% F } 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize0 r$ I3 U: B; W8 r" Z
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run0 N# ^9 R8 N; r0 n$ x