PSOt, particle swarm optimization toolbox for matlab.0 l/ V9 d$ |! s3 K& H
8 |! T I" M, g! V* Q/ [1 z3 |
May be distributed freely as long as none of the files are ' E' b& S1 y) C$ P2 y% E
modified. 9 j) ^+ H7 L7 t4 V# M3 w7 h _ v$ Q! l! ]$ I& }! _* BSend suggestions to bkbirge@yahoo.com ' L3 r a! q3 L8 E/ x. J: ^+ }# Y% N2 e: }
Updates will be posted periodically at the Mathworks User 1 p- k2 _0 S2 y' b4 a3 x: _Contributed Files website (www.mathworks.com) under the ( J8 T$ a4 Q. VOptimization category.* h+ l, @" y! i0 ?
1 i; m& j' \! x# B( E2 T4 u
To install: . Y ]% i. u0 u, oExtract into any directory you want but make sure the matlab 0 i/ g' S1 n) @; c3 }. u$ _path points to that directory and the subdirectories $ C3 N; z/ h% f% ]) G, s
'hiddenutils' and 'testfunctions'. 6 n9 {. r6 p, q2 _. ~. y5 s6 e$ N0 M3 ]) y3 I- q8 t
Enjoy! - Brian Birge; Z% h+ j1 A. f' ^7 L" P9 N
1 b( s8 w/ Q# PINFO; i1 I1 Y8 c% Y% w7 M( ]
Quick start: just type ... out = pso_Trelea_vectorized('f6',2) ; c* p& K& M* s) S& L3 K8 Band watch it work! + `6 h4 F8 C2 {8 l5 A& [' d1 v- T" e. E" E
This is a PSO toolbox implementing Common, Clerc 1", and 8 O& u" C* T+ b f: V1 R6 \2 R8 Z3 W
Trelea types along with an alpha version of tracking changing ' J/ S+ O7 C. p$ \/ V7 menvironments. It can search for min, max, or 'distance' of + T3 u7 h0 d3 N* q1 Vuser developed cost function. Very easy to use and hack with ) ?( o/ \" @7 `: d1 D' _: z0 ~
reasonably good documentation (type help for any function and/ Y: a& k0 e% N# p" u8 n
it should tell you what you need) and will take advantage of * [8 ?- j9 D J. d9 ivectorized cost functions. It uses similar syntax to Matlab's1 `/ f- m7 k8 h
optimization toolbox. Includes a suite of static and dynamic 6 E; N% t* ^4 g0 }) v2 Z
test functions. It also includes a dedicated PSO based neural ! O6 l9 k7 {/ B) r# R6 G3 ?9 e
network trainer for use with Mathwork's neural network toolbox. g/ p3 K s/ A* ^% W3 W& V9 I/ s2 l8 f3 R
Run 'DemoPSOBehavior' to explore the various functions, options, 8 o! T$ [' X2 o6 f- j( l, f- R9 M# [
and visualizations. 3 x, Q7 ^3 q% j- `8 @3 c1 ^0 ^3 ~ z' E- }* f
Run 'demoPSOnet' to see a neural net trained with PSO ! y$ Z- G& o0 B3 p, T0 t8 ~" t(requires neural net toolbox).' _; l: m/ J# P$ @: G
" V( i# h! Z6 ^: u( z& C6 x # a: q* V9 ?( m" s! k. XThis toolbox is in constant development and I welcome 7 r% P7 y% {, P0 [! q# B/ [suggestions. The main program 'pso_Trelea_vectorized.m' lists # R/ d" x) Q2 ]: _' l$ M ` ~various papers you can look at in the comments.2 L; i5 y0 G/ o
7 `6 Y, [& M/ U. t) l/ S1 c) N
Usage ideas: to find a global min/max, to optimize training of ( ^% r6 O& n" m+ Y. \neural nets, error topology change tracking, teaching PSO, 7 I$ |2 B8 L, K2 e3 Dinvestigate Emergence, tune control systems/filters, paradigm 2 J! _* {2 `, h! f2 h8 n1 R/ u# g
for multi-agent interaction, etc.' L/ g1 C- {; E' `3 R
' Y. R; g/ N7 G @. E------------------------------------------------------------- , ]6 }( ^. z) r/ V6 R2 v7 N: |8 ~------------------------------------------------------------- X" X5 Q ]* T8 o
; @( ?4 E3 J9 {. F2 Z# L
& F' s) o2 _3 q* P* W5 j
Files included: F+ Q# j9 C5 L
- p/ r% n T& \ C* Q1 u7 n6 D7 Z' m+ ~
** in main directory:2 Z( Q' N' D4 M7 z/ x
$ z2 k7 d$ |8 L3 Y( o* L0) ReadMe.txt - this file, duh" p. H$ j# p8 t1 A
1) A Particle Swarm Optimization (PSO) Primer.pdf - powerpoint converted to pdf presentation explaining the very basics of PSO 7 M1 o! ]1 P& R2) DemoPSOBehavior.m - demo script, useful to see how the pso main function is called V: `7 J4 y z9 ~9 N# Z' S3) 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( [4 N1 g0 d/ X
4) goplotpso.m - default plotting routine used by pso algorithm ; j+ C4 i# a) c/ d; u# h) y5) pso_Trelea_vectorized.m - main PSO algorithm function, implements Common, Trelea 1&2, Clerc 1", and an alpha version of tracking environmental changes.6 w8 Y. {+ `4 Q5 [" M6 }# Z. e
. @1 D7 ^9 g3 b: b" j& E3 ~5 [9 m
2 k1 t4 A! J- B2 z( x3 [' r0 {8 f) g1 S( }1 S
** in 'hiddenutils'" V$ A- e! Q( }3 R# H* P$ u
6 j' A. O/ S- t! L R9 h( u1) 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' ]+ D4 w& V% N" j* _/ M
2) normmat.m - takes a matrix and reformats the data to fit between a new range, very flexible; D2 @9 Z2 |+ M& v( t# |
3) linear_dyn, spiral_dyn.m - helpers for the dynamic test functions listed in the 'testfunctions' directory # C3 z% g. N% {" c0 P4 @8 G$ h! s ! _! z+ Y: w8 c 3 T. v+ H0 C0 c4 o& N * J' Q' n1 w% O+ V** in 'testfunctions': L/ k1 ?/ s& y- ^
! W3 h" W# r. S; SA bunch of useful functions (mostly 2D) for testing. See help for each one for specifics. Here's a list of the names: . d% U8 O7 y6 f1 P, T, B& A+ n! G; e' J
Static test functions, minima don't change w.r.t. time/iteration:- y6 \$ q% H# E( K$ g: P1 H
1) Ackley: I% i O" x: k' }9 _7 g1 U
2) Alpine 5 M5 P' [* N* p 3) DeJong_f2+ q+ q/ T! {$ t" o- V8 b; s
4) DeJong_f3 ' g) A1 K; P& i5 ^8 @ 5) DeJong_f4: D! |! s; o& z. w6 {2 g# b" x
6) Foxhole ' `) q$ j: G" p( d" }8 { 7) Griewank ( i8 G4 O$ i: c" j) X% y, _/ {* Q 8) NDparabola # C2 }; `0 ?9 Y/ n: H: D5 G3 v 9) Rastrigin 5 \+ }4 M7 D3 I10) Rosenbrock 3 n# {1 j& p: ^ X11) Schaffer f6 % I% ]# N' ^2 |2 B9 B3 r8 b12) Schaffer f6 modified (5 f6 functions translated from each other)8 n6 y& s. @4 k. w, e, x4 H
13) Tripod" P" E! N& Y, l. S( {
- A# b+ B" F0 d, V: r6 ?7 wDynamic test functions, minima/environment evolves over time (NOT iteration, though easily modifed to do so): # D5 T9 N D$ w) V7 M. B14) f6_bubbles_dyn * ?% ^+ t+ F! } Z15) f6_linear_dyn + F- y: @* c. C ?( y' d/ F( g. p5 E16) f6_spiral_dyn O7 q. r# F2 C$ g- C
- [* {, d- }) ?$ q/ k
3 e" K& X, I7 m9 d4 _5 d
: T! d" L+ P, }$ s4 @- F8 P( W( ~
** in 'nnet' (all these require Matlab's Neural Net toolbox) . M' ^9 |& k" J, ]0 s * v+ i: u3 v' V# l6 e% L 1) demoPSOnet - standalone demo to show neural net training0 T4 A: L1 M; O, k. Q/ f
2) trainpso - the neural net toolbox plugin, set net.trainFcn to this! J9 z+ ?& E9 _2 N, j# N0 t% ?' n
3) pso_neteval - wrapper used by trainpso to call the main PSO optimizer, this is the cost function that PSO will optimize9 s6 C( n& ?! Z, Y3 z
4) goplotpso4net - default graphing plugin for trainpso, shows net architecture, relative weight indications, error, and PSO details on run " x, `% [. @! d* G+ q4 s" S: F; x- N6 {; G3 z8 g1 K1 ^$ x