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

1 view (last 30 days)
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);

Accepted Answer

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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!