Mercurial > forge
changeset 9706:720649af740e octave-forge
ga: analyze the test suite of the ga function
Preliminary action in order to solve bug #3287917 (Debian
bug #622929).
http://sourceforge.net/tracker/?func=detail&aid=3287917&group_id=2888&atid=102888
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=622929
author | slackydeb |
---|---|
date | Thu, 15 Mar 2012 02:22:36 +0000 |
parents | 93eb446b211e |
children | a2281c859383 |
files | main/ga/inst/ga.m |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/main/ga/inst/ga.m Wed Mar 14 22:54:39 2012 +0000 +++ b/main/ga/inst/ga.m Thu Mar 15 02:22:36 2012 +0000 @@ -117,6 +117,8 @@ ## nvars == 2 and min != zeros (1, nvars) +## TODO: Move this code into a future demo, as it shows that ga +## optimizes also functions whose minimum is not in zero %!# TODO: get this test working with tol = 1e-6 %!xtest %! min = [-1, 2]; @@ -132,17 +134,23 @@ ## nvars == 2 and min == zeros (1, nvars) +## TODO: Move this code into a future demo, as it shows that ga +## optimizes also functions with nvars > 0 %!xtest assert (ga (@rastriginsfcn, 2), [0, 0], 1e-3) +## TODO: Convert this test into a test on type of arguments %!# TODO: get this test working with tol = 1e-6 %!xtest assert (ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "Generations", 1000))), zeros (1, 2), 1e-4) +## TODO: This test is like the previous one ("PopulationSize" vs. +## "Generations"): remove it? %!# TODO: get this test working with tol = 1e-6 %!xtest assert (ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "PopulationSize", 200))), zeros (1, 2), 1e-4) ## nvars == 4 and min == zeros (1, nvars) +## TODO: Convert this test into a test on type of arguments %!# TODO: get this test working with tol = 1e-3 %!xtest assert (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))), zeros (1, 4), 1e-2) @@ -166,6 +174,7 @@ %!xtest ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("Generations", 10, "UseParallel", "always"))); +## TODO: move to demo as this is really a xtest %!test ## Vectorized option speeds up execution %! %! tic ();