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.

binarytestfcn(x)
function f = binarytestfcn(x)
% The minimum value of f should be obtained when x = [0,1,0,1,0,1, etc].

if strcmp(x,'init')
    f.PopulationType = 'bitstring' ;
else
    if length(x) < 2, x(2) = 0 ; end
    f = sum(x(1:2:end)) - sum(x(2:2:end)) ;
end

Contact us