I keep getting the error "NVARS" must be positive integer while implementing GA. please help....
조회 수: 6 (최근 30일)
이전 댓글 표시
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
채택된 답변
Alan Weiss
2020년 4월 23일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!