PSOt, particle swarm optimization toolbox for matlab.$ E6 i9 d/ u* {
3 Q. R4 V3 V8 d" E) z2 I* G* S
May be distributed freely as long as none of the files are 1 M+ r* M+ a5 `" Q4 w* u, Y5 nmodified. ) J' e* }7 i' W/ ^% k! ^ * ^) f; V: c6 \' Y$ rSend suggestions to bkbirge@yahoo.com + M ^. N$ b% m; ? 1 R4 `9 A9 a" W1 cUpdates will be posted periodically at the Mathworks User 1 E. ^6 s" r A5 a, O& K& q
Contributed Files website (www.mathworks.com) under the / m/ b! ^* M. o0 V- {9 J6 f+ qOptimization category.1 i* {4 P# `! p$ t2 z6 } E( c2 F
1 S; ?0 u! ~; l8 B8 l# O; _8 iTo install:/ D0 J$ {6 ^$ \9 P
Extract into any directory you want but make sure the matlab 7 m& ]2 O D" k8 \) D4 z+ Wpath points to that directory and the subdirectories " G) Q( b9 z0 O
'hiddenutils' and 'testfunctions'. G+ J9 X( |7 I. | . s. h2 C% W O$ N! TEnjoy! - Brian Birge 5 A" J: W" Z) i; m) y6 ]6 ~8 l M/ P) k: G- {
------------------------------------------------------------- ( G) A) | ^1 p; \7 ^8 Q" K i-------------------------------------------------------------" ?& @) f* E; Z( y, s5 j# G; U
* r/ f/ C, F" r3 A- `, O* UINFO 3 s" Z ^9 H& dQuick start: just type ... out = pso_Trelea_vectorized('f6',2) & R+ O/ k _5 g
and watch it work!; d1 J, o4 C9 B8 l6 t
' \1 V- Y1 a& S y! H, ?4 QThis is a PSO toolbox implementing Common, Clerc 1", and & K! x' ?- s! M4 [ G& P% ~
Trelea types along with an alpha version of tracking changing9 b+ A# u) r" h
environments. It can search for min, max, or 'distance' of ) c x5 d @. `' |) a- C! Juser developed cost function. Very easy to use and hack with ' U4 @& l* q0 R* J; z9 G8 d% C
reasonably good documentation (type help for any function and 5 u F8 J- }: X$ Tit should tell you what you need) and will take advantage of - t9 V* u# A( v D9 m Cvectorized cost functions. It uses similar syntax to Matlab's3 ^( ?# R# V0 {3 h' o) H2 \* h8 U/ a
optimization toolbox. Includes a suite of static and dynamic , v2 k. [ F! O. n
test functions. It also includes a dedicated PSO based neural , t' v4 k+ l2 H! z, Y$ p2 Z
network trainer for use with Mathwork's neural network toolbox.9 H/ _( s1 P) J& E% |
1 Q% F4 z, G( m0 O3 \$ [0 a( V+ nRun 'DemoPSOBehavior' to explore the various functions, options, ( ^8 ^4 z# ?# v, w
and visualizations. 4 h! q/ E( h! E8 Q+ m4 b& A6 p% W
5 t. |& t0 S) m+ I
Run 'demoPSOnet' to see a neural net trained with PSO , I/ }& ]3 o: _/ R4 M( m(requires neural net toolbox).- }& g& _# T4 ^6 h W
9 r& m$ X; X, w, G+ s2 M L2 ^
/ V6 p9 p D4 u7 Y) t( A- @This toolbox is in constant development and I welcome 2 g0 T" M. j6 A; [4 t: ~- i# N. t7 w; U
suggestions. The main program 'pso_Trelea_vectorized.m' lists 2 F1 Y2 I/ I6 n8 Fvarious papers you can look at in the comments.7 x' O% {1 b* |' c& C
x) ^9 F% c: H& v8 z
Usage ideas: to find a global min/max, to optimize training of + N( s: x! c3 f8 m5 Q% R7 H5 h5 k
neural nets, error topology change tracking, teaching PSO, 4 T" G0 ]3 W2 \2 @8 A* h2 g. kinvestigate Emergence, tune control systems/filters, paradigm & ~7 I; \- M3 T6 p; q3 z2 k% [7 zfor multi-agent interaction, etc. ) {5 H8 `7 |% H9 V$ k. ^! {0 D7 S8 M( P+ e7 P
------------------------------------------------------------- 3 @3 w# R6 U6 k% P! L; _-------------------------------------------------------------$ f& E7 d' B$ t' i; y
+ f+ D3 a* O w$ V) e; c7 _3 v( j4 S$ C
** in main directory:% {8 d6 W! o/ V6 ]
" m; G0 R3 Q2 F0) ReadMe.txt - this file, duh . R1 S# Q+ K. d1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO : f" z8 z2 K* [" n, R) J2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called 1 K# a" A- m) z( ]& c3) 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+ y9 o5 Q% z1 C1 F( l4 ?# M
4) goplotpso.m - default plotting routine used by pso algorithm( Q) L" g2 C5 I: X& b9 \6 U* m
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.( }4 {2 o( @ x G. J
- p1 j* U( h9 Z* X2 U! d% H
: X6 s/ D+ {& Q- ] 1 J: E# T/ a( P* d: t7 H1 |& }2 x A** in 'hiddenutils' 4 F) d' u5 T9 C3 d" b2 `3 Q, k$ F8 `) V& Z" P& [# ^6 s
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 algo2 t. ?+ t. j' A
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible " Z; R$ P& V E( L- m% U3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory( }' B3 j; q! P
) {2 Z6 _2 Y# E5 w, s
. p0 K$ z# G0 P* g* j1 p6 z, M( y5 g7 |4 o: @$ }, V
** in 'testfunctions'5 d3 }6 j8 ^5 ]" Y! z
( V/ i! e; k" ^ T
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: , y3 m0 v/ [7 h% v9 _+ \ , p0 @, }1 P& V, U% n$ f' eStatic test functions, minima don't change w.r.t. time/iteration:8 {8 L+ q& S9 \$ r) Q. i! ~" }( a; l" D
1) Ackley6 [6 ]7 S2 \! M7 f4 m) j; L
2) Alpine1 i8 x. @* F- c5 h7 G' q. y
3) DeJong_f2 2 ?2 c9 d7 S1 h! L, I 4) DeJong_f36 t' [5 |; d. C' s- l
5) DeJong_f4 i8 b* _: S( M" i% B# ?# ]0 p9 e8 z. T 6) Foxhole $ S% p, n% ^ j# U% h( i 7) Griewank % j( s2 y; v+ e5 |$ c1 Y 8) NDparabola/ N: _: i5 e9 Y4 j5 E* h% Y4 e
9) Rastrigin0 P0 o ?# A) v: M) K& s
10) Rosenbrock ; W" j6 K3 f- W7 a0 u11) Schaffer f6 0 T8 [8 ]1 J7 R3 Q, l12) Schaffer f6 modified (5 f6 functions translated from each other) u8 Z% R: }! x) J
13) Tripod 4 M( r# \' N" k: g # g; `8 h5 _5 s4 h: b* S GDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):% b8 R: R* t: ~# Z: f8 E
14) f6_bubbles_dyn ) `( O( O# U r5 @- ]' k; _! y15) f6_linear_dyn . B- u" h! s" t3 X/ J% r$ E16) f6_spiral_dyn8 Q. h2 [. n4 `, P, {; n! c( n
4 j0 u6 O. V" L6 p- m
4 X8 }- X- I" D5 I9 D
3 Z8 Q4 T, @2 M/ J3 I, c+ D
** in 'nnet' (all these require Matlab's Neural Net toolbox)" H$ x$ q, v+ ?4 }
+ F9 n6 u7 |' @4 \
1) demoPSOnet - standalone demo to show neural net training: g! Q7 v _7 x) N
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this - j/ F( y+ ~7 V# t; c! x; c 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize7 r& o% |3 H4 H% `
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run ) d1 W J2 ?4 x3 z & w1 `, Z& v; I; G I+ P . ~, @6 ~4 U+ K1 J$ `5 m