PSOt, particle swarm optimization toolbox for matlab.) G( I i1 K" f' ^ Z( |1 k
: P* t. \' C( d7 M* JMay be distributed freely as long as none of the files are # `- I. X2 m; {& Y D, @" b4 D
modified. " T8 K4 a, Y7 ^
9 b/ |- X" e) b1 f* rSend suggestions to bkbirge@yahoo.com - P8 w8 E8 d1 r) |
* k N8 D! p' E! @3 O* A
Updates will be posted periodically at the Mathworks User , V, J3 O( @3 U' ~5 }+ x0 g- T
Contributed Files website (www.mathworks.com) under the 8 ?8 x8 m* `( K$ g" b: O S$ r
Optimization category.! W9 l6 `0 j, N) t+ r% @
& I: Y$ o6 F$ d* I" A9 j" |& K& [% K
To install: ( Z7 E) c# w6 D! SExtract into any directory you want but make sure the matlab 0 ` g! `- K. R
path points to that directory and the subdirectories 6 K, f; b6 V# Q& a5 S; C. e
'hiddenutils' and 'testfunctions'. " a: a% x2 G: D- o: H% ?* N" P9 |/ w0 ^
Enjoy! - Brian Birge 6 M n" \$ G! h7 c$ M0 u! _" k+ I: A O6 C- k5 c! ^. }& K8 X$ R0 ~9 |
-------------------------------------------------------------& X; e1 J2 [" P1 f
------------------------------------------------------------- & ^; k) o& s/ R- A" N: z7 G2 S; c$ H- G: z/ ~# f" `6 M( [6 x2 u
INFO6 o, h# b$ k8 T
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) $ V1 H- j# D/ g* e3 band watch it work! , y% p/ b& k" s $ U; p4 V) @& T7 E1 HThis is a PSO toolbox implementing Common, Clerc 1", and # l) q* ]5 k5 v' X' _/ }
Trelea types along with an alpha version of tracking changing/ Y C: I2 b v3 e" C/ d$ k
environments. It can search for min, max, or 'distance' of # w9 }; ^+ H& G- r( c
user developed cost function. Very easy to use and hack with & f5 D5 }; M1 K- o; Y+ Lreasonably good documentation (type help for any function and. M( i1 y% {' @- k- }/ [
it should tell you what you need) and will take advantage of : b m8 B \& ?, X! c
vectorized cost functions. It uses similar syntax to Matlab's) z7 S( A; |/ T) B6 W0 _/ y
optimization toolbox. Includes a suite of static and dynamic 1 _/ R4 e! Q) V! b, K# N' k
test functions. It also includes a dedicated PSO based neural & U( b, f+ ~0 bnetwork trainer for use with Mathwork's neural network toolbox.5 m4 L: ~; K3 A1 A4 s! D6 i
0 a3 e% `* U/ y9 r6 o
Run 'DemoPSOBehavior' to explore the various functions, options, + o9 X4 m, J0 \( P- W# V' Hand visualizations. : x; e1 w$ X: P. C" |
& V2 D8 L( A! j" ?
Run 'demoPSOnet' to see a neural net trained with PSO % Z& H+ r3 z0 I(requires neural net toolbox). 6 ~6 c4 N5 _8 F# | [ , `" d1 W& y$ h* e+ l3 D C % y8 I: C' T/ k1 Y, UThis toolbox is in constant development and I welcome $ P: G: ~+ `1 u5 X& f3 \, t" r
suggestions. The main program 'pso_Trelea_vectorized.m' lists $ x, ~1 P5 {& O4 l; s! yvarious papers you can look at in the comments.( H, H$ F) q7 J8 B& @" q9 ~; }8 j
: E4 U- G1 k$ C+ t
Usage ideas: to find a global min/max, to optimize training of - j4 E! \1 {8 n* s! x2 x/ }' T
neural nets, error topology change tracking, teaching PSO, , C3 M/ m& g0 k( R% x8 p
investigate Emergence, tune control systems/filters, paradigm 1 V1 z4 u$ t, r6 _8 N
for multi-agent interaction, etc.# w0 R6 O p' p/ S# k
+ w4 G/ H* [0 \/ ^- d-------------------------------------------------------------; C6 P, J& r3 H9 t9 z8 @$ N
-------------------------------------------------------------. A& Y0 U( z5 W F' S; L
5 x7 L' F& o4 T% d$ a% | : H. p/ {* a& {. ?( qFiles included:4 |9 t @/ [" s- i! X' y. Z* |
, m$ V/ [& k7 |+ d5 ?2 A" ^
% ? } X+ }2 I7 P- x
** in main directory: 8 ~8 e3 h; d7 R5 x6 Q) P4 L. l/ ~
0) ReadMe.txt - this file, duh/ ]+ n7 ?3 J# @9 n$ }! g
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO / F) v* R5 `( G+ ?2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called 8 V3 c# g: j5 E H3) 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! H; h+ W# _8 k! W
4) goplotpso.m - default plotting routine used by pso algorithm# V, t; k# B( ^( L# x( ^
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. / t+ g% H- L1 k2 C! i6 l9 @ 4 v, B/ k/ L1 [4 h4 X ; O x; f! h6 M7 L6 Q. m8 O& O, |2 ~% X; J% T' i3 {: l, v
** in 'hiddenutils'' W) {! \# R, B7 f
9 [/ S8 G, s0 n; D1) 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 * y4 X2 ~+ ^/ ]0 O/ o2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible . m0 s* p$ X6 K3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory8 {# A3 a! \+ w* r
* k8 f+ \0 Y, W. u; }7 o
: b i/ E( Z0 O. E- H& f
# ?" s0 M# z' K9 H** in 'testfunctions' % y0 d% G6 w3 r$ h: F b9 k% K2 L u) o0 Q! _ E h5 r! k. T b
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:& A7 F, ]1 v9 w9 ^+ W8 _
5 D M$ y. S8 g2 m) yStatic test functions, minima don't change w.r.t. time/iteration:' M" E" D' t# N" ]$ G
1) Ackley ! s5 \. J3 {/ |3 P 2) Alpine 2 i4 Q1 l9 c6 d1 F5 \! Z9 o 3) DeJong_f2 1 G, v) o; O0 j: C2 s6 }) z; e 4) DeJong_f39 m8 K5 l* C h# G- T) N' h/ _' [
5) DeJong_f4 4 B2 _7 D# E9 ~; e1 C! m$ L 6) Foxhole / i5 D0 A9 P4 D5 R 7) Griewank* J7 }: G- d m# O
8) NDparabola , ]8 U: G, n9 M& \- z I2 Q O, ~ 9) Rastrigin 5 M5 c/ q/ I4 X10) Rosenbrock r8 z. h3 b- Q: {3 s R; L$ }11) Schaffer f6 ) {! W( `6 d# K+ b+ q12) Schaffer f6 modified (5 f6 functions translated from each other) 3 _9 p7 ?3 U! j, C2 q( s: T2 [13) Tripod* @ x' ~% i8 j6 X* Z. {4 q
' e5 @( I2 S9 G' QDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 9 l9 I9 n) _0 ?8 N' P$ a6 G14) f6_bubbles_dyn! }. h' i @. n% @
15) f6_linear_dyn' _5 @6 t8 S6 p) I- z
16) f6_spiral_dyn6 E7 a8 u5 z/ l4 H$ F4 C5 s: E
3 A, F" m7 N; j$ B( `( h' M" i) i
6 T6 C' m$ T' _% X' U 6 f5 ?& g2 [' b4 M( Q) Q6 r** in 'nnet' (all these require Matlab's Neural Net toolbox) ! U1 l& X3 |2 k. @! Q# q, F6 p; u( A! L. Z. @8 r
1) demoPSOnet - standalone demo to show neural net training K4 ~! k6 O' e+ X; x
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this- y' y1 R- T. j1 M# Y. w" w
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize $ Q) j1 Y, [: i3 J1 Q( l c# |$ V 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run 1 b: O0 r/ q; _ C, J3 `& D& C, ?9 G, u3 P6 n9 {
, s o: A0 B' R3 [- m! D