MATLAB: GA code problem in using options

gaoptimoptionsoptions

I am using GA as a solver of my optimization problem. However, it gives me an error about options I use. o
ptions = optimoptions('ga','MaxGenerations',{10e5});
[x,fval] = ga(@obj_func,3,[],[],[],[],lb,ub,options);
The error I get is as follow:
Error using optimoptions (line 114)
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or
@fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.
I have checked the option for GA and apparently, I am not using anything wrong. Anyone can help me with this? Thank you so much for the time.

Best Answer

optimoptions was extended to ga in R2016a. If your MATLAB version is older than that, use gaoptimset. And, as Stephan said, do not put the value of MaxGenerations in curly braces.
Alan Weiss
MATLAB mathematical toolbox documentation