GA Optimization running. Error running optimization. Not enough input arguments. what to do

3 次查看(过去 30 天)
my function is simple 3 variables as shown bellow
function x = material(s,f,d)
x = (-0.552042 - (6.39734e-005*(s)) + (14.3154 (f)) + (0.261111 (d))); end and while running GA i get "not enough input arguments" This is the first time iam using GA tool so any one please help me with this problem. And specify any other steps that has to done in GA optimization tool.

回答(1 个)

A Jenkins
A Jenkins 2015-1-8
function [s_star,f_star,d_star]=find_optim()
nvars=3; %s, f, d
options=gaoptimset(@ga); % defaults, but you will need to change things
options=gaoptimset(options,'PlotFcns',{@gaplotbestf,@gaplotbestindiv});
x_star=ga(@material,nvars,options);
s_star=x_star(1); f_star=x_star(2); d_star=x_star(3);
end
function x = material(x)
s=x(1); f=x(2); d=x(3);
x = (-0.552042 - (6.39734e-005*s) + (14.3154*f) + (0.261111*d));
end

类别

Help CenterFile Exchange 中查找有关 Problem-Based Optimization Setup 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by