PSOt, particle swarm optimization toolbox for matlab.5 c4 d9 B1 N3 P" `; `# l5 J6 W
8 Z3 v/ @% o4 A, X
May be distributed freely as long as none of the files are 7 `$ p( W3 _0 S- x8 X
modified. ; w$ h/ [, M# i9 H0 [, t
, f& @, E' Q8 B% BSend suggestions to bkbirge@yahoo.com . A- h+ j3 n9 A' `
: l2 @8 g, k z% I
Updates will be posted periodically at the Mathworks User " x4 Q; T* V: F( U
Contributed Files website (www.mathworks.com) under the ( r7 C" T! K3 i7 z+ J8 G5 p8 K
Optimization category.0 ^! F9 g9 L% Z, I$ B. X) ]
+ B, n; U2 U2 M# N, z
To install: 7 [+ `2 o; h& C( aExtract into any directory you want but make sure the matlab 7 f) S5 m+ G+ x0 W$ F
path points to that directory and the subdirectories : n s5 ~( _1 Q& @% `4 Z: E8 N ['hiddenutils' and 'testfunctions'. 8 v& | s& p+ |+ d* g/ T" i3 J' | ( I5 e4 n8 h' ?# g1 Q- WEnjoy! - Brian Birge % w0 Z, I- X6 M- d5 x 2 a# n. p7 Z8 u! z4 W. ]' j-------------------------------------------------------------$ f. U4 D: y: p, A7 M
-------------------------------------------------------------. d) A3 {5 z, H6 d$ u
4 d& l$ P0 j# P- Q
INFO6 q1 p+ a$ i: b! Z1 i# n0 y
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) 7 t/ o( r3 \- ^( s; z2 |' H ~& J( g
and watch it work! 8 q' k) ]* V4 { : v; J* T6 B) B7 xThis is a PSO toolbox implementing Common, Clerc 1", and . I6 x z8 E5 R: k" O" G$ A2 F/ O7 H
Trelea types along with an alpha version of tracking changing+ o% T( ?8 s: [0 F( J' `' f
environments. It can search for min, max, or 'distance' of ; M8 w' m. B6 O. N+ |! n" C
user developed cost function. Very easy to use and hack with . G$ M- S' B* W! J3 R: n1 M* t
reasonably good documentation (type help for any function and `9 j: O# {# S* g% s( K8 bit should tell you what you need) and will take advantage of ! v& }4 c0 n" g) _1 h4 U; ~! jvectorized cost functions. It uses similar syntax to Matlab's 9 |6 ?; D+ C7 z) Q. q% X* [optimization toolbox. Includes a suite of static and dynamic * t' D" Q( [! `test functions. It also includes a dedicated PSO based neural 9 G* r4 ?% z3 N1 w! R w' B. t% d
network trainer for use with Mathwork's neural network toolbox.5 j+ @3 U \- s$ S) O
2 |" z" P; N2 [0 KRun 'DemoPSOBehavior' to explore the various functions, options, 2 v& L6 c" J2 L, w- Xand visualizations. # I$ _* P& X. x, n
, v t) C$ o9 iRun 'demoPSOnet' to see a neural net trained with PSO + u7 R% e; x" \ P& D0 H(requires neural net toolbox).: y0 g" c( }9 d( B
$ D* P7 t P+ ^3 Y+ A# n4 _: Y7 }6 t
1 X9 q/ X8 m) [' a- E) F: f2 x
This toolbox is in constant development and I welcome 1 I% s6 a. S( q$ B( asuggestions. The main program 'pso_Trelea_vectorized.m' lists : q& q* w' b& N% \3 b
various papers you can look at in the comments.( w4 e V7 M6 h
) A d7 b) I5 o- i' q# NUsage ideas: to find a global min/max, to optimize training of 2 l8 d8 F9 ~, h8 i* r
neural nets, error topology change tracking, teaching PSO, # \+ I6 i4 m& P( ]
investigate Emergence, tune control systems/filters, paradigm 4 U* t) `1 P) L+ n3 [5 Zfor multi-agent interaction, etc.' @8 R' z8 R6 t- Q, r! A% X
. Z( P. N; C/ M0 q+ \) o8 z% i& b# _/ x5 x5 V
Files included:& l2 X H% w* @* l0 Y6 W6 Q3 z
, Z/ |# h5 ~/ q) v# p f6 [7 V
; i* j6 a V3 R
** in main directory:) ?( Q6 U4 L# V
7 |6 v7 ~# j# a: h/ m( E
0) ReadMe.txt - this file, duh 0 d$ q K, ]- P9 x* D" N, c/ _1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO$ u, O; s. X8 P) d4 c9 Z9 i
2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called' T; J! r: U) F( N5 {
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# R$ M- a8 r, z/ [9 A9 \, [% T9 `
4) goplotpso.m - default plotting routine used by pso algorithm8 N- Y a2 E- A% O
5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes. # N3 I" [! T' I( O# I6 k+ G1 @* H! m; @1 ]* G& u7 @) N9 d" W4 a
, A s% _2 w; C9 `9 W2 D* s
% n4 B/ A- I% D& i( u% X** in 'hiddenutils': \+ X4 y% p* V% }& m" \8 J9 P
" o _6 e- V9 b9 F# V3 S
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# e5 [6 N1 y; V- o1 Z
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible F! T3 ]2 m1 I! C: B) U; J3 G
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory/ ^) O, ~1 o" t+ G. M
- M" `5 s/ [) n+ a, K! L# d% o; U) Y
+ @: g- W& G% e9 j6 R
- Q7 ^! q' H7 N! H6 Z** in 'testfunctions' b# B1 G' G$ Z; T! `# o- I. T4 U' T
A bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: ; T8 @5 o( h! |9 M2 H9 H \3 J7 f/ U0 ]
Static test functions, minima don't change w.r.t. time/iteration:. N: K$ X, j u7 A7 }
1) Ackley6 k; r: L% R6 S
2) Alpine# ]9 c9 v$ g; | c! a# n1 F
3) DeJong_f2 . _; `5 N& G1 {, w8 N. p G6 S9 ? 4) DeJong_f33 o; R$ c8 k* w3 ^
5) DeJong_f4& N) I, `; N5 ~" x; K& x& f
6) Foxhole/ [6 n8 U" s' C" l5 s
7) Griewank5 a3 _: R# u3 b
8) NDparabola( [: l# u9 m8 @$ Q
9) Rastrigin , A$ ^0 r5 S3 z( u4 [10) Rosenbrock 3 z* A! D S1 h, N) a x9 N11) Schaffer f6# y) d9 A) g' i* j6 ]# C, K
12) Schaffer f6 modified (5 f6 functions translated from each other) ! Y. L2 ?1 {: B/ Y# F1 @13) Tripod# S( `. ~- @# I" s/ U! r; g: I
% I+ }, Z& Z/ E; X! A5 uDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): + }5 ^5 t& V# }14) f6_bubbles_dyn ( a) W% |, o3 C q0 }( @# J, w3 Y# q15) f6_linear_dyn* [: X& j# K+ D9 F2 L8 j& T
16) f6_spiral_dyn7 ]0 u( o/ J) n' t; w+ w7 f
/ S& q9 ~& [! k " t' f. C: R# X: w0 z/ v" q9 y0 l0 {% G( L, x$ H3 Y* ]/ G
** in 'nnet' (all these require Matlab's Neural Net toolbox) 5 [' j/ d: I2 G) I$ C- U& j/ _& v) b/ X: ~: ~6 O% k, P# `) }2 a
1) demoPSOnet - standalone demo to show neural net training ( b8 |, S) Y M: D% T 2) trainpso - the neural net toolbox plugin, set net.trainFcn to this 8 t" D% p) L+ L' F! _ 3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize/ f% t5 n* _" m$ M( }2 z
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run 3 j6 D5 b& K) u+ I" k5 O; P N) J. |2 J6 R4 D" q8 N, I