PSOt, particle swarm optimization toolbox for matlab.) m: h W( j4 g' }! k7 N
1 F4 s' e) n- S4 s5 H) HMay be distributed freely as long as none of the files are % k# V, x$ x! y O( k \' Y2 {0 p
modified. ) |, A5 G. w1 }3 |8 U7 j( a1 b3 B6 f" b/ b
Send suggestions to bkbirge@yahoo.com 2 x3 {* p1 G; o; m ]: u4 S
2 e; M2 d9 u) |# L G& F8 FUpdates will be posted periodically at the Mathworks User & H3 K. O7 O7 Q( }
Contributed Files website (www.mathworks.com) under the % v. G3 x* b& o3 ]! \5 x$ vOptimization category. ( J+ A# y6 ] c( o * S( g: N5 s2 ATo install:8 @1 M1 F+ W# ]3 d0 P
Extract into any directory you want but make sure the matlab ! H" u1 A' J5 R- v9 x3 a
path points to that directory and the subdirectories ( z0 j+ z: ? j! c
'hiddenutils' and 'testfunctions'. * }, ^- t# C# R! l
5 K- J. o0 u$ d9 Z8 e3 b% M7 G
Enjoy! - Brian Birge & ~& O* M% ~, s5 N# |# R' E0 S
------------------------------------------------------------- 1 m& d4 U: S2 j6 C-------------------------------------------------------------+ @: w8 W3 N. {$ g+ M
6 K* q& ~6 J9 ^) b% s1 y" U) XINFO l# j0 [% U* n! d$ GQuick start: just type ... out = pso_Trelea_vectorized('f6',2) + p; K7 T/ ?* Cand watch it work! 5 y6 q6 |9 L2 a2 P7 y ! e7 i" _. |- W' y% Y" E9 qThis is a PSO toolbox implementing Common, Clerc 1", and : x6 y, j# n7 F& q: _Trelea types along with an alpha version of tracking changing- q1 q) ?- F9 m" k6 u \ m1 ^
environments. It can search for min, max, or 'distance' of 9 D1 Y g% V! d+ Puser developed cost function. Very easy to use and hack with - ?( Z0 |- c) J6 R0 T: C8 Areasonably good documentation (type help for any function and. v( p# a+ i3 E, U# P
it should tell you what you need) and will take advantage of , A- V M; i2 I7 a- u$ i
vectorized cost functions. It uses similar syntax to Matlab's 2 {# p$ n& V- N; N0 M6 Uoptimization toolbox. Includes a suite of static and dynamic 7 Q, C6 @3 N- R* m! F: H6 D
test functions. It also includes a dedicated PSO based neural : }5 N. U4 H( Q8 r
network trainer for use with Mathwork's neural network toolbox. 6 F ]2 V. t+ v% N: z1 N1 [% {, I7 n( j) W4 f4 T$ \6 g u) N X U% I1 A
Run 'DemoPSOBehavior' to explore the various functions, options, 4 _0 j* v# E j, M; X5 d0 N$ o
and visualizations. ) D' N, O$ U$ j5 P! d4 L8 i' z4 Q8 i% E- a: e, e; O
Run 'demoPSOnet' to see a neural net trained with PSO * w l# u! L) X8 @) _% Z, F! h(requires neural net toolbox). + _& S( N- u& m 1 U& v. ?+ p, N( W. g* m( M + K" x0 y9 w& |1 ~0 f$ q/ qThis toolbox is in constant development and I welcome 7 ~$ L; P) U- C: n! Usuggestions. The main program 'pso_Trelea_vectorized.m' lists % a& Y5 N! N2 F3 @' |
various papers you can look at in the comments. - ~0 r( y& A8 Z5 q- ` 4 j) ~: N* I* NUsage ideas: to find a global min/max, to optimize training of 3 r! H) V/ @0 f% S2 R0 p: dneural nets, error topology change tracking, teaching PSO, 4 [, m4 [/ I4 p! o) @investigate Emergence, tune control systems/filters, paradigm : F# ^ W# W& K' sfor multi-agent interaction, etc. 5 Z5 O: L: r* t- _6 A# @6 X! l1 c# A/ x1 H; N W
------------------------------------------------------------- " |* j% z0 W8 A' A) r------------------------------------------------------------- # X2 L0 H! G9 @, K- i; m% S 0 p4 }' C/ P! A5 {6 {# v. Y' D9 ^5 S2 ?3 n+ c
Files included: ) [+ u5 h6 U* E0 h& z2 g0 V8 M N% t, z: X
: q' o% o5 x4 e9 i
** in main directory:5 W" X, P3 r4 G5 X
& x; c9 T( V* s* [( I
0) ReadMe.txt - this file, duh % u& j3 [% G& g% ~: M1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO # ?4 z: u1 m2 J' }2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called& E; u2 ^! |- N" N, R
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 * I# D7 e" p- X0 Y0 s4) goplotpso.m - default plotting routine used by pso algorithm / \4 { U/ c) ~5 D5 x5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.: _' g9 z; c/ ]2 v
2 h& l" X4 f" s- d' H+ z; l, [! U : V7 ~/ l$ j' D& U. R" y4 S6 O+ _! u& i- ~9 W% u
** in 'hiddenutils'! v; {* f: {: J
$ P# c) F7 ^4 W1) 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 $ U3 B, v; |, r5 f2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible 0 P8 J& k" {: `/ H: c) w3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory j/ F3 z x, O9 x/ D ( H0 ?8 S6 v5 _; B" M # b u7 s, P: A% T. S6 f8 J6 }* {" z; [
** in 'testfunctions'; o" [) {- G5 z* F, U6 [' O' }
* P! @3 G% ]) z, {
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:/ P% q1 n, s8 ~4 x0 n
* Z7 W3 b% s4 W7 v) K7 F+ j$ w
Static test functions, minima don't change w.r.t. time/iteration:, f4 L8 V2 j% `0 N, `
1) Ackley0 u1 M2 J( e/ r: ^0 `( m( e
2) Alpine . R$ b6 v+ F2 b; Q0 s$ H0 ? 3) DeJong_f2 2 P* f+ t& X/ h) c0 D; M 4) DeJong_f3 0 I& l& w; x* r$ A 5) DeJong_f4 / u, I4 _: s1 y, Y. a 6) Foxhole , ~( m5 L/ h$ [6 g, j 7) Griewank. {* q, U( S$ R1 M& O
8) NDparabola8 ]: [/ F) [# e& `$ f0 o4 x- A
9) Rastrigin$ u: c& f' u2 L
10) Rosenbrock! W" d' m) x* S( _8 W I
11) Schaffer f6" N; ^+ p2 Q3 K7 O6 o' f
12) Schaffer f6 modified (5 f6 functions translated from each other)% ?" D" Y( `- @
13) Tripod / C/ j9 q& x% V% W# [$ J+ Z9 s9 v5 J: h; E4 |4 c! k' N
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): ; S* G; r- D, ?14) f6_bubbles_dyn8 U m Q# t% G0 U( L" l- b8 u
15) f6_linear_dyn9 p+ s" S' f1 V' I
16) f6_spiral_dyn6 Y" d8 i6 a# ~/ V7 V3 O/ K: A
. t3 B% w V; _) {
% C- U! R# H( V4 p+ w; y* `! o% z* |& z7 }! U. ~3 W) Q
** in 'nnet' (all these require Matlab's Neural Net toolbox) # {: U5 b# A1 P$ H! y* h9 b& ~8 B, `! J7 F6 Q5 a* _" ? r+ y
1) demoPSOnet - standalone demo to show neural net training ' v! c5 I& S3 J. \& E0 m8 r1 N8 a1 L 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this & h( U# L5 Z* m4 l* b. E 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize 1 E( C3 @1 Q. n+ L 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run 1 B& H( v* l& T: ^% b; a, |% w( B ~! }# t5 ^3 [8 `