Options in Genetic Algorithm don't work

조회 수: 30 (최근 30일)
Luigi Treccozzi
Luigi Treccozzi 2018년 2월 10일
댓글: NN 2022년 10월 27일
When I try to run this code: options = optimoptions('ga','CrossoverFcn',@mycrossover); Matlab gives me this Error: Error using optimoptions (line 124) Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc). Type DOC OPTIMOPTIONS for a list of solvers.
I have no idea what that means. Please help. How do I set options parameters?

답변 (4개)

Ahmad Rizqullah Abdul Malek
Ahmad Rizqullah Abdul Malek 2020년 3월 2일
I got this exact error too running someone else's code. The code could finally run after I installed "Global Optimization Toolbox" as an add-on for Matlab.
Go on the "Apps" tab on Matlab > "Get More Apps" > Search for "Global Optimization Toolbox" (make sure you Clear Filter first) > Install it
Run the code and it should work aye.
  댓글 수: 2
Shresth Somya
Shresth Somya 2021년 7월 21일
Thanks. It worked for me.
rwan abdallah
rwan abdallah 2022년 4월 11일
Hello, the toolbox is already installed, however , I'm still getting the same error

댓글을 달려면 로그인하십시오.


Suraj Mankulangara
Suraj Mankulangara 2018년 2월 22일
Hello Luigi
The optimoptions() function is part of the Optimization Toolbox, which is different from the Global Optimization Toolbox, (which provides the genetic algorithm solver) in MATLAB (you can refer to the top left corner in the doc links below to see which toolbox a function belongs to):
It is likely that this error occurs because you don't have either of the toolboxes installed.
To check which toolboxes are installed in your MATLAB, type
ver
at the MATLAB command window.

Israel Vargas-Cruz
Israel Vargas-Cruz 2020년 4월 2일
Error using optimoptions (line 124)
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.
Error in Genetic_Optimization (line 6)
options =
optimoptions('ga','PopulationSize',100,'Display','iter','UseParallel',true,'MaxStallGenerations',10,'PlotFcn',
@gaplotbestf);

Kevy Pontes
Kevy Pontes 2021년 1월 20일
Hello,
I've got the same error for Genetic algorithm [Error: Error using optimoptions (line 124) Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc). Type DOC OPTIMOPTIONS for a list of solvers.] with the following toolboxes installed:
MATLAB Version 8.5 (R2015a)
Simulink Version 8.5 (R2015a)
Control System Toolbox Version 9.9 (R2015a)
Data Acquisition Toolbox Version 3.7 (R2015a)
Fixed-Point Designer Version 5.0 (R2015a)
Fuzzy Logic Toolbox Version 2.2.21 (R2015a)
Global Optimization Toolbox Version 3.3.1 (R2015a)
Image Acquisition Toolbox Version 4.9 (R2015a)
Image Processing Toolbox Version 9.2 (R2015a)
Instrument Control Toolbox Version 3.7 (R2015a)
Neural Network Toolbox Version 8.3 (R2015a)
Optimization Toolbox Version 7.2 (R2015a)
Partial Differential Equation Toolbox Version 2.0 (R2015a)
Signal Processing Toolbox Version 7.0 (R2015a)
SimPowerSystems Version 6.3 (R2015a)
Simscape Version 3.13 (R2015a)
Statistics and Machine Learning Toolbox Version 10.0 (R2015a)
Symbolic Math Toolbox Version 6.2 (R2015a)
System Identification Toolbox Version 9.2 (R2015a)
Wavelet Toolbox Version 4.14.1 (R2015a)
Any guesses???
Thanks
  댓글 수: 3
Kevy Pontes
Kevy Pontes 2021년 1월 22일
Thanks, Alan.
It worked with gaoptimset.
Regards
NN
NN 2022년 10월 27일
Hi Kevy,
Please look at below code and suggest how i can modify it
options = optimoptions("ga",prob.optimoptions,"Display","iter");
[values,fval,exitflag] = solve(prob,"Solver","ga","Options",options)
i am getting the error
The value of 'Solver' is invalid. 'ga' is not a valid solver.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile 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!

Translated by