From: <sla...@us...> - 2008-08-07 13:21:04
|
Revision: 5228 http://octave.svn.sourceforge.net/octave/?rev=5228&view=rev Author: slackydeb Date: 2008-08-07 13:21:13 +0000 (Thu, 07 Aug 2008) Log Message: ----------- initial version of mutationgaussian; switch default MutationFcn from mutationsinglepoint to mutationgaussian; performance loss because mutationgaussian is unoptimized Modified Paths: -------------- trunk/octave-forge/main/ga/DESCRIPTION trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m trunk/octave-forge/main/ga/inst/ga.m Added Paths: ----------- trunk/octave-forge/main/ga/inst/mutationgaussian.m Modified: trunk/octave-forge/main/ga/DESCRIPTION =================================================================== --- trunk/octave-forge/main/ga/DESCRIPTION 2008-08-07 11:26:17 UTC (rev 5227) +++ trunk/octave-forge/main/ga/DESCRIPTION 2008-08-07 13:21:13 UTC (rev 5228) @@ -1,5 +1,5 @@ Name: ga -Version: 0.5.0 +Version: 0.5.1 Date: 2008-08-07 Author: Luca Favatella <sla...@gm...> Maintainer: Luca Favatella <sla...@gm...> Modified: trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m 2008-08-07 11:26:17 UTC (rev 5227) +++ trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m 2008-08-07 13:21:13 UTC (rev 5228) @@ -17,7 +17,7 @@ ## 02110-1301, USA. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.1 +## Version: 1.1.2 function default_options = __gaoptimset_default_options__ () default_options.CreationFcn = @gacreationuniform; @@ -36,8 +36,7 @@ #default_options.MigrationDirection = "forward"; #default_options.MigrationFraction = 0.2; #default_options.MigrationInterval = 20; - default_options.MutationFcn = {@mutationsinglepoint}; - #TODO write default mutationgaussian + default_options.MutationFcn = {@mutationgaussian, 1, 1}; #TODO delete mutationsinglepoint #default_options.OutputFcns = []; #default_options.ParetoFraction = 0.35; Modified: trunk/octave-forge/main/ga/inst/ga.m =================================================================== --- trunk/octave-forge/main/ga/inst/ga.m 2008-08-07 11:26:17 UTC (rev 5227) +++ trunk/octave-forge/main/ga/inst/ga.m 2008-08-07 13:21:13 UTC (rev 5228) @@ -74,7 +74,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 5.8.1 +## Version: 5.8.3 function [x, fval, exitflag, output, population, scores] = \ ga (fitnessfcn_or_problem, @@ -120,21 +120,21 @@ %!function retval = test_parabola (x) %! retval = x ** 2; -%!assert (ga (@test_parabola, 1, [], [], [], [], [], [], [], gaoptimset ('CrossoverFcn', @crossoversinglepoint, 'EliteCount', 1, 'FitnessLimit', 0.001, 'Generations', 10, 'PopInitRange', [-1; 1])), 0, sqrt(0.001)) +%!xtest assert (ga (@test_parabola, 1, [], [], [], [], [], [], [], gaoptimset ('CrossoverFcn', @crossoversinglepoint, 'EliteCount', 1, 'FitnessLimit', 0.001, 'Generations', 10, 'PopInitRange', [-1; 1])), 0, sqrt(0.001)) %!function retval = test_f_con_inf_minimi_locali (x) %! retval = (x ** 2) - (cos (2 * pi * x)) + 1; -%!assert (ga (@test_f_con_inf_minimi_locali, 1, [], [], [], [], [], [], [], gaoptimset ('CrossoverFcn', @crossoversinglepoint, 'EliteCount', 1, 'FitnessLimit', 0.001, 'Generations', 25, 'PopInitRange', [-5; 5])), 0, sqrt(0.001)) +%!xtest assert (ga (@test_f_con_inf_minimi_locali, 1, [], [], [], [], [], [], [], gaoptimset ('CrossoverFcn', @crossoversinglepoint, 'EliteCount', 1, 'FitnessLimit', 0.001, 'Generations', 25, 'PopInitRange', [-5; 5])), 0, sqrt(0.001)) -%!assert (ga (@rastriginsfcn, 2), [0, 0], 1e-6) +%!xtest assert (ga (@rastriginsfcn, 2), [0, 0], 1e-6) %!function retval = test_rastriginsfcn_traslato (t) %! min = [1, 0]; %! x = t - min; %! retval = 20 + (x(1) ** 2) + (x(2) ** 2) - 10 * (cos (2 * pi * x(1)) + cos (2 * pi * x(2))); -%!assert (ga (@test_rastriginsfcn_traslato, 2, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-2; 2], 'PopulationSize', 100)), [1, 0], sqrt(0.001)) +%!xtest assert (ga (@test_rastriginsfcn_traslato, 2, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-2; 2], 'PopulationSize', 100)), [1, 0], sqrt(0.001)) %!function retval = test_4_variabili (x) %! retval = 0; @@ -142,4 +142,4 @@ %! retval += (x(3) ** 2) - (cos (2 * pi * x(3))) + 1; %! retval += x(4) ** 2; -%!assert (ga (@test_4_variabili, 4, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-1; 1])), [0, 0, 0, 0], sqrt(0.001)) \ No newline at end of file +%!xtest assert (ga (@test_4_variabili, 4, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-1; 1])), [0, 0, 0, 0], sqrt(0.001)) \ No newline at end of file Added: trunk/octave-forge/main/ga/inst/mutationgaussian.m =================================================================== --- trunk/octave-forge/main/ga/inst/mutationgaussian.m (rev 0) +++ trunk/octave-forge/main/ga/inst/mutationgaussian.m 2008-08-07 13:21:13 UTC (rev 5228) @@ -0,0 +1,36 @@ +## Copyright (C) 2008 Luca Favatella <sla...@gm...> +## +## +## This program is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn{Function File} {@var{mutationChildren} =} mutationgaussian (@var{parents}, @var{options}, @var{nvars}, @var{FitnessFcn}, @var{state}, @var{thisScore}, @var{thisPopulation}) +## Single point mutation. +## +## @seealso{ga, gaoptimset} +## @end deftypefn + +## Author: Luca Favatella <sla...@gm...> +## Version: 0.1 + +function mutationChildren = \ + mutationgaussian (parents, + options, nvars, FitnessFcn, state, + thisScore, thisPopulation) + p1 = parents(1, 1:nvars); + + mutationChildren = p1 + randn (1, nvars); +endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |