Optimization running. Error running optimization. Not enough input arguments.

gefunction [y] = project(a,b,c)
y(1) = 298.83636363636-0.18804545454545*a-1.2545454545454*b+103.18181818182*c-0.00016666666666667*a*b+0.049999999999998*a*c +2.3333333333333*b*c+(5.3409090909091*exp^-05)*a*a+0.011717171717172*b*b-745.45454545455*c*c;
y(2) = 42.35866-0.061045*a+0.130620*b+55.76455*c -0.000055*a*b-0.015875*a*c +0.088333*b*c +0.000024*a*a-0.000818*b*b-95.63636*c*c;
y(3) = -0.009606+0.000015*a-0.000023*b+0.013440*c+(3.16667*exp^-09)*a* b-(1.25000*exp^-06)*a*c+0.000017*b*c-(5.30227*exp^-09)*a*a+(1.52929*exp^-07)*b*b-0.03183*c*c;
end
my bounds are [1200 30 0.15] till [1600 60 0.25]
first time to use genetic algorithm optimization.
i gave the fitness function as @project.
then gave no: of variable as 3
then i gave the bounds
and clicked on start
i got this error as "Optimization running. Error running optimization. Not enough input arguments."
is there any steps i missed or is the equation not suitable for optimization

 Accepted Answer

According to the ga help the function should accept one input argument and return a scalar: "Write the objective function to accept a row vector of length nvars and return a scalar value", so your function would be something like this:
function y = project(x)
a = x(1);
b = x(2);
c = x(3);
y = .... your calculation
end
Note that you will have to change your calculation to return a scalar (it currently returns a vector).

1 Comment

how to optimize more than three output variables
like y(1), y(2),y(3).
is it possible what"s the code for that?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!