PSOt, particle swarm optimization toolbox for matlab.; V. L( e& u1 l+ x1 u J
( K' y7 W+ [% n$ G6 v
May be distributed freely as long as none of the files are 9 d* ~. |9 d; s0 s) Q
modified. : S9 v6 H& i2 n
) y; E( k' N: M5 k2 i/ N! r- OSend suggestions to bkbirge@yahoo.com @( G/ z* r. o+ f! O
* k7 V& I3 S" D! b
Updates will be posted periodically at the Mathworks User ' A& l' r7 S2 d% O5 m& B
Contributed Files website (www.mathworks.com) under the % S/ ?1 K& Z2 E# A5 yOptimization category.7 t0 `$ ^: T5 v7 l% S+ Y) O
2 n0 s/ z! t7 n" v& p5 c8 q4 Y! b- u
To install:7 P! `& O- u v6 ^5 Z2 f# | N
Extract into any directory you want but make sure the matlab % n/ O% Q- V o! k
path points to that directory and the subdirectories 7 W. \7 R) e0 c; k
'hiddenutils' and 'testfunctions'. 2 Z+ {# G% W; Y6 L% A. J+ \+ R" K( u& r: q1 h
Enjoy! - Brian Birge 7 m! z% u# j) ^; x& h7 a 4 t* q0 q* O P7 Z: S+ c------------------------------------------------------------- X$ T; S+ I* |( X9 r6 m# ?-------------------------------------------------------------2 r& d3 z5 ~4 U8 J# I/ X
% p5 U9 d3 ^# m: O: T' E' d2 Y9 YINFO6 [4 w! x T2 S! X, f+ A& S6 _
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) . Q8 X$ B2 n; U! f
and watch it work! 3 j% W; b8 A5 X; p- B9 Q/ `! |! g3 \( `
This is a PSO toolbox implementing Common, Clerc 1", and " Z: y" k- P f- g; g$ h% e- NTrelea types along with an alpha version of tracking changing : A) o' J! Y2 `+ q+ G5 Genvironments. It can search for min, max, or 'distance' of / k7 y- O/ O; |& muser developed cost function. Very easy to use and hack with 2 F/ v: N& S9 Y% u0 jreasonably good documentation (type help for any function and $ [& H% ] ?/ u4 Jit should tell you what you need) and will take advantage of ( Z. ?0 S( ]$ }/ c1 f* |; \* F
vectorized cost functions. It uses similar syntax to Matlab's + B) K* C8 w2 x: i+ i$ z2 }optimization toolbox. Includes a suite of static and dynamic - |6 j8 `8 ]6 e6 M4 vtest functions. It also includes a dedicated PSO based neural 8 @! x) m8 H8 s1 E6 K7 ~, \
network trainer for use with Mathwork's neural network toolbox., v5 A4 L2 ?9 e) R+ g% T% w
% d' Y5 l! N" b6 x5 P6 tRun 'DemoPSOBehavior' to explore the various functions, options, 6 U( R& r( c. Y8 K
and visualizations. + q# E* n& V. N! J ~! L
7 J& P3 K! V8 f9 U, {3 P( i' l
Run 'demoPSOnet' to see a neural net trained with PSO 6 h. }0 [, d% g
(requires neural net toolbox).9 D, O+ t4 W. Z+ G9 B N
- L& H- X! c) a2 _$ E4 i$ v" Q 7 z3 }0 H5 L4 m: g* L( V& ?This toolbox is in constant development and I welcome 2 w+ Y5 `' e; y6 P8 \suggestions. The main program 'pso_Trelea_vectorized.m' lists ! v' H* c; Y+ b' Rvarious papers you can look at in the comments. 5 F! b& B, g8 ?# ~6 e, `+ Y( ]: x - i& O% w, b! jUsage ideas: to find a global min/max, to optimize training of 0 |% `- Y3 Q1 M. N# Kneural nets, error topology change tracking, teaching PSO, 3 v! `& t" n, d- d6 I0 s# Q9 q
investigate Emergence, tune control systems/filters, paradigm 2 E2 g$ B! ~$ q0 t/ B% F* Z3 C
for multi-agent interaction, etc. ; c/ H( u/ x7 Y5 |: E; y9 b* N5 E$ ?9 ?1 b3 T+ M
------------------------------------------------------------- $ H2 ?6 }, u K-------------------------------------------------------------+ p# Z2 |( m- P
+ s0 ~: I& x' o0 T # d4 [- x7 b- x: @0 {Files included:% j7 r9 c: r5 _2 a
0 f x. \6 n3 V& P( t9 G2 @
* e2 K) I5 x, F: u5 y" b @9 A$ a
** in main directory:5 Y5 [7 A: A- s3 ^9 }
& V8 C! x( ~9 O) |; ~8 P7 E
0) ReadMe.txt - this file, duh 2 ?3 v# m! }" N5 b4 u9 E- [1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO ! e% [0 G" y- i0 O: A2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called% g% [! n) ~5 e! e
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 5 o9 i9 j/ B8 Y2 Z% o& a4) goplotpso.m - default plotting routine used by pso algorithm % i7 p- b6 \9 l+ Z5 o1 o2 l5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. : \2 ?$ W8 ~! F, @4 G1 d 5 X& {6 P4 X( Q4 k+ @5 m9 C3 m, t# O( ]: j
* ^/ y- E" c& h7 _& t% c+ A$ s** in 'hiddenutils' + U" F7 S2 K# P' ]! d9 S1 @" `, _, t2 v5 ~
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/ ` P* y2 ~0 q- O
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible7 i4 N$ T! _- V" O" v( b
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory d, y4 t, _) a0 ~ " C7 s6 d5 w3 G$ _) H/ [( c1 v3 l( @* Y; ^
* ~7 J4 k. d9 J. Q. q** in 'testfunctions'; _' T" P7 U! b9 I6 Y7 E
% q. O3 b1 ^( e7 T5 X8 pA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: / t3 G% ]" v1 b6 i2 v 2 d# J1 @2 f/ I" CStatic test functions, minima don't change w.r.t. time/iteration: 1 M" f k- x- J# A 1) Ackley + @0 B8 f& o9 H9 |/ Q% s5 V2 m 2) Alpine 6 i8 c ]0 }0 T3 Z- p% ? 3) DeJong_f2 ( h! Y+ }" {0 c# Y9 W* l# l' G 4) DeJong_f37 d( |" C8 \8 k) \. c& r
5) DeJong_f4 1 E& y" ~3 X/ @5 M9 c" j: y 6) Foxhole 9 k. R8 {1 S r4 D! r 7) Griewank0 H+ o* H+ A$ q/ G" n6 A% y
8) NDparabola" `5 P+ L, N% V @9 Y. j/ C; e; k
9) Rastrigin / u, R3 V$ s+ r! N10) Rosenbrock4 ]% y$ J! z9 S$ w
11) Schaffer f6 9 T9 p' ~1 K3 l12) Schaffer f6 modified (5 f6 functions translated from each other)* t; k9 Y5 u2 x2 w8 e% o, L
13) Tripod$ j6 B6 `4 f1 z
( d% A- @ @4 G s5 HDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): % g# ~$ d8 a0 ~8 u4 L+ m- v14) f6_bubbles_dyn ' G! T. M7 U* L$ ]3 @15) f6_linear_dyn 4 @6 z1 v( Y C, k! o16) f6_spiral_dyn 0 B) e) h& |) D5 A) ~7 }7 T2 x* i! g6 a8 |% m' c7 c1 C
$ P& @+ ~* G9 ?5 U7 P6 X7 _7 R, \8 \) Y8 B1 f
** in 'nnet' (all these require Matlab's Neural Net toolbox) - z4 E! ~* ^" N1 {5 I3 ^: d E1 E ' ] h o/ @' [ 1) demoPSOnet - standalone demo to show neural net training$ y5 [% `' C6 k5 m
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this" |2 a5 }. l: p& n' y3 ~+ p
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize$ N5 [1 j9 d' B* E! }4 j5 }# [
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run5 B e/ Z/ g1 e1 J$ s2 b/ w
$ D8 Y" W' l. ]( |5 [, P, Y. ~; S* ] - u& |8 d4 F" \4 J2 ~# a W2 n! M