I keep getting the error "NVARS" must be positive integer while implementing GA. please help....
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
priyanka jindal
am 23 Apr. 2020
Kommentiert: priyanka jindal
am 12 Jun. 2020
I am trying to optimise neural network using Genetic algorithm. but getting error
Error using ga (line 317)
Number of variables (NVARS) must be a positive integer.
Error in GAONN (line 53)
[x, err_ga] = ga(h, c, ga_opts);
please help me how to fix this error...
I am attaching here the code i am using....
0 Kommentare
Akzeptierte Antwort
Alan Weiss
am 23 Apr. 2020
I did not read your code in detail, but the line where you call ga is
[x, err_ga] = ga(h, c, ga_opts);
x = ga(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon,options)
Use [] for inputs that you do not use. You need to include nvars as a positive integer.
Alan Weiss
MATLAB mathematical toolbox documentation
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!