Options in Genetic Algorithm don't work

71 Ansichten (letzte 30 Tage)
Luigi Treccozzi
Luigi Treccozzi am 10 Feb. 2018
Kommentiert: NN am 27 Okt. 2022
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?

Antworten (4)

Ahmad Rizqullah Abdul Malek
Ahmad Rizqullah Abdul Malek am 2 Mär. 2020
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 Kommentare
Shresth Somya
Shresth Somya am 21 Jul. 2021
Thanks. It worked for me.
rwan abdallah
rwan abdallah am 11 Apr. 2022
Hello, the toolbox is already installed, however , I'm still getting the same error

Melden Sie sich an, um zu kommentieren.


Suraj Mankulangara
Suraj Mankulangara am 22 Feb. 2018
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 am 2 Apr. 2020
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 am 20 Jan. 2021
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 Kommentare
Kevy Pontes
Kevy Pontes am 22 Jan. 2021
Thanks, Alan.
It worked with gaoptimset.
Regards
NN
NN am 27 Okt. 2022
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by