Options for Genetic Algorithm don't work
이전 댓글 표시
Hello. I need to set limited computation time for my GA optimization. I used both gaoptimset and optimset, but they don't work. It's not terminated when time is up. Also tried optimoptions, but got an error:
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc). Type DOC OPTIMOPTIONS for a list of solvers.
My code:
options = gaoptimset('TimeLimit',30);
%options = optimset('MaxTime',30);
%options = optimoptions('MaxTime',30);
[x,fval] = ga(fitnessfcn,nvars,A,b,[],[],LB,UB,nonlcon,options)
What's wrong? (MATLAB R2014b)
댓글 수: 2
jianli chen
2019년 2월 25일
Hi Vladimir,I encounter the same problem when using GA optimization in Matlab. Has you solved this problem? Thanks for your help.
Walter Roberson
2019년 2월 25일
jianli chen: which MATLAB release are you using, and how do you create the options?
답변 (1개)
Alan Weiss
2017년 4월 14일
1 개 추천
For R2014b use gaoptimset. For R2014b, use the correct option names, as many option names changed in R2016a. In particular, for R2014b, the maximum time is specified by the MaxTime option, not the TimeLimit option.
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 4
Vladimir Berezkin
2017년 4월 14일
Alan Weiss
2017년 4월 19일
Sorry, I got it exactly backwards. TimeLimit is indeed the legacy name, the appropriate one for you to use.
You do not show that you are using parallel computing in your options. There was a bug that caused TimeLimit not to be honored in parallel in the way that you would expect. This was fixed in R2015b. So, if you are using parallel computing, then adjust your call as suggested in one of the links.
Alan Weiss
MATLAB mathematical toolbox documentation
Vladimir Berezkin
2017년 4월 21일
편집: Vladimir Berezkin
2017년 4월 22일
Alan Weiss
2017년 4월 24일
Sorry, I have never heard of this problem before. Perhaps you should contact technical support.
Alan Weiss
MATLAB mathematical toolbox documentation
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!