"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!