From: <sla...@us...> - 2012-03-23 01:57:39
|
Revision: 10008 http://octave.svn.sourceforge.net/octave/?rev=10008&view=rev Author: slackydeb Date: 2012-03-23 01:57:33 +0000 (Fri, 23 Mar 2012) Log Message: ----------- ga: test number of nvars in ga Modified Paths: -------------- trunk/octave-forge/main/ga/inst/ga.m Modified: trunk/octave-forge/main/ga/inst/ga.m =================================================================== --- trunk/octave-forge/main/ga/inst/ga.m 2012-03-22 22:38:34 UTC (rev 10007) +++ trunk/octave-forge/main/ga/inst/ga.m 2012-03-23 01:57:33 UTC (rev 10008) @@ -157,6 +157,17 @@ %! "options", gaoptimset ()); %! x = ga (problem); +## number of nvars +%!test +%! nvars = 1; +%! x = ga (@(x) x(1, 1) ** 2, nvars); +%!test +%! nvars = 2; +%! x = ga (@(x) (x(:, 1) ** 2) + (x(:, 2) ** 2), nvars); +%!test +%! nvars = 3; +%! x = ga (@(x) (x(:, 1) ** 2) + (x(:, 2) ** 2) + (x(:, 3) ** 2), nvars); + # TODO: structure/add tests below %!test x = ga (struct ("fitnessfcn", @rastriginsfcn, "nvars", 2, "options", gaoptimset ("FitnessLimit", 1e-7, "Generations", 200))); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |