, S4 A" c: {, FMay be distributed freely as long as none of the files are 5 L$ ?4 _$ o$ n4 c
modified. ; a5 W5 j9 ]# r! u+ ? x* c- T' N& I6 d6 _/ H
Send suggestions to bkbirge@yahoo.com & O0 w- a0 @* Y9 c, u
1 J w0 c2 N2 w( }
Updates will be posted periodically at the Mathworks User 6 K7 o& ^/ W6 X" i: @( d
Contributed Files website (www.mathworks.com) under the # ]3 `6 Y; C6 h& a4 c: K
Optimization category.2 V% [. O2 }; u) U
$ _' y* e& q4 X, D+ y( Y( ATo install:: e% F/ V2 _( k: K
Extract into any directory you want but make sure the matlab . N+ Z; M0 I8 F: _path points to that directory and the subdirectories % q7 [$ ]# _5 t4 I" n
'hiddenutils' and 'testfunctions'. . S3 g1 R& x/ Y" C: b 9 x2 s5 @' a& YEnjoy! - Brian Birge0 C: s; N* W& s& V1 B3 |* k
6 H- D8 [( v* h$ _- {-------------------------------------------------------------& X+ {& t! M S: v. D2 T
------------------------------------------------------------- : ^# O& Y& V( i: @' B* d; W/ A 8 C+ ~; b. Z7 K l2 S' K0 eINFO ) }3 e) R' @0 AQuick start: just type ... out = pso_Trelea_vectorized('f6',2) }# b% H: u" u$ dand watch it work! . d l& |: F5 ?8 F" U4 D/ _0 G* V# g8 t
This is a PSO toolbox implementing Common, Clerc 1", and 6 Y- K) Y+ E+ [* ~5 jTrelea types along with an alpha version of tracking changing3 O2 p4 s1 |- N- K! [7 E+ L
environments. It can search for min, max, or 'distance' of % {1 ]8 L6 }( B& {8 U7 {user developed cost function. Very easy to use and hack with ! B; q5 E' R; w! }3 N* i( p8 R$ q# }
reasonably good documentation (type help for any function and , L, F( L" q9 c1 {' m6 d+ rit should tell you what you need) and will take advantage of ) I p9 o7 r( V- F) mvectorized cost functions. It uses similar syntax to Matlab's4 Z1 C% [' u& E* k; j0 p, u& M
optimization toolbox. Includes a suite of static and dynamic ) F* |4 C: x' c/ V. D5 U4 U; z' n8 dtest functions. It also includes a dedicated PSO based neural 1 j% U; Q; M1 [! {# g
network trainer for use with Mathwork's neural network toolbox., s$ O$ U# H5 m8 @! L! E+ p
- l# C% X. N8 r! I* y5 g. r9 d/ r. d8 `
Run 'DemoPSOBehavior' to explore the various functions, options, # u; n" V# [, C
and visualizations. , `6 y' P1 h# G& Y$ ^. M # {0 c" c" I% p. o: Y3 o4 PRun 'demoPSOnet' to see a neural net trained with PSO . e( e8 e, L6 k+ W/ v: u& _(requires neural net toolbox). - L' l4 Q/ D8 `+ B& z/ I" i; }, |, }/ B( T0 B( J9 R1 `. P8 [
+ P$ e- c3 d; I( dThis toolbox is in constant development and I welcome ' a: R! m: c5 ~/ v5 Rsuggestions. The main program 'pso_Trelea_vectorized.m' lists 6 u) `) U, z f3 |5 l
various papers you can look at in the comments.* }. a9 \7 j" y/ f; D
9 C8 @. O M1 s) v
Usage ideas: to find a global min/max, to optimize training of , M0 x ~1 N3 B v" G8 z3 Z& Tneural nets, error topology change tracking, teaching PSO, ! ]* U0 {: _3 z
investigate Emergence, tune control systems/filters, paradigm ' a' z$ [ x9 Q/ ^) s) }for multi-agent interaction, etc.* ~7 ^2 }) z: h6 |% j9 A. W9 @. L
5 p6 g1 j# k2 l( z3 l) E** in main directory:5 |& j* N* B1 \" I
5 }9 F8 U5 f. c+ k- u0) ReadMe.txt - this file, duh! @! ^& ]7 s5 h6 k9 ~
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO Y: m# v7 t: O% t2 a: W" I2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called 5 K+ z+ M! e( q3) 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- M) N' `- A9 ~ C, t. w
4) goplotpso.m - default plotting routine used by pso algorithm ' ]0 d3 o; r4 g5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. ' |7 Q }! H5 J: N& v: I; m& a3 k% d" Y6 S2 Q3 D: T
, k6 t4 j. E$ `8 D, e {/ ? ( d0 }( s) j6 m2 k# |** in 'hiddenutils' # B% J- r5 _! Y" C q4 D- E + W/ x0 F `. D- y/ E, ]" H1) 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 , T+ A' O; z- t0 k, c) w2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible ' j! O8 R0 Z; c% v* P& }3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory ) ~. Q1 \4 n- V2 B S' k/ X# c ! \( U4 f% C& M7 i. ^0 x: l; d6 D3 s5 Q6 P8 j6 _3 s$ `$ S
' n! P$ m/ O) P! L; D# c9 [ K
** in 'testfunctions'/ e _! D- P# [* I' M+ F- B5 u* l( i
4 R5 q/ p: b; [; J# x- s f
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: 1 C, c& N+ C4 D) ]' T$ y6 U5 i9 N" P8 a0 w) `6 Y2 {1 ?! T
Static test functions, minima don't change w.r.t. time/iteration:9 H* O( x0 Y4 D u* m) w
1) Ackley) N; Y* y( U$ B1 ]7 G& S
2) Alpine1 L( o: G+ Z5 j: b; R4 {
3) DeJong_f2 5 b' a2 P3 a$ Y# i# I 4) DeJong_f35 O2 z) z& O& y, Q+ h' A2 x9 r
5) DeJong_f4 + q R% I0 G- c( V 6) Foxhole6 n% a: j% ?) c
7) Griewank - |. s- j9 N' q9 u 8) NDparabola4 B5 {! Y) x- ^5 H2 H& l/ ~; e- m& f/ C
9) Rastrigin) {4 O9 Z0 {! U' e5 O$ Y& w
10) Rosenbrock 5 i, Q' ^ S' ?# [" p- Y11) Schaffer f6+ ^- C# }5 c5 m
12) Schaffer f6 modified (5 f6 functions translated from each other)6 }; L1 l# r4 z/ S% @4 d% d
13) Tripod . M$ ]5 U, Z+ [/ g4 ^4 X ]9 ^4 C* Q! d$ m, M- J
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):" z- j; Q8 n# h/ E; u7 f
14) f6_bubbles_dyn ! d, D6 |1 F& A# e( b15) f6_linear_dyn/ [6 h' z6 |& u0 S7 a6 F
16) f6_spiral_dyn : P( }* b* A' v& B( K( p8 A- `: a5 {: r* {/ _9 K& c P+ s% ?
8 u9 Y) f! E. x V- W . @4 q; s Q- i9 S) n4 r/ L8 R0 \** in 'nnet' (all these require Matlab's Neural Net toolbox)- c h. b$ D% [# [/ m) Y! C
; K0 Y/ I6 G. r* c- y5 s 1) demoPSOnet - standalone demo to show neural net training . Z/ h: y# y5 G3 j 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this" a/ s2 m; Q8 Z4 F
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize / }2 v' _9 P8 R+ U Y' N7 X6 J$ f 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run6 z3 J8 H+ F1 ?: M# X5 w