From: <sla...@us...> - 2008-08-08 11:56:52
|
Revision: 5230 http://octave.svn.sourceforge.net/octave/?rev=5230&view=rev Author: slackydeb Date: 2008-08-08 11:56:59 +0000 (Fri, 08 Aug 2008) Log Message: ----------- improve mutationscattered Modified Paths: -------------- trunk/octave-forge/main/ga/DESCRIPTION trunk/octave-forge/main/ga/inst/mutationgaussian.m Modified: trunk/octave-forge/main/ga/DESCRIPTION =================================================================== --- trunk/octave-forge/main/ga/DESCRIPTION 2008-08-07 22:12:22 UTC (rev 5229) +++ trunk/octave-forge/main/ga/DESCRIPTION 2008-08-08 11:56:59 UTC (rev 5230) @@ -1,5 +1,5 @@ Name: ga -Version: 0.5.2 +Version: 0.5.3 Date: 2008-08-08 Author: Luca Favatella <sla...@gm...> Maintainer: Luca Favatella <sla...@gm...> Modified: trunk/octave-forge/main/ga/inst/mutationgaussian.m =================================================================== --- trunk/octave-forge/main/ga/inst/mutationgaussian.m 2008-08-07 22:12:22 UTC (rev 5229) +++ trunk/octave-forge/main/ga/inst/mutationgaussian.m 2008-08-08 11:56:59 UTC (rev 5230) @@ -24,7 +24,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 0.2.3 +## Version: 0.3.1 function mutationChildren = \ mutationgaussian (parents, @@ -46,11 +46,25 @@ LB = LocalPopInitRange(1, 1:nvars); UB = LocalPopInitRange(2, 1:nvars); - ## mutationgaussian + ## start mutationgaussian logic p1 = parents(1, 1:nvars); Scale = options.MutationFcn{1, 2}; - initial_std = Scale * (UB - LB); + assert (size (Scale), [1 1]); ## DEBUG Shrink = options.MutationFcn{1, 3}; - current_std = initial_std * (1 - Shrink * (state.Generation / options.Generations)); ## TODO consider all generations recursively, not only one + assert (size (Shrink), [1 1]); ## DEBUG + + ## initial standard deviation (i.e. when state.Generation == 0) + tmp_std = Scale * (UB - LB); ## vector = scalar * vector + + ## recursively compute current standard deviation + for k = 1:state.Generation + tmp_std = \ ## vector = scalar * vector + (1 - Shrink * (k / options.Generations)) * tmp_std; + endfor + + current_std = tmp_std; + assert (size (current_std), [1 nvars]); ## DEBUG + + ## finally add random numbers mutationChildren = p1 + current_std .* 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. |