I want to use GA algorithm, but it gives me this error "Not enough input arguments. "

1 次查看(过去 30 天)
Hi everyone, I want to use GA algorithm gor my application but it gives me this error any body knows the problem?
code:
LB= zeros(1,9);
UB= zeros(1,9);
for i = 1:9
LB(1,i) = 1;
end
for i = 1:9
UB(1,i) = 3;
end
LB(1,10:17) = [0 -5.1 0.01 0.01 0.01 0.1 0.1 0.1];
UB(1,10:17) = [100 4 1 1 1 200 200 2000];
options = optimoptions(@ga,'PopulationSize', 80, ...
'MaxGenerations', 20, ...
'Display','iter');
x = ga(flc_cost_fcn,17,[],[],[],[],LB,UB,[],options);
[cost, out] = flc_cost_fcn (x);
error:
Not enough input arguments.
Error in flc_cost_fcn (line 10)
a = floor(p(1:9));
Error in untitled5 (line 28)
x = ga(flc_cost_fcn,17,[],[],[],[],LB,UB,[],options);

采纳的回答

Matt J
Matt J 2022-5-11
x = ga(@flc_cost_fcn,17,[],[],[],[],LB,UB,[],options);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by