"too many output arguments". gamultiobj Optimization Toolbox
이전 댓글 표시
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!
답변 (1개)
Alan Weiss
2015년 7월 16일
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
Sebastian Sickmann
2015년 7월 17일
Alan Weiss
2015년 7월 17일
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
2015년 7월 20일
Alan Weiss
2015년 7월 20일
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
2015년 7월 21일
카테고리
도움말 센터 및 File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!