Options in Genetic Algorithm don't work

66 ビュー (過去 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 Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by