PSOt, particle swarm optimization toolbox for matlab./ e' L4 O+ f8 L c$ K
`! ^5 o% m8 t+ u: P
May be distributed freely as long as none of the files are 0 g& O- d3 C+ N3 emodified. X8 _3 ^! T k + @9 W/ S* x$ c! t" TSend suggestions to bkbirge@yahoo.com % L7 o1 \ z o) Q! B$ w7 v. A: a$ n
3 f% C6 g$ Q9 l6 AUpdates will be posted periodically at the Mathworks User 2 G" }$ E" Q" e
Contributed Files website (www.mathworks.com) under the + d$ G# B% m1 l/ O7 POptimization category.: h/ Q; r# @+ o8 u% _8 F
! {. N. g1 R3 d5 X8 {, h
To install:/ Q. }4 o" L2 z0 `5 G: X
Extract into any directory you want but make sure the matlab Z0 s( }5 h* T9 N, cpath points to that directory and the subdirectories ' c, L6 n( l" D( K'hiddenutils' and 'testfunctions'. 7 q Y& L! E& p3 |& I5 R* m; c7 n( R3 T/ O7 F6 c* N* w
Enjoy! - Brian Birge% J) l7 K* J7 N4 O$ Z- M+ z
- X) C6 k3 A) ?. H5 X3 f
------------------------------------------------------------- 1 N$ F: `* ~ d( u* @5 m+ |------------------------------------------------------------- ! ^2 S7 Q1 I8 x% B : u- \( _9 B9 y: f2 a+ Q4 kINFO 0 [: S9 I+ e: F3 L* RQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 8 Q% M9 y! |) J- ~6 \+ R0 B% l/ v/ uand watch it work!! @) j* [/ d: O
1 a3 N+ X1 g0 u5 n \, G+ T# p1 a- K
This is a PSO toolbox implementing Common, Clerc 1", and 0 x7 G/ T: _1 s* N5 mTrelea types along with an alpha version of tracking changing" f6 T, g& {# K* |6 Q
environments. It can search for min, max, or 'distance' of 8 T% N# ^* [% G9 U# `
user developed cost function. Very easy to use and hack with 2 s. @) v0 e0 Lreasonably good documentation (type help for any function and 3 u* y6 t" j2 x, Yit should tell you what you need) and will take advantage of 0 d& { y0 Q$ h# p
vectorized cost functions. It uses similar syntax to Matlab's . w2 f. x- r$ R: _" woptimization toolbox. Includes a suite of static and dynamic / n- E+ L9 g5 S! K3 T4 j
test functions. It also includes a dedicated PSO based neural - E6 B8 z; S. }" o( ^
network trainer for use with Mathwork's neural network toolbox.; o) j( x3 u, N' K4 N
) R6 L/ P, ]/ f( c" r# l C/ J
Run 'DemoPSOBehavior' to explore the various functions, options, . X0 \! o5 n2 V& U7 yand visualizations. 3 d+ i& D1 a* U v$ k* e; s7 a1 M D
Run 'demoPSOnet' to see a neural net trained with PSO ! ]$ Z' G) F y T. E' U2 V(requires neural net toolbox). & m* W) L/ ?# Y1 E 9 p3 J# P5 I. o6 R$ V D- V$ P* H6 _+ ]# g! m: \This toolbox is in constant development and I welcome 0 J' }; @) n! ~( Q/ n' _5 |suggestions. The main program 'pso_Trelea_vectorized.m' lists 6 X- D0 _! T) D+ A2 A* S- `
various papers you can look at in the comments. 2 X+ w* Y; a5 }, h$ e4 R1 @& c$ c0 t2 m
Usage ideas: to find a global min/max, to optimize training of - V4 S4 G# E* l R3 Y0 Z0 bneural nets, error topology change tracking, teaching PSO, & v, N9 N4 I& n" R. T
investigate Emergence, tune control systems/filters, paradigm ' { W! |2 F9 Z) }! Z) rfor multi-agent interaction, etc.! O% i/ |+ D5 b
: M, m$ T R# M7 Z) J------------------------------------------------------------- e* L+ o; W9 P/ e7 w
------------------------------------------------------------- # D% B) O) D0 ?/ o* X# o! j# L% q# ]- B/ N, g
# E5 Q* U* ~9 r, m/ C
Files included: 5 x/ c: p1 K1 M3 b5 @4 }# k+ i8 a# d Y% u$ J1 C4 @
0 R+ m8 I8 h7 n J5 R2 E
** in main directory:9 M6 c% _: a* v8 V1 m) l; k
* ]9 t) Z: C' X8 } w0) ReadMe.txt - this file, duh- Z+ H& g1 o u+ y' t
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO7 h/ `' a: Q% ?- l7 n9 c- o
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called$ k9 k! N2 e$ ?7 Y
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 lot0 J0 m" V V4 m$ I/ W
4) goplotpso.m - default plotting routine used by pso algorithm6 o( G# A- k+ l
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. $ A) b( k9 A* \/ u& A: o ) A, F2 B' s2 Y! c * k Y/ D; I4 J" u' K% C6 u' d, | ?+ {) o9 S; x! |
** in 'hiddenutils'! ~' g) c+ ^/ F: `9 k
* v) X4 A c1 N9 ~/ c( o" L6 p
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 4 i S0 ?4 ?5 U: u: C ^2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible ( _ o6 U3 N1 b3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory7 [8 Q& y. B$ ?( @ S
: R- c4 l" i$ G- r0 ^; }- V
3 h' {, ~6 m4 q: k
! X; m' Z! u/ C5 u- a** in 'testfunctions'& Q& J" g0 K0 Y# W! I* Z
W8 S0 L/ _, @, O0 a6 W. i
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:) R+ u$ r; n4 c/ z- N6 [& E- `
" H5 s1 z' B3 |2 N8 ~
Static test functions, minima don't change w.r.t. time/iteration:% g- X- p, E" s/ v' {+ R+ @+ S
1) Ackley $ C2 w7 ^3 J8 z 2) Alpine, I3 c' t6 |+ f9 u8 S
3) DeJong_f28 D: w$ h4 _8 v2 D1 ?. C7 f5 c
4) DeJong_f3 / I8 F2 N, b4 t- O {7 A3 F' V 5) DeJong_f4 " C) @3 t8 ~* {1 r5 W/ K 6) Foxhole % a3 c. ^& p$ y7 }6 ^' I) v 7) Griewank * E6 y% h# g, K 8) NDparabola ( Q# _) a; ~! t) A d e 9) Rastrigin$ O& P) `6 F! V8 _% h0 d
10) Rosenbrock 5 d8 d1 g% h( H9 a5 P4 j* F8 y11) Schaffer f6 $ Z- m" s- i9 h B2 w12) Schaffer f6 modified (5 f6 functions translated from each other) & g4 x- d' ~8 j13) Tripod 3 g) H- T* a) E0 s2 ~2 y / B% G& J) A8 g1 a- DDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 9 C: G, ]8 @+ H; z5 o, i14) f6_bubbles_dyn0 b! |5 |: Z u. K
15) f6_linear_dyn & Y$ i$ R1 v; _16) f6_spiral_dyn8 S7 t0 Z! x/ z4 O2 R6 O
# P4 M6 f, O$ k3 k3 A9 q' R0 e' p' D; G
' Z, l! S: C4 ^* d( P9 m
** in 'nnet' (all these require Matlab's Neural Net toolbox) + o1 T( ], H `, M1 m1 Z' q* _& H & n2 D5 x4 s+ H1 q; e7 I! T( ^ 1) demoPSOnet - standalone demo to show neural net training % `1 f/ k5 F, B* m6 f* Z 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this # ?+ j1 @6 j- \ 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize " ?5 q8 R) a. U V: E% l% M 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run, {+ f% x$ C' C
/ P: A$ v* ~6 b% c% q
/ b$ Y l7 m2 g5 j# j