Mercurial > forge
changeset 9832:f8c94ce69046 octave-forge
ga: add unit test in ga
author | slackydeb |
---|---|
date | Fri, 23 Mar 2012 01:59:38 +0000 |
parents | ba17e4a36037 |
children | ec17785d6dcf |
files | main/ga/inst/ga.m |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/main/ga/inst/ga.m Fri Mar 23 01:59:26 2012 +0000 +++ b/main/ga/inst/ga.m Fri Mar 23 01:59:38 2012 +0000 @@ -265,13 +265,17 @@ %! x = ga (f, nvars, [], [], [], [], [], [], @nonlcon, options); ## error with conflicting optimization parameters -# TODO: Elite count cannot be greater than the population size %!shared f, nvars %! f = @rastriginsfcn; %! nvars = 2; %!function [C, Ceq] = nonlcon (x) %! C = []; %! Ceq = []; +%!error # Elite count cannot be greater than the population size +%! ps = 3; +%! bad_options = gaoptimset ("PopulationSize", ps, +%! "EliteCount", ps + 1); +%! x = ga (f, nvars, [], [], [], [], [], [], @nonlcon, bad_options); %!error # The number of individuals in the initial population cannot be greater of the population size %! ps = 3; %! bad_options = gaoptimset ("PopulationSize", ps,