GA toolbox running error
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I want to use genetic algorithm in my code but I get this:" Error running optimization. Too many output arguments ". So, I tried to run the rastriginsfcn which is written on the help file in the optimization toolbox so that I can understand if there is something wrong with my MATLAB or not. I input @rastriginsfcn in Fitness function and 2 in Number of variables and then push the start but it does not work either and I get the same error. Can someone help me out?
0 Kommentare
Antworten (2)
Alan Weiss
am 24 Jul. 2013
Please give the exact call you use and the exact exit message. Something like this:
[x,fval] = ga(@rastriginsfcn,2)
On my machine I get, at least for one run:
Optimization terminated: average change in the fitness value less than options.TolFun.
x =
0.9706 0.0063
fval =
1.1202
Alan Weiss
MATLAB mathematical toolbox documentation
0 Kommentare
Bakrey Bsata
am 17 Apr. 2022
Bearbeitet: Bakrey Bsata
am 17 Apr. 2022
1- Open ga function as in the screenshot below with right click on ga word
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/967160/image.png)
2- check the function it must Open the right one as in the screenshot
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/967165/image.png)
and if it opens another one you have to delete or change it's name that function and keep the ga shown above.
3- Repeat the steps until it opens the Correct GA function shown above.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!