PSOt, particle swarm optimization toolbox for matlab. i& F. b# T, u9 Z1 P0 k& p6 u" }5 g7 G+ ^
May be distributed freely as long as none of the files are ( s! a: L: i, H5 y; T# Umodified. $ }5 |1 F( r) F# n1 S# x9 ]& B" u' o" e5 ~, R% V
Send suggestions to bkbirge@yahoo.com ' O# \# Y4 M( y9 Y" n1 ?" y : ?1 z7 G ?4 Y* u1 N! h3 ?- ZUpdates will be posted periodically at the Mathworks User / M. o" A% Z6 l8 _2 U* E+ S2 iContributed Files website (www.mathworks.com) under the / l7 y9 V, c5 X3 \7 {Optimization category.8 D0 B- f9 Q7 L8 z9 b2 y: P- R
/ ]8 X. q9 z, }. f5 E. D' s
To install:" Z4 H* `* i4 v$ G4 O
Extract into any directory you want but make sure the matlab " ] D" o8 C7 O6 n7 C8 x, |path points to that directory and the subdirectories ' ~! ]& n7 J1 ?1 n'hiddenutils' and 'testfunctions'. % U# j2 n( Z, c" N - z3 h' L+ u9 ]7 K1 e6 B% q REnjoy! - Brian Birge 2 k5 s2 c0 l0 i' L ; E2 ?! _8 l3 C$ t# }/ O1 H------------------------------------------------------------- + x* t9 ~5 {; m+ {6 u" Y) p; F-------------------------------------------------------------8 U4 z' e: S, {% }9 V
; b. J' [% K) {$ {$ o; EINFO H0 i6 u& n7 \ b3 s8 c
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) % ~4 E: B7 T7 ^$ y9 vand watch it work!) @' {9 s4 T7 ^) Y, S
% N" j) A4 u, T- e1 L; zThis is a PSO toolbox implementing Common, Clerc 1", and : U8 E; h4 v1 U' r/ {
Trelea types along with an alpha version of tracking changing, p* V- {9 h" X( G' D* f
environments. It can search for min, max, or 'distance' of 4 q$ @; w2 |2 \2 huser developed cost function. Very easy to use and hack with * ^# u% U+ s0 c) Rreasonably good documentation (type help for any function and $ E8 Q, H g/ Tit should tell you what you need) and will take advantage of " C6 K2 q- C* h# {. T. Y
vectorized cost functions. It uses similar syntax to Matlab's ' H! _. ?9 Q4 T& e1 c- |optimization toolbox. Includes a suite of static and dynamic & S" F. q% \9 S, Y5 i# `
test functions. It also includes a dedicated PSO based neural 3 G+ [9 |" c$ Pnetwork trainer for use with Mathwork's neural network toolbox.1 C4 D( \, B2 ]
6 y( @. z& J) B5 A- F
Run 'DemoPSOBehavior' to explore the various functions, options, 9 A; v2 a u+ ^3 r0 l7 L
and visualizations. 8 |% A! Z; c/ _- }& P
; D+ @+ N3 t5 X/ {. x
Run 'demoPSOnet' to see a neural net trained with PSO 3 w/ z/ l% ?9 d- W( z# y
(requires neural net toolbox).% H4 s% y I# ?. K
- L( T" P' C8 b/ d, x; |' L8 C) V1 C, Z
This toolbox is in constant development and I welcome * r2 C7 S( N0 n# X/ _suggestions. The main program 'pso_Trelea_vectorized.m' lists ) ^) V/ D& w+ Y! u6 |8 r; U
various papers you can look at in the comments.8 _( n$ \0 {+ O* m* }) H
1 D7 j+ D# S( P5 N. t2 |Usage ideas: to find a global min/max, to optimize training of + E5 I- R, H- w, A
neural nets, error topology change tracking, teaching PSO, : B. i( U; ^" \) L5 i5 linvestigate Emergence, tune control systems/filters, paradigm 5 }% G9 @% }8 E5 L i+ `! M" } s; ^
for multi-agent interaction, etc. 5 A+ Y0 J/ d& `; Z$ U! q$ O; e & Z0 J5 b5 l5 s, o* Z6 O; L% ?------------------------------------------------------------- m" o7 Z9 m# t% |) J) {* A
------------------------------------------------------------- % f# j' l) J3 V* y S! t) x! A- J% }9 x5 x1 Y4 O
" ] J' D- M k; d: gFiles included: " q. q- I6 r5 ^$ k" `3 H7 t% V 8 {# N9 X, b! Z/ n( H& i) G% ^& p; e4 T4 W1 @
** in main directory:: N, X& n8 |0 t" k# s
9 E* C9 w0 v+ X
0) ReadMe.txt - this file, duh/ }& j, e1 |! A9 r0 x2 `' i* U
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO # l# L$ r/ M; n+ [2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called ( W5 I: O+ d9 X+ i3 M- G6 P3) 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 3 D; W& {1 J% c- u5 G- Z8 j4) goplotpso.m - default plotting routine used by pso algorithm ! \. @, {: l1 K# Q9 `' R& k8 C9 P5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. & R( y/ E- s; o# V 3 @- J! s. v4 S9 u( O . A& w( {& ~. D. G/ D : Y5 L s; n$ p6 I1 u5 Q** in 'hiddenutils'. h- g0 P2 N3 u$ @5 C6 T
/ O- i" _6 ]% F, a) r1) 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 8 {! }1 o2 F* t! C2 u3 J3 a/ a t y2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible9 T, L' i8 g" p- _
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory! G7 D& v0 q. O4 J
9 N9 l' S( G4 x, E1 Y$ y
" P8 C: Q1 a C& r8 w* f
, b* O1 ]! {6 s# q. l+ N** in 'testfunctions' * D6 d( J4 t' _ $ |. {+ @3 w) |- Z% |+ yA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: 2 u# q8 N$ s* w; i- n6 `8 q2 a% x, M+ C' q* G; ?
Static test functions, minima don't change w.r.t. time/iteration: # g8 z+ _+ l2 k" S, C$ q: o a 1) Ackley# G1 d1 Y! N6 ^; T9 ~
2) Alpine" i4 |. Q9 S# ^7 X! s( [) q
3) DeJong_f2, z+ v4 V, B/ ^2 o& \" i
4) DeJong_f37 C2 {; P4 o. z! e
5) DeJong_f4 2 o& I1 D1 U0 R& ~$ Z 6) Foxhole$ A6 F- u0 A' z1 q$ q
7) Griewank 1 P8 p* O1 J8 `: u# A) Q, A& D. S 8) NDparabola ?* M% O& E$ Y& @2 V 9) Rastrigin1 H7 @/ a5 o2 R7 D% l" [
10) Rosenbrock @: P _: U; ~# @+ N: P! r11) Schaffer f6# |3 p* c3 F \& T- h }
12) Schaffer f6 modified (5 f6 functions translated from each other)3 z+ D/ i4 S3 t
13) Tripod* r( S. U/ `1 d/ w3 l, X; k& a
! @0 s8 @: W; x& B! e
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): + \/ n/ Y% f% D! E1 K2 a/ l14) f6_bubbles_dyn& t7 d) b" O4 \; y2 K
15) f6_linear_dyn3 s/ z3 b c; ?
16) f6_spiral_dyn4 Y# R9 ]. t7 r1 I
; N' V, v8 l. O6 R; j; C( I
: K, e, N, z) D8 j5 N5 p0 N& M) G. J. [% g/ n
** in 'nnet' (all these require Matlab's Neural Net toolbox) 1 n# F% k* ^ p+ [/ B6 `! Q) q- E; a& B9 P4 |/ C" Z$ _# G; }4 B
1) demoPSOnet - standalone demo to show neural net training1 x* K1 p+ e& Y% q% R
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this* z' j7 T: f- I. G/ J7 L
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize4 t7 i: B, u I. P" A$ ~
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run 4 h$ N2 i- i! p" u7 x6 K/ q' W5 o( w