Why ga() function is only finding minimum of the fitness function??...
1 view (last 30 days)
Show older comments
I want to know about the ga() function given in Global Optimization Toolbox in MATLAB 2012a....
It is finding the minimum of the fitness function..... What should I do If one need to find the maximum of the fitness function??.... I have to find the maximum fitness value of my fitness function...
One more thing..
There is an option of "Elite Count" in the option structure along with crossover and mutation.... When I am using it, this "Elite Count" is moving only those individuals to the next generation which are of low fitness value...... While in documentation it is written that "individuals with best fitness value automatically survive to the next generation"..... whats going on???...
Is this ga() is working only for finding minimum of the function only???...
plzz explain about it kindly....
0 Comments
Answers (3)
Matt J
on 20 Dec 2012
Edited: Matt J
on 20 Dec 2012
Maximizing f(x) is the same as minimizing -f(x), so you can reformulate any maximization problem as a minimization problem.
As for "Elite Count", the documentation sounds consistent with what you are seeing as long as best=lowest, and that would make sense considering that the goal is to make the fitness function as low as possible.
0 Comments
Walter Roberson
on 20 Dec 2012
If you need to maximize, then have your function return the negative of what it would normally return, and at the end, take the negative of the ultimate value.
Jonathan Epperl
on 20 Dec 2012
Of course you can also use 1/f(x) or exp(-f(x)) or ..., since the Genetic Algorithm's success is basically luck anyway those variants might work much better or much worse than -f(x).
As for the Elite Count parameter, that tells you that the n best individua move to the next generation, unaltered. Whether you write the ga so that that corresponds to a low or high fitness value is probably a matter of taste, but I agree with you, I'd have it so that high fitness means good individuum.
0 Comments
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!