PSOt, particle swarm optimization toolbox for matlab.' ~6 N0 a) v, t3 ^
: |6 l: p( n0 TMay be distributed freely as long as none of the files are - P4 s9 ^0 `$ S4 j$ w& ]modified. " J) |5 I. u* B; R8 S2 i* W& ? , h, ?$ g8 S) y; Y; sSend suggestions to bkbirge@yahoo.com : {1 m2 i/ h- @% l( o; l& y3 ?: p$ v: j$ F; r9 G4 p( A4 K& V: X
Updates will be posted periodically at the Mathworks User 4 J& B4 _7 B3 L) Z8 z, c$ `
Contributed Files website (www.mathworks.com) under the : @& _5 o" f/ R8 v0 kOptimization category.: m Q( i% ^. _ ]# d; f Y
/ z' }/ |$ f) P1 P+ C! J
To install:! d( A5 Z; A4 N
Extract into any directory you want but make sure the matlab - Z1 }+ v6 O2 M% a
path points to that directory and the subdirectories ) }& a# Z1 Y6 ]7 v
'hiddenutils' and 'testfunctions'. / f2 [7 ?) t3 P : {3 m! p5 Z3 z$ `" dEnjoy! - Brian Birge . }% E" V2 g. s0 n2 f# v+ } ! P5 v- P) y& W0 Y. t-------------------------------------------------------------8 M" u' {. M( _% T5 f: Z; O3 @$ t! Y3 A
-------------------------------------------------------------6 J$ v8 m" V9 f, D4 N5 c
( P3 V3 E3 d/ u2 |* }2 jINFO 5 t2 ?0 w1 j. k) I2 }, i3 R7 LQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 8 @0 E/ h6 Z8 X% J0 c, E
and watch it work!8 p7 I0 w' ?' d4 [, O5 h
* r/ Q6 l& ^- Z' |- o! [
This is a PSO toolbox implementing Common, Clerc 1", and 4 w) |/ ?+ J5 p1 [8 @
Trelea types along with an alpha version of tracking changing9 V) \1 R! P3 x, b4 s) ?
environments. It can search for min, max, or 'distance' of 6 X1 {% D% l8 `7 Y/ H
user developed cost function. Very easy to use and hack with 8 R& L" t" R. n9 y/ N
reasonably good documentation (type help for any function and( }; m5 U3 H3 E& w% e
it should tell you what you need) and will take advantage of / N" V2 G$ |. [- `, Dvectorized cost functions. It uses similar syntax to Matlab's5 D4 ^" o, s5 f# w' Z
optimization toolbox. Includes a suite of static and dynamic 9 T$ H7 M2 P3 X' u" |# w# @( ttest functions. It also includes a dedicated PSO based neural 2 z7 K; ~& N- N
network trainer for use with Mathwork's neural network toolbox. # A! `- b/ Z" g( R- i; e7 q) h* \0 A& w" z
Run 'DemoPSOBehavior' to explore the various functions, options, $ i# I" \6 s# K. U, j7 `and visualizations. H6 X z$ G7 ]. Q# I' T
. }% u8 W6 N) t9 I$ u9 o' J' E( L) pRun 'demoPSOnet' to see a neural net trained with PSO $ c3 i0 a4 |' I6 C* I$ k
(requires neural net toolbox). % C. Q2 b7 P! p2 B6 O5 E, s 9 U# A( a( s& @ ^# V + |0 p/ {; N6 o3 @( zThis toolbox is in constant development and I welcome 8 Q6 }/ g2 p! u! T9 W0 y* W* H! i
suggestions. The main program 'pso_Trelea_vectorized.m' lists ! |# x& v# e; p3 z4 Tvarious papers you can look at in the comments.! w7 B' Z9 |$ y9 L# `. \) S! y. R
/ W: k$ w, t4 R7 `Usage ideas: to find a global min/max, to optimize training of * u O$ S- O- x( m! h% C* I
neural nets, error topology change tracking, teaching PSO, 4 {! y" w$ u4 Z$ h! einvestigate Emergence, tune control systems/filters, paradigm / }* [' \/ \! i- s0 t
for multi-agent interaction, etc. & D* B/ o8 ?, T" u( c1 \' M * h! ?- D& f% d-------------------------------------------------------------: f5 Y+ i) B0 R3 k* s) d
-------------------------------------------------------------: }# W q0 \7 O: t5 w
; r& E. L2 V! a0 l/ E& k* a& N2 y/ n4 ~; T* O0 H9 p
Files included: 1 C7 k8 k. o- m3 Q 7 _* z5 D& V: T6 I& P, _, o, ~9 H( N5 L7 T+ p8 \4 d* n0 b
** in main directory:' f o4 w. L/ F% o+ h- ^* Q+ n
( v" E: \. W! J$ p- f! r
0) ReadMe.txt - this file, duh ' D8 @ n$ g! `2 \1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO6 _8 J0 ~8 v0 c5 J M c; \
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called2 [* t% d g; e7 T
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) u( e% u0 F( n' L8 e) M+ u: [/ P
4) goplotpso.m - default plotting routine used by pso algorithm- E: ^# R" F! z$ A3 N
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.' _% l" d! Y! ]$ i, d4 }
! R; V* {% s- ]3 X) A2 r; x; z 9 Q3 T& @3 {0 M% A# y+ S / E, [9 H0 B( ^** in 'hiddenutils' }3 ~* a1 z4 T
8 N# T) A% @( V7 f. O1 E8 k
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: b$ k6 j1 H" n* G3 y
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible 9 m- F. X5 X* H! e( y3 a: @ p& \3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory; L% \9 q8 U/ w" r8 v5 M, w+ G" a) J& d3 n
7 o {; I" a& a) {' v0 |4 k/ `& g
6 v- G% X. R2 L3 m( v+ k7 Q9 y7 S
** in 'testfunctions'' E5 B8 Z/ M$ T O5 E7 I5 _% A
" ~9 n2 s: O2 ^# {
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: 9 o' }) Y1 V$ Q* p5 `/ f3 y' M1 F" T5 R8 {4 Q6 ^& X
Static test functions, minima don't change w.r.t. time/iteration: ; }5 Q# O E4 @# j5 x 1) Ackley + Y5 \1 a" {4 ?/ T" U$ j 2) Alpine 1 T" r$ ~ C5 M9 q5 t" e0 `" V 3) DeJong_f2# j& |: `3 I7 J/ Y9 P, Q
4) DeJong_f3 & o! F, c% n( H+ }4 {& }2 d 5) DeJong_f4 c9 h) U' ]: K, b2 N# a' ^
6) Foxhole . J8 a' [: T3 n& Q( |' u 7) Griewank 9 F9 B) x* k7 d% K$ W6 M 8) NDparabola6 P; N3 m+ f K& z. |. q
9) Rastrigin 9 g- K: {2 U. m) y ?10) Rosenbrock , Q) r* K( P; \" F11) Schaffer f63 m J# f$ M( x6 c, ^4 r" O
12) Schaffer f6 modified (5 f6 functions translated from each other)& C2 @# b7 u8 ?& v% i
13) Tripod$ Q# ?# m& `6 |" G. Q
2 l$ ?1 s6 _, g$ _; q+ f
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): * k. N# ^& i2 U14) f6_bubbles_dyn / E% r) L% O4 l/ M" m: @15) f6_linear_dyn. x3 }0 l4 b# g, u
16) f6_spiral_dyn3 o' D) R$ s) S$ [' p) r: z
) ~# o6 T) t* {3 x* @4 X7 l
0 m% P3 ?* N) c$ O' V/ R* {6 j; _- D5 N& a$ K6 F
** in 'nnet' (all these require Matlab's Neural Net toolbox)* X' ~- k# N' S8 J. B9 f" v! ?4 O
. P, i/ ], k; Z9 J. X0 t9 `
1) demoPSOnet - standalone demo to show neural net training7 v5 `+ ~+ J7 K; Q b6 ?6 ~
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this: ]6 ^5 H* v+ D* y8 Z$ u+ I
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize1 O# E" p$ ~( n/ P z
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run ' J/ Z" r: _" s4 U. r ! c1 K# L; T( m7 ]* A2 t / i1 o# D3 U9 `