from
Condor Optimizer
by Frank Vanden Berghen CONDOR: a constrained, non-linear, derivative-free optimizer for continuous, high computing load, no
OF_Q4NF(x)
function [out,error] = OF_Q4NF(x)
if (x(1)==0)&(x(2)==0)&(x(3)==0)&(x(4)==0),
% evaluation at starting point must never fail (error=0)
out=16;
error=0;
else
if (rand(1)>0.5),
% we simulate an error inside the evaluation of f(x)
out=-.001;
error=1;
fprintf('Error in evalulation of f(x) at point [%f %f]\n',x(1),x(2));
else
% no error inside the evaluation of f(x)
out=(x(1)-2)^2+(x(2)-2)^2+(x(3)-2)^2+(x(4)-2)^2+rand(1)*1e-5;
error=0;
end
end