PSOt, particle swarm optimization toolbox for matlab., F; k1 X, R4 b1 b
9 G1 _4 ]# W+ n; K" W0 b& L8 @May be distributed freely as long as none of the files are * h5 o5 A9 M) m* \modified. ( O3 z) a+ I% `5 w: i' l6 ]6 r
/ ]1 U; g- _* g, x" J, HSend suggestions to bkbirge@yahoo.com & w. O, D3 B+ g* ?; l
6 T) k5 N) {" ^4 Y/ T1 U) e9 u# W
Updates will be posted periodically at the Mathworks User 2 X' v7 i1 k9 F h5 R
Contributed Files website (www.mathworks.com) under the 6 t" ^ z) d! [( }* ^6 |
Optimization category.% ` m9 ]& g# o( Z; \; g9 `* q# ]
" X+ p: Q6 W/ Q4 F' ]" a
To install:0 v7 f/ J3 C, U1 G
Extract into any directory you want but make sure the matlab : T& T% x! m6 G& r9 ]4 K) O9 Upath points to that directory and the subdirectories ( @5 |: ~& K/ i" |'hiddenutils' and 'testfunctions'. ! m) V6 ` Z* N9 k6 O7 |) i! j$ U8 |
Enjoy! - Brian Birge + i6 M: t; z) c5 V/ h$ Q* z8 g1 }' w; W
-------------------------------------------------------------- F# N* _* Z/ {
------------------------------------------------------------- . [% z& P% n+ l, z e D# c" a0 Q0 U& b' _: Z$ bINFO- @9 [) ?6 I& {9 B4 ^0 x* k# i
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) . S0 H7 Q9 L* N. Uand watch it work! 8 d4 A. A# _4 U& { 3 V/ z* M3 O! O5 WThis is a PSO toolbox implementing Common, Clerc 1", and , V3 Y* U' H* B2 I: gTrelea types along with an alpha version of tracking changing5 t, r3 L- W8 D+ V
environments. It can search for min, max, or 'distance' of 1 r) k2 }' O1 i
user developed cost function. Very easy to use and hack with & G( i X3 i r- q4 @
reasonably good documentation (type help for any function and( ~5 t. K! ?+ q" e |' ~3 l
it should tell you what you need) and will take advantage of 3 s4 b6 C4 I& @1 dvectorized cost functions. It uses similar syntax to Matlab's" ~6 ~, W. V3 `1 f
optimization toolbox. Includes a suite of static and dynamic 6 ?1 Y9 o) N1 ? t3 N! x3 \
test functions. It also includes a dedicated PSO based neural ( c2 X- j/ g/ a2 l
network trainer for use with Mathwork's neural network toolbox. ) g3 e7 w/ W. V$ u0 H' Y2 I& _- Q2 h8 U& F: `* {- p0 t4 P9 H
Run 'DemoPSOBehavior' to explore the various functions, options, " x: v& j' E+ R- w4 yand visualizations. 7 k9 j! w& @, q/ G) H9 N/ s j- S
4 j. X$ K9 O5 j% j: {
Run 'demoPSOnet' to see a neural net trained with PSO " N* u' z) K, x* _9 @0 |- D8 e(requires neural net toolbox). 1 M5 f2 w/ ~8 O3 }1 U# {; j M % T+ @0 U2 @+ b3 q2 |0 S# N1 Z' w& h! O. @1 N: [
This toolbox is in constant development and I welcome # h/ S2 g# Z9 Z. V. ^% P
suggestions. The main program 'pso_Trelea_vectorized.m' lists 3 }1 I8 `8 W/ S3 \& Wvarious papers you can look at in the comments. - m+ F) y f* n# R: r1 i ) n) F* ]& v2 Q7 e4 AUsage ideas: to find a global min/max, to optimize training of 3 Q+ R o [7 P% F& r0 @neural nets, error topology change tracking, teaching PSO, * W7 p! {1 p* O; f- Q9 ^$ [investigate Emergence, tune control systems/filters, paradigm 6 N$ q S8 n( J; x& k$ l
for multi-agent interaction, etc. & T( T% m+ M; r+ v6 L/ ^- }/ E2 D+ |5 \3 c5 m
------------------------------------------------------------- $ h* h4 i0 c( I-------------------------------------------------------------' v1 L' |$ j n, |$ Q" U6 l
$ T4 f/ m: ]' @2 N' F7 N5 i. s. O0 L
Files included: 2 P5 Y$ G# K5 K: `& x! e M8 k8 Q J' p4 E; c7 j
0 n; s" q( m" ~1 W** in main directory: 8 q/ @; M6 X+ y1 O" e# L- W8 `+ a! G+ l. N2 H
0) ReadMe.txt - this file, duh ; s: a5 I" r7 H/ S+ ? F1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO/ d1 `+ K/ w; n* D
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called 9 {/ F: u8 L6 @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 * K' ]! t Z5 [3 @& F7 @' O4) goplotpso.m - default plotting routine used by pso algorithm - O3 p: y+ e+ n3 A6 _6 {4 |% |5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. 6 f+ `3 e3 J$ L0 w2 u" r% M; k6 `4 d" d& ^5 q
% C1 h9 \4 E6 B
2 w' F r: }0 G- \) u, r. q
** in 'hiddenutils' 0 l2 w" E" R* R! ]4 _7 l- \, ]! s. m
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* `3 H* E$ P* _) p6 P. y o" L+ f
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible " J- [0 r: y# B, \$ ?* b3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory 1 W+ h; x9 S {1 l6 N8 ?7 } Z2 C5 z* G1 c: w6 v/ ?2 b8 O1 C
8 x& g8 ?' X0 ]; p- B$ }/ H6 e& K
** in 'testfunctions' 6 f" S, y, n9 o: _2 u2 s4 T! o6 B" G% s* A4 L$ H
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: 2 k. }7 s8 b+ F9 b& e$ ]5 G # a/ W7 c. d5 Z$ {( h& |4 @Static test functions, minima don't change w.r.t. time/iteration: 6 w9 f9 Z' H4 ~4 T( { 1) Ackley 8 A; j) u2 Y0 s' ?% X9 x 2) Alpine 7 C* \, x' a& X9 ?5 W X 3) DeJong_f2 # n+ v/ h) q, |3 ?! W 4) DeJong_f3 6 y1 @" b) O( F( I3 r 5) DeJong_f40 _, {4 r: Y- c" P
6) Foxhole * f/ Q9 X* V5 f 7) Griewank 1 v3 h5 o h7 Z ~7 a0 X( T 8) NDparabola9 w- q; F8 o" n- d5 V, _2 |
9) Rastrigin . M" K: j/ ^! T1 ?10) Rosenbrock . q7 _8 n, H: {6 b, L1 r3 B* |11) Schaffer f68 `% `- P. v- ?
12) Schaffer f6 modified (5 f6 functions translated from each other) , j6 }; z9 q' r* u: {. T( |$ L13) Tripod E3 P& ?& T' q/ T
! ~% j( {' {- ]" q+ S! o7 h
Dynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): 1 F/ N( x- y$ n/ f/ v14) f6_bubbles_dyn ( z0 d5 I& b* Y4 i6 V- n15) f6_linear_dyn" h' @1 y2 j; P0 b" }8 C
16) f6_spiral_dyn + f0 K+ |2 Y5 q& ~+ d; W* b; {- L, Q
% h/ H/ u: F3 s0 r
: Z+ j2 G( F2 ~3 y0 g
** in 'nnet' (all these require Matlab's Neural Net toolbox)4 u8 o( W; }: H- ]9 R& h( y8 @
3 v" z; Q4 _4 r3 K/ S 1) demoPSOnet - standalone demo to show neural net training- S! t* q( ?4 f* u( H
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this& L0 V. M k: t
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize; v8 T6 t# d- K7 e4 e( w) Y) `
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run $ L* [$ {" y7 j& r# P 4 P# H6 A8 R" _3 u5 P7 y * a3 K* R7 |. n4 m ?! {