Code covered by the BSD License  

Highlights from
Another Particle Swarm Toolbox

image thumbnail
from Another Particle Swarm Toolbox by Sam
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 length(x) < 2, x(2) = 0 ; end
f = sum(x(1:2:end)) - sum(x(2:2:end)) ;

Contact us at files@mathworks.com