PSOt, particle swarm optimization toolbox for matlab.4 p6 X/ B' p7 [# I, v6 L. D
' [8 E( V7 A& b0 K8 M
May be distributed freely as long as none of the files are - D& }7 K/ T) X( e& Z) `modified. e& V Q; ]( L, x3 ^. C) q . A0 A- V3 _& r, ]- KSend suggestions to bkbirge@yahoo.com $ W7 s. N/ m' M7 \- V/ d# W$ @' Z2 w/ I
& b. U" n9 M6 ^5 C# GUpdates will be posted periodically at the Mathworks User 5 D, @! t$ r- \' f X" s4 \1 L
Contributed Files website (www.mathworks.com) under the ) I1 p# k' }! u5 B* R9 U/ qOptimization category. 5 A* M$ k# W( |8 n, F* Y1 ?) g$ G% ?' J# w, B
To install: 5 t8 ^* h! H: u" tExtract into any directory you want but make sure the matlab ! _6 }* l% `1 @& |. [& Q( ]# j Q2 Z( Y
path points to that directory and the subdirectories , \. v+ J5 }6 }2 w" p'hiddenutils' and 'testfunctions'. 9 s F7 k/ J& T
2 b. p% a) v5 L: Z0 v. e% y) REnjoy! - Brian Birge 8 Q8 S9 J, O# ^( S 8 L% [; ]6 D2 ]: I-------------------------------------------------------------( g0 P: B% v7 t$ I0 R
-------------------------------------------------------------! G) v/ U# }( E( M1 o
4 T$ |& i( m* q' C6 u
INFO f% X6 \7 o' ?& k/ f: }, G _Quick start: just type ... out = pso_Trelea_vectorized('f6',2) % E# W& n* y' o0 |6 Mand watch it work!/ A* v0 Q5 G% c l! w j" z
6 x% L ]: ^, D% ^+ y+ a6 H' oThis is a PSO toolbox implementing Common, Clerc 1", and ( P" I# ^3 c8 A, dTrelea types along with an alpha version of tracking changing & Y \3 A) c0 e. J6 U tenvironments. It can search for min, max, or 'distance' of 6 N/ w4 D* f4 X5 F+ Z+ Q! @user developed cost function. Very easy to use and hack with ! m, P2 M4 O# B7 t' \reasonably good documentation (type help for any function and# }7 L/ t i& E* a. |( C
it should tell you what you need) and will take advantage of 3 f! G |' n& |
vectorized cost functions. It uses similar syntax to Matlab's) n( s9 z2 h+ C& `' T
optimization toolbox. Includes a suite of static and dynamic ' y/ T! c7 v/ `) v" }, e8 Ytest functions. It also includes a dedicated PSO based neural 1 o- X+ A+ _3 p
network trainer for use with Mathwork's neural network toolbox.7 |9 z) W# h$ Q
: e4 V1 k- e8 T" U# t; }Run 'DemoPSOBehavior' to explore the various functions, options, 8 d: [: p% t) U: V! Y+ F
and visualizations. ! `' |+ Q& @+ U p. A6 l# t
k9 u( { o% v; M. B$ I. }: pRun 'demoPSOnet' to see a neural net trained with PSO 0 t m2 M) }+ h% q/ H, A(requires neural net toolbox). % A- S) n; s# \! U- v. D4 d& W# B9 M5 ~5 B* s) |7 w
" ?. V" ~' ~# A. ~2 rThis toolbox is in constant development and I welcome ! f' m5 p5 Y' e7 J/ b3 }
suggestions. The main program 'pso_Trelea_vectorized.m' lists 8 s' p) h: b& Mvarious papers you can look at in the comments. 9 s4 }2 F( O5 E B + a5 y, `0 E! I7 ]Usage ideas: to find a global min/max, to optimize training of & N. X: ?, D: A; l8 vneural nets, error topology change tracking, teaching PSO, 8 j' v' u" Q/ g- u* M9 z
investigate Emergence, tune control systems/filters, paradigm 9 ~# ?5 ^& r/ Tfor multi-agent interaction, etc. : ^1 ^( A8 L: k/ \( d8 y' G4 _$ ^/ L7 f$ W9 w1 d1 _& Q; W7 o0 q
------------------------------------------------------------- * X4 U7 m0 Y. B& H- p3 [, S------------------------------------------------------------- 6 o0 P) g! B( x- b7 G+ }5 E) K* Z- W7 s; J7 ~' Q- C# a
4 r# U' q: Z/ W- M4 r* O1 ]
Files included: ( W3 Y* | O$ W2 T/ W' d9 f; Y" G+ A
/ {$ D2 [. `7 b+ @' e
** in main directory:+ ~" u) x; m' T5 R7 s
% L: L: n9 R: P
0) ReadMe.txt - this file, duh : W: B! s- @* h) S2 \1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO ( H9 R9 C# _+ ^+ i2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called) B& w5 y5 h9 T1 J9 N H
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 z7 |0 y9 x9 e( |! V2 K1 b4) goplotpso.m - default plotting routine used by pso algorithm/ ?* o" A7 K9 R
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. 9 _2 J! t% t; U0 L6 f* |3 I6 x ? ( x% ?* w/ T! \7 _& S7 s0 `7 i5 t6 q# L5 \, q4 R, H/ v# K }* N
, U" n/ e; z1 J3 I3 E: t** in 'hiddenutils' 7 H7 }- Z/ Y) I8 J! S4 `" [& H, T! O; J9 ^
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* E% I8 A7 b$ i" ]
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible % u- D$ K# D0 k) E2 O8 W3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory ; }. |# n( S, Q g; K2 M- d4 n# v! r
( R9 ?8 e& _9 v3 G1 h+ W5 B* t6 b
** in 'testfunctions'* k7 I' B, r, R8 F {3 }
. d# @) K4 _* O0 a0 J$ `) ^; o
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names:: ?; o6 Z( `( o1 C
; c3 Y H0 V# J; S9 N/ ?Static test functions, minima don't change w.r.t. time/iteration: ) S. D8 |; X8 F& G/ } W6 [8 \) x0 E 1) Ackley) ~( K! ]0 n& s: c+ g4 ]
2) Alpine, p9 o# C2 c! C
3) DeJong_f2 & X+ Y; m+ `8 {* ]4 }9 ?( W 4) DeJong_f3 5 D* R; i, k9 M1 t 5) DeJong_f43 Q) P- h/ S9 i. h
6) Foxhole: o4 a" Y; v! m# y B, ?7 J
7) Griewank7 E7 f1 q( o( P
8) NDparabola, ?# z& a2 k8 r+ C
9) Rastrigin % |5 n1 ]0 m& F) S5 x, d10) Rosenbrock 2 E: A8 s& D9 p, e" m- h+ U4 x* H11) Schaffer f6) o5 d. C; ]5 i
12) Schaffer f6 modified (5 f6 functions translated from each other) 4 ~0 X7 Q2 X2 [# |13) Tripod4 {1 A( ]$ M6 A, J0 ~8 T' U
0 W. L# |; c, d$ x& F4 Z6 s3 qDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so):% ]8 t5 ?2 f( M& W7 E* v; \
14) f6_bubbles_dyn / z/ ~. t- `8 ^3 }* K8 g) y15) f6_linear_dyn ) m9 h8 J F$ ]' B) U8 ]! _) e0 X16) f6_spiral_dyn" `7 n" j5 H$ A- m% ~5 d c; h
7 T- |% T9 S8 n1 d
, K# _# B) j8 W- m" K
" s a1 ]! p; {+ c' n6 `' w** in 'nnet' (all these require Matlab's Neural Net toolbox)2 ~5 c) }' z3 M, C: p0 g. d: X! X# x
$ W4 |. r e# |/ ?* l7 ? 1) demoPSOnet - standalone demo to show neural net training6 P2 `: r3 m- W8 E8 N4 n
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this9 u. b( C; z; ?7 \6 [2 k; v) t6 I
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize * ]$ w/ f, v% T9 d( K2 T 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run2 z+ j% b5 `" M u- j
2 h$ n1 _4 q8 `' B" [; L