Code covered by the BSD License  

Highlights from
Another Particle Swarm Toolbox

image thumbnail

Another Particle Swarm Toolbox

by

 

01 Dec 2009 (Updated )

Implementation of a PSO algorithm with the same syntax as the Genetic Algorithm Toolbox.

schwefelsfcn(x)
function f = schwefelsfcn(x)
% Schwefel's function.

if strcmp(x,'init')
    f.Aineq = [] ;
    f.bineq = [] ;
    f.Aeq = [] ;
    f.beq = [] ;
    f.LB = -500*ones(1,2) ; f.UB = 500*ones(1,2) ;
    f.nonlcon = [] ;
    f.options.PopulationSize = 500 ;
    f.options.PopInitRange = [-500; 500] ;
    f.options.ConstrBoundary = 'absorb' ;
    f.options.KnownMin = 420.9687*ones(1,2) ;
else
    x = reshape(x,1,[]) ;
    f = sum(-x.*sin(sqrt(abs(x))),2) ;
end

Contact us