PSOt, particle swarm optimization toolbox for matlab.* H" Z# e; X; z) C, d
# u9 _& P. v8 _! k" ]' D2 ^
May be distributed freely as long as none of the files are ! m: S1 K& t% Q+ @$ K% G
modified. % I6 @% s3 B# d# p5 m2 e0 p2 K
/ |/ ^! ?) ?# U' o1 l' c& dUpdates will be posted periodically at the Mathworks User & t( {# U! a5 i2 d1 G( X& CContributed Files website (www.mathworks.com) under the 2 t7 s a; |* c' N0 e
Optimization category.: Y; l% i4 C4 V: v
* |1 E% O3 U( P& ^4 L
To install:! z1 w- x% h7 f: ~2 R
Extract into any directory you want but make sure the matlab : ]5 o' F% l+ Q/ z
path points to that directory and the subdirectories ' L% c3 p+ e( F6 R" U( [
'hiddenutils' and 'testfunctions'. 7 \6 A+ c* g) h8 X7 D( f+ ~6 M* W
. c% a: y6 i$ ~/ R2 `% E
Enjoy! - Brian Birge2 R. _! y, O L. H1 S4 ^
8 l/ x. ]# }( g$ W( w0 r! ^------------------------------------------------------------- $ M6 E8 ~- D; }' u7 ^# @-------------------------------------------------------------' P! Q1 q/ @: [
- [* A) [, T+ n
INFO0 Q3 o7 }. h/ q6 u( a
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) 2 u) w! @4 x* K
and watch it work! : U+ l9 i _& x/ N ; F' `" x! _( x3 U$ rThis is a PSO toolbox implementing Common, Clerc 1", and 0 V5 b! G" P, o+ H) aTrelea types along with an alpha version of tracking changing) `* M2 n# \3 S* W+ `
environments. It can search for min, max, or 'distance' of / A( R; l6 n# N# F. C7 @( j
user developed cost function. Very easy to use and hack with 3 \* w) T4 O* L3 I; D
reasonably good documentation (type help for any function and2 U4 D: m$ F5 L7 p/ n7 a8 q
it should tell you what you need) and will take advantage of + f% r0 f# o0 Dvectorized cost functions. It uses similar syntax to Matlab's & [0 ]& e& P# n9 \6 _2 toptimization toolbox. Includes a suite of static and dynamic 6 D! P& U% @# B+ Ftest functions. It also includes a dedicated PSO based neural M, w' w4 a% c/ ^network trainer for use with Mathwork's neural network toolbox./ s! Z% L* p4 N# D$ e* I$ ?
" |+ R" @- p, h2 ^Run 'DemoPSOBehavior' to explore the various functions, options, 7 m6 O# |6 ]6 j* q$ h( j
and visualizations. 4 H8 ^+ |- [" C: L8 ?' }1 z/ T9 N& H$ M/ d$ K
Run 'demoPSOnet' to see a neural net trained with PSO / h/ B$ T; V- p- c6 ]0 n3 h6 W
(requires neural net toolbox).7 y5 h( c P2 z, b- U6 K ^
6 N( W2 B" u- L% X # t6 T Z+ G1 E( F( K/ f' fThis toolbox is in constant development and I welcome 4 R0 L" }0 @# x2 M( A$ H4 Gsuggestions. The main program 'pso_Trelea_vectorized.m' lists 2 M2 |2 B7 A$ f; w% h. Kvarious papers you can look at in the comments. & d2 r: n! J# ]8 w4 e7 H$ I# A# }
Usage ideas: to find a global min/max, to optimize training of - d1 d+ p* L9 E+ x A" b6 B+ t+ m' eneural nets, error topology change tracking, teaching PSO, ; C7 u. c/ o2 l& g
investigate Emergence, tune control systems/filters, paradigm . z+ }, O, m: y
for multi-agent interaction, etc.$ {* ~# ?% |* d8 c6 |
: T3 a2 Q% x6 g2 b. r* H- Q0 h) i" {" B; ]: ^/ b
** in main directory: ' W9 [) ]# \' {0 D/ j; g9 X2 N: u7 r) [
0) ReadMe.txt - this file, duh 3 s/ e: y" l% h% ]( G1 v1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO 6 \3 n1 p7 e. V5 W2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called% P3 ]! {2 ]4 ~" g) z/ R, z0 u
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 " b5 V. Y% [3 [& S1 y s4) goplotpso.m - default plotting routine used by pso algorithm9 @& a& f* h1 F" Q
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. " C, k" C7 t6 ]5 C! L. Y9 t6 p! X. \( I( |5 H- F) ^+ `. c
" Y, o/ Q& u3 \' a1 _' N/ S' S3 x" s R, ~: h% J d
** in 'hiddenutils') J. ?* T( r: C) g3 B8 N# Q
9 s7 \/ @( P( l1) 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% I* l/ w5 G& C) E. M0 {
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible8 y- j" Y5 X @' c0 H5 w2 q9 T
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory/ G6 i/ T3 N% Y( V' a
8 [' b, _5 K0 Q( Z0 l
4 J3 N+ _/ V/ H% p# Q) B, r' F % r5 @- ~% O! V' F** in 'testfunctions'8 m2 T) q8 w/ j N$ k$ _
+ H, Y& q1 h; S' @: d, ~. Q6 m }
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:. ?& _1 N- |$ c3 j! i& P5 B+ o9 V/ ?
+ S0 |) p' _. W1 ]Static test functions, minima don't change w.r.t. time/iteration: ) d8 |' ?4 t6 ^ 1) Ackley ( c1 f( S1 |4 [7 _8 B 2) Alpine $ @9 b. v$ C8 v! a0 E 3) DeJong_f2 . F0 n0 G* n7 s6 g: \ 4) DeJong_f3& F) {) N% Q! k: l
5) DeJong_f4 - r# b# b4 ?" w4 u7 F9 R$ I 6) Foxhole9 r, `3 Z N' G k- l2 u" p4 k
7) Griewank 3 O1 R8 @; b$ T# Y! B) f2 k4 f 8) NDparabola8 U0 N% y! n7 ? Y( @7 g$ u2 Y
9) Rastrigin & ~9 ^) c0 K. f, q0 n* ?. E10) Rosenbrock0 l, H4 L) P' V; ~2 r+ F2 D
11) Schaffer f6' \* g, U& o7 ~& r0 {) I$ }2 }9 x
12) Schaffer f6 modified (5 f6 functions translated from each other)4 @/ f3 z; t0 p7 C
13) Tripod3 Z9 V; y, k9 M. z) [, l* y
" T' Y' d# X v+ L9 r4 w
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):" U' K/ ~8 ^$ T% z7 E" m5 J
14) f6_bubbles_dyn 1 E# `/ V) w l7 @& {15) f6_linear_dyn 0 p8 j( Q/ l3 }, ?16) f6_spiral_dyn" @# o3 y' _7 U5 k8 M
% F& @) U1 h' y3 M5 `& Q
: g+ L' I: G) ~( K) Z! a) E: @) x) r2 j6 X
** in 'nnet' (all these require Matlab's Neural Net toolbox). |/ P+ i" C+ l9 ~2 f
; x- y& U# A$ Y: Q$ a) y- u1 u) ?! N
1) demoPSOnet - standalone demo to show neural net training. o2 e" z7 V3 a! V! a
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this% `' Q7 x# U& p8 y# @& G6 E
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize 7 Q+ F, ~1 A9 { 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run3 E+ ^' @4 H8 _. S' ^! k+ F$ r
( X6 O3 O) i2 c7 l$ ]