[0fc321]: doc / EXAMPLES  Maximize  Restore  History

Download this file

35 lines (18 with data), 1.0 kB

This file could be outdated or incomplete. Please refer to tests in ga.m.

If you add in this file an example not coming from ga.m, please mark
it as "NOT COPIED FROM ga.m".



########

min = [-1, 2];
ga (struct ("fitnessfcn", @(x) rastriginsfcn (x - min), "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "Generations", 1000, "PopInitRange", [-5; 5], "PopulationSize", 200)))

########

ga (@(x) x ** 2, 1)

########

ga (@(x) (x ** 2) - (cos (2 * pi * x)) + 1, 1)

########

ga (@rastriginsfcn, 2)

########

ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "Generations", 1000)))

########

ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "PopulationSize", 200)))

########

ga (struct ("fitnessfcn", @(x) rastriginsfcn (x(1:2)) + ((x(3) ** 2) - (cos (2 * pi * x(3))) + 1) + (x(4) ** 2), "nvars", 4, "options", gaoptimset ("EliteCount", 5, "FitnessLimit", 1e-7, "PopInitRange", [-2; 2], "PopulationSize", 200)))

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks