PSOt, particle swarm optimization toolbox for matlab. . [5 ~: e1 K" ^$ O$ A; J* q2 M2 ?$ ~& Z! w. M/ o. T" t' b. P
May be distributed freely as long as none of the files are / ?) R# B/ I' W! e+ c
modified. 4 X0 x$ j: _, U; h. m* V
% Y9 I8 V) d0 Y- w/ l" Q( o
Send suggestions to bkbirge@yahoo.com . t x+ R: G! A& r$ |8 e
/ m, j4 }4 j( B% L. U# i. }2 u$ vUpdates will be posted periodically at the Mathworks User % G. g7 `% K" X8 Y- p' o
Contributed Files website (www.mathworks.com) under the ; M( i O* y2 Y
Optimization category. 5 r: g, |2 ~- f' N3 w) V: |( r0 Q3 ~
To install: `6 r+ z0 R8 ^8 P9 r; g$ k* f
Extract into any directory you want but make sure the matlab . b' ^) c% h1 H9 f9 R
path points to that directory and the subdirectories # R. T1 B- X# l* J5 [+ k+ k'hiddenutils' and 'testfunctions'. " M5 s! F {5 }6 W# h) `4 n E
, D: x9 L9 s0 R' H& L/ ?- lEnjoy! - Brian Birge - q" r; M* C: V 0 B, I4 W4 m1 Z8 l. R------------------------------------------------------------- ' j6 n6 H7 K8 A2 D1 l-------------------------------------------------------------+ b7 X9 v* F1 a+ z
( X0 F! i! }' a& m
INFO 9 W7 P* s Q, _# y5 b( C7 [Quick start: just type ... out = pso_Trelea_vectorized('f6',2) 0 j3 k/ Y% J- c9 C' n
and watch it work! 6 h9 c4 v5 X- j& ` : D6 }' e. N$ ]3 j F: `2 x$ O" vThis is a PSO toolbox implementing Common, Clerc 1", and ; B T2 P6 C0 {) Q6 h, vTrelea types along with an alpha version of tracking changing- `: @$ b* F Y! w( \. D' F
environments. It can search for min, max, or 'distance' of , t+ S5 z# F3 q9 [/ x0 Euser developed cost function. Very easy to use and hack with 1 @, F+ X- j' Y$ n
reasonably good documentation (type help for any function and. Y( v) ~* L. C0 r1 j( C% p
it should tell you what you need) and will take advantage of 4 ^0 @( M/ K2 M/ W3 @
vectorized cost functions. It uses similar syntax to Matlab's & ] b6 b: V$ D2 T" z+ e" poptimization toolbox. Includes a suite of static and dynamic & E- w5 x/ l8 `5 z2 @test functions. It also includes a dedicated PSO based neural 0 v9 j0 z& U9 N1 U7 A( o; [( A
network trainer for use with Mathwork's neural network toolbox./ h9 C* h9 K: }+ c' e L9 o
9 |4 N% p3 ]$ c) A
Run 'DemoPSOBehavior' to explore the various functions, options, 9 I: h o/ Q# {7 [ Sand visualizations. 1 O; r3 n5 I; Y7 m( Z$ ~2 n( ? ( C5 n/ w* x7 V4 `: lRun 'demoPSOnet' to see a neural net trained with PSO 3 {: ]* U! t# Z+ T$ C, s! V; @(requires neural net toolbox).0 J2 w3 V8 }5 s) Q- q
1 h2 Q- j1 h6 E) Z 8 n8 Z8 B4 w8 \: x8 {, _* A6 V. C; r/ ZThis toolbox is in constant development and I welcome % `+ v- f7 {4 j. W* d- ]
suggestions. The main program 'pso_Trelea_vectorized.m' lists 0 u5 M3 @1 w j
various papers you can look at in the comments.# z% b! y m, k6 }* ?6 p
$ g O1 P5 t7 m; _9 i3 ZUsage ideas: to find a global min/max, to optimize training of ) |- g1 ]8 E7 X- Y, Y. i/ g, w8 Oneural nets, error topology change tracking, teaching PSO, , m9 i; u' {, c; l; rinvestigate Emergence, tune control systems/filters, paradigm " I8 c! \8 H- ~9 w# U
for multi-agent interaction, etc.1 R* A6 M9 W% I! h
: W$ B+ a$ H- I2 J) J& C
------------------------------------------------------------- h5 R# O/ c: T5 A. ~------------------------------------------------------------- 7 o/ e6 L: \- C/ }" v3 m" `% A5 s* u5 }
0 \8 a) H' t3 R$ x7 M( c1 r
Files included: 9 m' |9 U3 q* \; J - E; p7 l6 X" u6 [: ^5 h6 n* J9 |/ }$ D& ]& P0 G n
** in main directory: 1 L/ R9 X( m' A! w. n# A0 g& i8 U; \. ^# [# Y1 x2 q
0) ReadMe.txt - this file, duh 5 c" L, ~$ c6 j" _1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO# L5 `: b3 j; H% w- G8 d
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called % ]3 r- n. C9 \# i7 ~& ?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 / [# @9 j6 {+ I- c4) goplotpso.m - default plotting routine used by pso algorithm, Q7 y( A4 B3 s: j! h# A6 ^9 U
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.( v9 I9 P, D1 o7 o" A- \: A
) G S5 \6 q# }- H/ n# q& j9 ]
! R+ C0 N- ]3 M, M% t8 Z: d 9 B: p8 s5 W# M1 r** in 'hiddenutils'; P* E) `8 g, k+ k1 l: u0 r, ~
- _0 i2 ~+ e" e3 L' U4 V) S1) 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 # a5 [7 c3 m b2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible6 {7 _7 d- Z+ h! A/ a
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory ( t, u( d. U& a: ^0 r7 \" A- h. p% l
9 y4 T1 O( w; Z" b- v9 p' l 2 i+ _8 p5 E5 P. V** in 'testfunctions'+ I+ n; O4 ]3 b' U4 R% J0 K
7 Y) `( \3 K, e! C
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: " a# t/ X2 K* `' J; B- ^ 6 o) X( o! @( p @) BStatic test functions, minima don't change w.r.t. time/iteration:" j: I2 U# N8 D! t k3 u1 B
1) Ackley4 a+ p+ ?6 q" s6 O5 Y" G
2) Alpine + q6 r: [2 ]" Y9 c* _. k! K 3) DeJong_f28 H) u/ |5 ?5 A- O; P" N) i
4) DeJong_f3 & d0 Z% ]$ _5 p. W3 a# o# a 5) DeJong_f4 5 v( v: L, l9 K% B 6) Foxhole3 N$ w! A3 W# |% f r
7) Griewank' v3 q8 F. t8 b# n" K
8) NDparabola 5 r4 }( `# u1 y9 G3 W* J 9) Rastrigin ; c# I& r6 W; ]8 P10) Rosenbrock - e0 @% p. Q. a4 m0 X- ^11) Schaffer f6# D# i s$ D. t2 J2 L
12) Schaffer f6 modified (5 f6 functions translated from each other) & I2 Q4 j. F' t8 z13) Tripod6 x( C* M7 E0 f9 {1 @9 P
6 {. ^; X* ?$ f$ f) N
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 6 T; ?, H7 H) F4 A2 Y/ r7 P14) f6_bubbles_dyn . o3 f1 D0 C- C9 {0 G15) f6_linear_dyn ! c, I5 [! i- Y5 a) `16) f6_spiral_dyn 5 E4 s0 h- d+ v" R1 D 2 L1 _5 a# [( U* k- Z. V : l5 m* c$ w/ H: m, A. f7 _) e: U0 s% E' O+ }
** in 'nnet' (all these require Matlab's Neural Net toolbox) " E% Y% n9 Z9 C4 j9 e6 E$ g6 d0 X8 v& M8 K/ g' X+ e- x" H: {
1) demoPSOnet - standalone demo to show neural net training1 M0 _1 I) a7 g$ Z( V
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this+ I1 H9 D+ T; J( N$ S" r
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize . A; c8 |# m6 \) V7 N3 ] 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run# o! F$ k9 r: h' p- T