PSOt, particle swarm optimization toolbox for matlab. ; j0 n+ `- C! X, `3 B0 } , g; L9 h9 O8 {: U8 o/ ]May be distributed freely as long as none of the files are ; o' q, v. y7 smodified. ; C" L! _+ L. m* r& J* a4 T, N. j; M! h u
Send suggestions to bkbirge@yahoo.com * e$ Y/ d5 M' V( q( D3 s 2 [0 ^4 c* f) p. K, X" [4 p0 _; jUpdates will be posted periodically at the Mathworks User % l7 d% n$ S' \$ d3 L- Y- W6 `
Contributed Files website (www.mathworks.com) under the 0 ^; L1 q- k" gOptimization category.) m* l# x$ q: j/ e# p
8 z9 Y9 k- n+ d% d; t. d
To install:8 |5 w/ h0 F; X+ I$ ^
Extract into any directory you want but make sure the matlab , y# X a0 k6 p
path points to that directory and the subdirectories + ]' m' N# K+ ^) M* F# z2 {'hiddenutils' and 'testfunctions'. ; `5 F9 O: T7 Y1 X* [" D
, v3 N. O4 |# {! r, I. ?Enjoy! - Brian Birge . t. I; t7 C1 n6 E% ~$ m , e* q3 _/ k2 \: ?$ E1 E------------------------------------------------------------- ! F' Y+ v& ~7 \0 e1 J-------------------------------------------------------------4 L/ o5 `/ i/ }# o2 A
: f6 O1 }! j, `% c- `7 ~5 Q9 w- N
INFO ; J0 v5 T: J) J$ M9 |; r5 cQuick start: just type ... out = pso_Trelea_vectorized('f6',2) ) C, y0 ?& T, t: Nand watch it work! 2 H+ P7 C Z8 u, q8 }& O) D9 n/ k8 V$ g7 u. w5 y8 B* e
This is a PSO toolbox implementing Common, Clerc 1", and 7 _4 g- p# _, \: F
Trelea types along with an alpha version of tracking changing ! ~0 _' X7 N0 o. z% X1 @% y0 a7 D% M1 X7 benvironments. It can search for min, max, or 'distance' of " p9 E% s& F: b3 h3 \; y E
user developed cost function. Very easy to use and hack with $ [" @1 p, v, k$ x0 x
reasonably good documentation (type help for any function and . Z* q# m: K& R8 [ T( v3 dit should tell you what you need) and will take advantage of % }9 h. w6 [$ i9 \! D! Cvectorized cost functions. It uses similar syntax to Matlab's % q9 Y4 N6 m. H2 \' L1 Soptimization toolbox. Includes a suite of static and dynamic . g4 Y/ u- ~8 ctest functions. It also includes a dedicated PSO based neural : j F* x0 S$ ^6 X# v- ?' s' Anetwork trainer for use with Mathwork's neural network toolbox. 5 r7 M" f/ e% L. g3 n. w 9 |9 ^& L4 d9 p. \8 l$ I/ uRun 'DemoPSOBehavior' to explore the various functions, options, 1 ~: u7 I9 V( o+ J' Nand visualizations. , @2 n% f8 s/ U * c1 \! Z$ e* R& X" x# U/ nRun 'demoPSOnet' to see a neural net trained with PSO / s7 A$ L# g! J* N! k: h
(requires neural net toolbox). ' \4 s6 h# h" p9 x+ R: g9 n; {9 m7 [; o, B' U
' _/ y. K2 V; LThis toolbox is in constant development and I welcome 2 C6 m% Q" E& N# csuggestions. The main program 'pso_Trelea_vectorized.m' lists ! j% U& R6 z1 ~3 e+ z; [) F+ H) Bvarious papers you can look at in the comments.7 u2 f. [% j& b4 v
% Q, p2 d' m; E" w7 L
Usage ideas: to find a global min/max, to optimize training of 3 F6 Q+ Y. O7 d4 c, u0 N
neural nets, error topology change tracking, teaching PSO, ) y8 _* ]9 X- K' S# A
investigate Emergence, tune control systems/filters, paradigm 9 y3 c+ h6 R/ j u# k& e, h
for multi-agent interaction, etc.. _: p! l4 J; F Q
7 y6 P5 c( ~% D! a. t9 i; ^ 7 M" r- ` i T# M' uFiles included:/ U4 t: S! O$ F4 O$ I. b4 s! q
+ W! {8 S7 P6 t q1 n
+ E& G0 z3 c) _8 M( C j** in main directory:1 C7 V4 T( S3 r6 A# F5 p
, C$ d! c! L, h0 s& r& j* k& {0) ReadMe.txt - this file, duh 5 ^1 L7 D5 G' g1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO ' [" ~) O/ w/ M& ?2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called ' E' x( [/ }% W# X3) 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' `5 u1 k. u3 @8 [ r4) goplotpso.m - default plotting routine used by pso algorithm 8 A. j$ Z/ ~* _1 C1 v! c5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. , k4 y' n- D( P( g9 _, S/ ^ 7 ^2 `& Q: a9 H& C1 l' D: n" s: f3 z8 m
' I( l6 z! `' [- s: C+ O** in 'hiddenutils' 1 ~5 `% }2 k P9 M- q" d # V6 q, t0 r! m' M. Z6 k+ a+ D' Q1) 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 ! E1 E5 b& h F; V( H2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible ( {- W5 }' ]& B/ _3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory 2 C2 o) c M+ n6 I4 y6 a- \1 e' j5 v5 L! E! ]) O) q8 J6 F; Q; f
6 @' }+ {( G5 c2 g
; k6 |! u% v, r5 ^** in 'testfunctions'" O# T V/ V6 l
+ g4 @8 t/ D% s2 B4 B. J. q6 q/ |- \. TA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:* P7 ? L& `4 O0 W6 g4 [/ e
~% V) I6 n- T: d; _Static test functions, minima don't change w.r.t. time/iteration: ' b/ m. }3 v4 j; W! V 1) Ackley 4 V4 U: p( T# w5 K0 p 2) Alpine # r% |5 L+ W" ^8 U. t5 f 3) DeJong_f2' g7 e; w, G, ?9 G/ T, s* D s" q4 p
4) DeJong_f32 L! ~ u. I7 F( s. R6 X
5) DeJong_f4 4 ?( r( n, ?7 j" O 6) Foxhole . n% F# y/ v9 ?6 {2 v& }1 d5 |5 f1 [ X 7) Griewank 5 \! M" A: F/ s2 F9 n 8) NDparabola - G% X( f& n, A7 Y* z- s0 J 9) Rastrigin 0 c5 H6 e/ U; x$ C# U/ Z; K3 j4 W& o10) Rosenbrock 9 {% A- }- A/ m# b* }# Z11) Schaffer f63 {; }( N1 i* T1 ?0 @6 x* r
12) Schaffer f6 modified (5 f6 functions translated from each other) 3 P1 x" I; t- z; a3 H* q% a13) Tripod( k! P: r% e6 r
; H+ z% U* S( x F8 U8 b
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):4 `$ B& M" g# {
14) f6_bubbles_dyn 6 Q( c. Y7 [. W2 f* ~2 h15) f6_linear_dyn& j5 S' Y- N$ p8 e* G
16) f6_spiral_dyn& N9 ?$ J& o/ [9 h* U$ E9 r
: l+ X# ?4 n6 L I6 p- Y / N! j# e6 a1 j+ @, v- n, t3 j+ a" H* G: Q/ m) g: z
** in 'nnet' (all these require Matlab's Neural Net toolbox)$ L& {2 q8 {4 M7 N+ p$ Z7 j* x* X- o
- K. {. \) U: l8 N8 ?5 \
1) demoPSOnet - standalone demo to show neural net training 0 L: C3 b% |+ Q/ H2 `3 w 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this # R0 T! d3 r# m4 i 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize @& K: ]6 o8 A
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run c; z7 i8 L( p& u6 [# j+ f" x% a# U' b: q) r
& U% O2 L# [9 h# l