Genetic Algorithm - Plotting fitness values

5 次查看(过去 30 天)
Hello,
I'm running a genetic algorithm in Matlab with [x,fval]=ga(gaproblem)
This all works fine and I get nice results. Now I wish to plot the best fitness function value at each generation; according to the user manual it should be as simple as setting
gaproblem.PlotFcns=@gaplotbestf;
This however produces no result, I get no figure. As far as I understand @gaplotbestf is built in, and there should be no need to define it, or am I getting it wrong?
It would be nice if someone could help.

采纳的回答

Seth DeLand
Seth DeLand 2013-3-11
PlotFcns needs to be passed in as an option for ga:
problem.options.PlotFcns = @gaplotbestf;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by