ga

ga solves for the global minimum of a function using the Real-Coded Genetic Algorithm implementation based on "Genetic Algorithms in Search, Optimization and Machine Learning" [1].

[xmin,fmin,popPos,popCost,info] = ga(f,o)

  • f: function handle
  • o: optimization options
Options Description Values Default values
d Dimension positive integer 1
lb Lower bounds double realmin/100
ub Upper bounds double realmax/100
display Information display level 'iter' 'iter'
pop Population size positive integer 10
maxit Maximum Number of Iterations positive integer 20
method Selection method 'Roulette Wheel', 'Tournament' or 'Random' 'Roulette Wheel'
Outputs:
  • xmin: minimum of f
  • fmin: function value at xmin
  • popPos: contains position for the entire population (each row corresponds to one individual)
  • popCost: the cost for each individuals
  • info: struct object with information for the animation

Animation

Call optimview('ga',info), being info the fifth output of ga. Some animation options can be specified appending them to the struct object info.
Options Description Values Default values
animfreq Frame frequency positive integer 1
animstart Inicial iteration to start animation positive integer 1

References

[1] ^ D. Goldberg, "Genetic Algorithms in Search, Optimization and Machine Learning", MA: Addison-Wesley Professional, Reading, 1989.

See also

fminsearch | nsga2