PSOt, particle swarm optimization toolbox for matlab. . k! |( w+ R% }2 z# z6 [4 P# r& H4 }
May be distributed freely as long as none of the files are , @0 k/ \0 u/ W) ^6 v, ?modified. * f0 \8 M9 [2 b! R [9 I% U: _ @& F0 ~, W: H/ j7 n
Send suggestions to bkbirge@yahoo.com / L, ^; p- K5 _) i0 X& }
; ]# X! c p* d" s/ ]; y a+ a
Updates will be posted periodically at the Mathworks User 1 o! U* `" a( Z4 W$ h) e/ L: C% B
Contributed Files website (www.mathworks.com) under the / W- K( o7 x* R! XOptimization category.6 i( l+ p+ p( K0 Y3 E
0 K) I# B* @! ~5 J3 h8 M+ H0 \To install: 0 V8 e( y7 i# s" @4 W- d9 BExtract into any directory you want but make sure the matlab % k t) e1 N; `2 C
path points to that directory and the subdirectories ; \2 u6 i8 v! U3 ]8 m1 T; q( o'hiddenutils' and 'testfunctions'. 7 \, Y; j; ~; x }( |9 b
9 O% Y+ B c1 ]0 s Z/ pEnjoy! - Brian Birge " v7 k7 v3 r' B g) t3 ~! X , m8 l3 \, l2 N) n' }------------------------------------------------------------- \7 y6 w0 o" a* g! L------------------------------------------------------------- 2 P+ }9 B% O0 |' t& C0 m4 K2 U" _ N2 S+ O0 M, |* u4 W
INFO 0 ^! A* c1 N8 ]3 o% jQuick start: just type ... out = pso_Trelea_vectorized('f6',2) 3 x7 Y, K8 \; a- n& @0 B% Nand watch it work!- q8 M/ g$ B4 ?6 [
9 Q- e+ f3 w9 a
This is a PSO toolbox implementing Common, Clerc 1", and . ?/ x( s$ P3 x: v# K0 c
Trelea types along with an alpha version of tracking changing4 N! l8 p3 j. w& {
environments. It can search for min, max, or 'distance' of : m/ j. `: H( G1 [user developed cost function. Very easy to use and hack with - }* l: S" j! areasonably good documentation (type help for any function and ( X" E, _4 W8 ?+ y- ] R' u. |+ S/ r% U" Ait should tell you what you need) and will take advantage of . V+ t1 m1 Y7 L
vectorized cost functions. It uses similar syntax to Matlab's 2 A, P& f' Y; u) ^optimization toolbox. Includes a suite of static and dynamic 5 M# L g: v$ d/ m1 G% Ytest functions. It also includes a dedicated PSO based neural # j3 r" {$ M7 q: t0 _- D" o0 }- \network trainer for use with Mathwork's neural network toolbox. `/ I. E. M6 H1 Y4 @1 b
$ o% F) `, o) R" V6 P
Run 'DemoPSOBehavior' to explore the various functions, options, ; N6 {$ s+ F) K4 r* t9 m- ]and visualizations. 0 {# }& e7 R) d0 R7 o3 r
; _: y: N4 u( d' h
Run 'demoPSOnet' to see a neural net trained with PSO ( F0 y+ @: p A(requires neural net toolbox)., a7 M1 S) |8 V$ a# s3 k: N8 H
7 U2 ~% q- T1 G* J& Y% A
0 D7 X: Y1 [# Y$ X
This toolbox is in constant development and I welcome 0 u" E% a1 g! j# b* fsuggestions. The main program 'pso_Trelea_vectorized.m' lists ! a/ {: Y4 H5 u( F8 v. y# Avarious papers you can look at in the comments. : u4 P: F s2 s, |- M" U9 v% K- e : k7 |1 b( n- [; K. E) k9 ]Usage ideas: to find a global min/max, to optimize training of $ I( K# v6 c9 g nneural nets, error topology change tracking, teaching PSO, 3 Q% p5 J$ g# E( |0 {& b! vinvestigate Emergence, tune control systems/filters, paradigm : T, }! C6 V& B" D8 D bfor multi-agent interaction, etc.8 V. P1 z6 x/ D, P6 x# F; Z
* L& \% T; `' `1 C3 O$ z-------------------------------------------------------------* j5 G$ [1 g- u0 r
-------------------------------------------------------------2 p- T1 [3 u* f/ u5 ]5 Q4 V
$ s5 i% s( M4 V1 F
R1 j: C4 m) m* V7 _! L; O
Files included:, b- x! @ j" h" m
3 O2 T/ U/ b/ B* B0 k6 s+ H3 q, B+ m: c- j$ c
** in main directory:' Y: N, g9 n; s) c. R& J- M) S
' L( p& [% C5 W9 \! V+ V: \/ O0) ReadMe.txt - this file, duh ) F. [. ]) O+ Y" g8 v1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO7 o, g" i0 M0 D0 [
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called n5 c2 [, E# J' @4 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' ]) x8 X& x1 }5 r/ u
4) goplotpso.m - default plotting routine used by pso algorithm6 W; `, c2 l9 r# W; ]) c$ A5 K8 I
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes., O+ N7 r0 p$ ^2 T- n2 n* X- L
/ X! F1 ^3 S4 @3 b7 b0 C9 X1 k1 |6 t9 @
' ~) {+ H/ D( V; l, Q+ N
** in 'hiddenutils'. y) U' N* [0 O
- ~* W& ?& E$ ~( O
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* Y4 U2 J! ?1 e+ Q, n
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible! i6 Q$ v9 y8 F# C" r! O
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory' @0 Q9 N& `. F: Y0 d# l; P
' q, [5 U. f. S' a( c# q6 I; X# d& P2 Q
3 N( ~# l4 `5 o# Z, `+ ]$ }
** in 'testfunctions' ) e) y" G/ [$ O/ @$ \. x; Z6 y+ ~1 J2 m8 N8 ?
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: 3 e. `( j! e! Y" v2 Z7 F " b3 g( H- `6 }3 z) a7 WStatic test functions, minima don't change w.r.t. time/iteration:) u8 E- f7 q2 y! C5 q# h7 u" I
1) Ackley7 k* B O. b2 I4 H0 W9 q
2) Alpine ) |: z) c3 o4 X: n( I; ^5 X 3) DeJong_f2 ( K) T& t( p: F; A 4) DeJong_f3' v" W8 c' s. w7 a. o
5) DeJong_f4 5 K# E) v7 a" @# k/ z! N" E4 v 6) Foxhole( o: X# D* i. f" d
7) Griewank . q% R, a# s& P6 N& t 8) NDparabola . I& V. |4 x0 s) |# o 9) Rastrigin " c9 }: R* u; H! O% O3 X* j10) Rosenbrock ! l* b1 ^1 D, Y" Q* v11) Schaffer f6 2 [: `, e7 @7 k( O7 K1 K9 ^0 E12) Schaffer f6 modified (5 f6 functions translated from each other) ( `+ R* F9 m2 \& I13) Tripod" {4 s# J! S7 q/ p% U7 m z O, c
! h% ?' V$ Q) c, eDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): & o' C9 @2 w2 [14) f6_bubbles_dyn 7 v+ l- @6 k7 D$ [+ t; u( g) Z15) f6_linear_dyn 0 ^# B. r, b; P; T4 }4 f) K16) f6_spiral_dyn # { U, J7 w/ L$ S# B ~! [2 {- {% a$ Y# t8 u4 n/ x. Y' p; t3 @
) g/ d1 \9 c: d6 {& k
** in 'nnet' (all these require Matlab's Neural Net toolbox)) W6 @: o9 O: {/ t+ b7 T
7 P% J& m/ t7 N; `/ Y$ \ 1) demoPSOnet - standalone demo to show neural net training1 V5 E% R X$ }' r: T
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this - [! x) ?9 }( X( ]/ S 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize 5 g: y8 i% Z% a 4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run" u4 }* H2 X" W* v! M( `