"too many output arguments". gamultiobj Optimization Toolbox
Mostrar comentarios más antiguos
Hi, I want to use the gamultiobj algorithm to solve a multiobjective optimization problem (optimize cutting parameters of tooling machines). I already wrote the fitness function and want now to solve it with the gamultiobj algorithm. But, when I try to run it, I get the error "Optimization running. Error running optimization. Too many output arguments.". Can you say me why there are too many output arguments?!?
function y = fit(x)
y = zeros(size(x,1),3);
y(:,1) = t_r*ones(length(x(:,1)),1) + t_n*ones(length(x(:,1)),1) + V./((10^3)*(x(:,1).*(x(:,2).*x(:,3)))) + (V./((10^3)*(x(:,1).*(x(:,2).*x(:,3))))).*(t_w./(A3*(x(:,1).^A6).*((x(:,2).^A4).*(x(:,3).^A2))));
y(:,2) = K_ML*t_r*ones(length(x(:,1)),1) + K_ML*t_n*ones(length(x(:,1)),1) + K_ML*(V./((10^3)*x(:,1).*(x(:,2).*x(:,3)))) + (V./((10^3)*(x(:,1).*(x(:,2).*x(:,3))))).*((t_w*K_ML)./(A3*(x(:,1).^A6).*((x(:,2).^A4).*(x(:,3).^A2)))) + (V./((10^3)*x(:,1).*(x(:,2).*x(:,3)))).*((K_WT)./(A3*(x(:,1).^A6).*((x(:,2).^A4).*(x(:,3).^A2))));
y(:,3) = ((x(:,2).^2)/(8*r_e)); %.*(a.^0).*(v.^0)
end
The parameters (K_ML, ...) are already implemented.
Thank you!
Respuestas (1)
Alan Weiss
el 16 de Jul. de 2015
Your objective function looks vectorized. Did you set options to have vectorized function evaluations?
options = gaoptimset('Vectorized','on');
Also, as a first debugging step, can you take a row vector (not matrix) input vector x and compute y = fit(x) and check that it is a 3-element row vector? If so, then take x as a matrix with two rows and check that y = fit(x) is also a matrix with 2 rows.
Alan Weiss
MATLAB mathematical toolbox documentation
5 comentarios
Sebastian Sickmann
el 17 de Jul. de 2015
Alan Weiss
el 17 de Jul. de 2015
Then I will need more information. Can you please give your exact call to gamultiobj, including all options and any other relevant input arguments?
Alan Weiss
MATLAB mathematical toolbox documentation
Sebastian Sickmann
el 20 de Jul. de 2015
Alan Weiss
el 20 de Jul. de 2015
Thank you for the information. I was able to get the optimization to run in part, but it halted due to complex values in the objective function. You probably need to introduce some bounds in your optimization in order to prevent complex values from appearing.
How did I get the optimization to run while you could not? I suspect that your objective function is poorly named. fit.m is a function in Curve Fitting Toolbox, and if you have that toolbox then MATLAB might be confused over which function file to use. I suggest that you change the name from fit.m to something unique.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Sebastian Sickmann
el 21 de Jul. de 2015
Categorías
Más información sobre Problem-Based Optimization Setup en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!