PSO Problem

Write a Matlab program for Particle Swarm Optimization (PSO). Keep it as generic as possible.

1. Use you PSO to find the minimum of the Rosenbrock banana function in five dimensions. The Rosenbrock function is

f2(x)=sum(100·(x(i+1)-x(i)^2)^2+(1-x(i))^2), i=1:n-1;
-2.048<=x(i)<=2.048.

Here is what it looks like in 2D:


Were you required to twiddle the parameters of the PSO to make this work?

2. Use the same PSO with the same parameters to minimize Rastrigin's function in 5 dimensions. This test function is highly multimodal. However, the location of the minima are regularly distributed.

function definition
f(x)=10·n+sum(x(i)^2-10·cos(2·pi·x(i))), i=1:n;
-5.12<=x(i)<=5.12.

global minimum
f(x)=0; x(i)=0, i=1:n.

Here it is in 2D:

 

Important: Document your work and include eye candy.  I want to see what you did without looking at the code in detail.

___________________________________________________________________________

Note: These functions taken from

http://www.systemtechnik.tu-ilmenau.de/~pohlheim/GA_Toolbox/fcnfun6.html

and

http://www.systemtechnik.tu-ilmenau.de/~pohlheim/GA_Toolbox/fcnfun2.html