Dear programmers
I need to minimize a single-objective function in ga having two(2) input variables. But the solver is showing an error:Too many input arguments. Please help.
function y = simple_fitness(x)
%SIMPLE_FITNESS fitness function for GA
y = 100 * (x(1)^2 – x(2)) ^2 + (1 – x(1))^2;
rng default % For reproducibility
FitnessFunction = @simple_fitness; numberOfVariables = 2; lb = [-3,-3]; ub = [3,3]; [x,fval] = ga(FitnessFunction,numberOfVariables,[],[],[],[],lb,ub);
Best Answer