(R2016.a) Undefined function or variable 'gaoptimset'.

I am using ga and have the following block included in my program
%Start with default options
options = gaoptimset;
%%Modify some parameters
options = gaoptimset(options,'PopInitRange' ,[LB;UB]);
options = gaoptimset(options,'PopulationSize',PopulationSize);
options = gaoptimset(options,'Generations',Generations);
options = gaoptimset(options,'StallGenLimit' ,inf);
options = gaoptimset(options,'StallTimeLimit',inf);
options = gaoptimset(options,'MutationFcn' ,@mutationadaptfeasible);
options = gaoptimset(options,'TolCon',1e-6);
options = gaoptimset(options,'TolFun',1e-6);
options = gaoptimset(options,'Display' ,'iter');
options = gaoptimset(options,'EliteCount',PopulationSize/10);
options = gaoptimset(options,'CrossoverFraction' ,0.6);
% options = gaoptimset(options,'Vectorized' ,'on');
What worked out several times. Now I get the error
Undefined function or variable 'gaoptimset'. Any ideas to solve it?

回答 (2 件)

Star Strider
Star Strider 2017 年 11 月 18 日

0 投票

You could have a path problem.
Run these lines from the Command Window or a script:
restoredefaultpath
rehash toolboxcache
If you still have problems after that, Contzct Support (link).

2 件のコメント

Janosch Fagaschewski
Janosch Fagaschewski 2017 年 11 月 19 日
Starting Matlab the command window shows
Warning: Name is nonexistent or not a directory: optimfun
Seems to be a path issue, but I have no clue how to solve it...
Star Strider
Star Strider 2017 年 11 月 19 日
The first option to solve path problems is to run the commands I quoted. Did you run them? What was the result?

サインインしてコメントする。

Janosch Fagaschewski
Janosch Fagaschewski 2017 年 11 月 19 日

0 投票

Fixed it with an update to R2017b. Regards.

タグ

質問済み:

2017 年 11 月 18 日

コメント済み:

2017 年 11 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by