function y = f_crosen(x)
% Chained Rosenbrock function with dimension specified by the input.
% The optimal value is zero
% suggested starting point: (-1,1,...1)^T

%err = 0.0001;
err = 0;

n = length(x);
y = (x(1)-1)^2;
for i = 2:n
   y = y + 100*(x(i)-x(i-1)^2)^2;
end

y=y+err*(2*rand(1,1)-1);
