I do optimization in Matlab using genetic algorithm but the results just give the optimal set. However I need also to plot the convergence of objective function over generations.
In order to be able to plot the output of objective function after each generation you must define for matlab this using the gaoptimset command like this
options = gaoptimset('plotfcns',@gaplotbestf)
[x,fval] = ga(@obj,options);
Which run the genetic algorithm for obejctive function obj and plot the mean and best value of objective function over generation.
In order to be able to plot the output of objective function after each generation you must define for matlab this using the gaoptimset command like this
options = gaoptimset('plotfcns',@gaplotbestf)
[x,fval] = ga(@obj,options);
Which run the genetic algorithm for obejctive function obj and plot the mean and best value of objective function over generation.
It is very easy to use GA toolbox for optimization. Type gatool in the command window.
You can get Best fitness,Best Individual, Distance, Expectation, Genealogy, Range, Score diversity etc. plot there after selecting on plot option.
Plot functions enable you to plot various aspects of the genetic algorithm as it is executing. Each one draws in a separate axis on the display window. Use the Stop button on the window to interrupt a running process.
Plot interval specifies the number of generations between successive updates of the plot.
Best fitness plots the best function value in each generation versus iteration number.
Best individual plots the vector entries of the individual with the best fitness function value in each generation.
Distance plots the average distance between individuals at each generation.
Expectation plots the expected number of children versus the raw scores at each generation.
Genealogy plots the genealogy of individuals. Lines from one generation to the next are color-coded as follows:
Range plots the minimum, maximum, and mean fitness function values in each generation.
Score diversity plots a histogram of the scores at each generation.
Scores plots the scores of the individuals at each generation.
Selection plots a histogram of the parents. This shows you which parents are contributing to each generation.
Stopping plots stopping criteria levels.
Max constraint plots the maximum nonlinear constraint violation.
Custom Enter a function handle of the form @plotfun, where plotfun.m is an M-file with s