From: <sla...@us...> - 2008-08-14 15:06:45
|
Revision: 5242 http://octave.svn.sourceforge.net/octave/?rev=5242&view=rev Author: slackydeb Date: 2008-08-14 15:06:51 +0000 (Thu, 14 Aug 2008) Log Message: ----------- performance gain; fix a bug in selectionstochunif function; clean license; clean ga function tests Modified Paths: -------------- trunk/octave-forge/main/ga/DESCRIPTION trunk/octave-forge/main/ga/INDEX trunk/octave-forge/main/ga/doc/todo.txt trunk/octave-forge/main/ga/inst/__ga_crossoverfcn__.m trunk/octave-forge/main/ga/inst/__ga_initial_population__.m trunk/octave-forge/main/ga/inst/__ga_mutationfcn__.m trunk/octave-forge/main/ga/inst/__ga_problem__.m trunk/octave-forge/main/ga/inst/__ga_problem_private_state__.m trunk/octave-forge/main/ga/inst/__ga_problem_return_variables__.m trunk/octave-forge/main/ga/inst/__ga_problem_state_selection__.m trunk/octave-forge/main/ga/inst/__ga_problem_update_state_at_each_generation__.m trunk/octave-forge/main/ga/inst/__ga_scores__.m trunk/octave-forge/main/ga/inst/__ga_selectionfcn__.m trunk/octave-forge/main/ga/inst/__ga_stop__.m trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m trunk/octave-forge/main/ga/inst/crossoverscattered.m trunk/octave-forge/main/ga/inst/fitscalingrank.m trunk/octave-forge/main/ga/inst/ga.m trunk/octave-forge/main/ga/inst/gacreationuniform.m trunk/octave-forge/main/ga/inst/gaoptimset.m trunk/octave-forge/main/ga/inst/mutationgaussian.m trunk/octave-forge/main/ga/inst/rastriginsfcn.m trunk/octave-forge/main/ga/inst/selectionstochunif.m Modified: trunk/octave-forge/main/ga/DESCRIPTION =================================================================== --- trunk/octave-forge/main/ga/DESCRIPTION 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/DESCRIPTION 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,5 +1,5 @@ Name: ga -Version: 0.8.0 +Version: 0.9.0 Date: 2008-08-14 Author: Luca Favatella <sla...@gm...> Maintainer: Luca Favatella <sla...@gm...> Modified: trunk/octave-forge/main/ga/INDEX =================================================================== --- trunk/octave-forge/main/ga/INDEX 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/INDEX 2008-08-14 15:06:51 UTC (rev 5242) @@ -3,10 +3,20 @@ ga gaoptimset -Utility +Creation + gacreationuniform + +Fitness Scaling + fitscalingrank + +Selection + selectionstochunif + +Crossover crossoverscattered - fitscalingrank - gacreationuniform + +Mutation mutationgaussian - rastriginsfcn - selectionstochunif \ No newline at end of file + +Utility + rastriginsfcn \ No newline at end of file Modified: trunk/octave-forge/main/ga/doc/todo.txt =================================================================== --- trunk/octave-forge/main/ga/doc/todo.txt 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/doc/todo.txt 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,28 +1,5 @@ ##### -fare gacreationuniform come matlab, ma non fare generalizzazione in gaoptimset e get perché octave non sa passare handle di funzione a funzione caricata con handle - -ricontrollare -##### - -##### gaoptimset: -StallGenLimit? -StallTimeLimit? -TimeLimit? //tic toc utile ma non nested - -NO InitialPopulation? //no, consentire solo intervallo -NO PopulationType? //no, solo vettori di double -NO PlotFcns? //no, plot non sono priorita' -NO PlotInterval? //no, solo alla fine +TimeLimit? //tic toc useful but not nested? ##### - - -##### -eventuale uscita con x,fval oltre che solo x? -##### - - -##### -forse matlab fissa pure la frazione di crossover e mutazione, cioè non sceglie l'operatore con probabilità -##### \ No newline at end of file Modified: trunk/octave-forge/main/ga/inst/__ga_crossoverfcn__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_crossoverfcn__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_crossoverfcn__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.1.4 +## Version: 1.2 function xoverKids = __ga_crossoverfcn__ (parents, options, nvars, FitnessFcn, unused, Modified: trunk/octave-forge/main/ga/inst/__ga_initial_population__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_initial_population__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_initial_population__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,20 +1,17 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn{Function File} {@var{Population} =} __ga_initial_population__ (@var{GenomeLength}, @var{FitnessFcn}, @var{options}) @@ -24,7 +21,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 3.0.1 +## Version: 3.1 #TODO consider PopulationSize as a #vector for multiple subpopolations Modified: trunk/octave-forge/main/ga/inst/__ga_mutationfcn__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_mutationfcn__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_mutationfcn__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.0.4 +## Version: 1.1 function mutationChildren = \ __ga_mutationfcn__ (parents, options, nvars, FitnessFcn, Modified: trunk/octave-forge/main/ga/inst/__ga_problem__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_problem__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_problem__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 5.7.1 +## Version: 5.8 function [x fval exitflag output population scores] = __ga_problem__ (problem) @@ -58,7 +55,7 @@ endif ## selection for crossover and mutation - parents = __ga_selectionfcn__ \ + parents(1, 1:private_state.nParents) = __ga_selectionfcn__ \ (state.Expectation, private_state.nParents, problem.options); ## crossover Modified: trunk/octave-forge/main/ga/inst/__ga_problem_private_state__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_problem_private_state__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_problem_private_state__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.0 +## Version: 1.1 function private_state = __ga_problem_private_state__ (options) #start private_state Modified: trunk/octave-forge/main/ga/inst/__ga_problem_return_variables__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_problem_return_variables__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_problem_return_variables__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.0 +## Version: 1.1 function [x fval exitflag output population scores] = \ __ga_problem_return_variables__ (state, problem) Modified: trunk/octave-forge/main/ga/inst/__ga_problem_state_selection__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_problem_state_selection__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_problem_state_selection__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.0 +## Version: 1.1 function Selection = __ga_problem_state_selection__ (private_state, options) Selection.elite = 1:private_state.ReproductionCount.elite; Modified: trunk/octave-forge/main/ga/inst/__ga_problem_update_state_at_each_generation__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_problem_update_state_at_each_generation__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_problem_update_state_at_each_generation__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.1 +## Version: 1.2 function state = __ga_problem_update_state_at_each_generation__ (state, problem, private_state) Modified: trunk/octave-forge/main/ga/inst/__ga_scores__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_scores__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_scores__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 5.2.1 +## Version: 5.3 function Scores = __ga_scores__ (fitnessfcn, Population, InitialScores = []) [nrPopulation ncPopulation] = size (Population); Modified: trunk/octave-forge/main/ga/inst/__ga_selectionfcn__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_selectionfcn__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_selectionfcn__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.0.2 +## Version: 1.1 function parents = __ga_selectionfcn__ (expectation, nParents, options) Modified: trunk/octave-forge/main/ga/inst/__ga_stop__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__ga_stop__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__ga_stop__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,20 +1,17 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn{Function File} {@var{stop} =} __ga_stop__ (@var{problem}, @var{state}) @@ -24,7 +21,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 5.0.1 +## Version: 5.1 function stop = __ga_stop__ (problem, state) Generations = \ Modified: trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m =================================================================== --- trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/__gaoptimset_default_options__.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.1.7 +## Version: 1.2 function default_options = __gaoptimset_default_options__ () default_options.CreationFcn = @gacreationuniform; Modified: trunk/octave-forge/main/ga/inst/crossoverscattered.m =================================================================== --- trunk/octave-forge/main/ga/inst/crossoverscattered.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/crossoverscattered.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 6.2.5 +## Version: 6.3 function xoverKids = crossoverscattered (parents, options, nvars, FitnessFcn, unused, Modified: trunk/octave-forge/main/ga/inst/fitscalingrank.m =================================================================== --- trunk/octave-forge/main/ga/inst/fitscalingrank.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/fitscalingrank.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.1.1 +## Version: 1.2 function expectation = fitscalingrank (scores, nParents) [nr nc] = size (scores); Modified: trunk/octave-forge/main/ga/inst/ga.m =================================================================== --- trunk/octave-forge/main/ga/inst/ga.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/ga.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,20 +1,17 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn{Function File} {@var{x} =} ga (@var{fitnessfcn}, @var{nvars}) @@ -74,9 +71,9 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 5.8.3 +## Version: 5.10 -function [x, fval, exitflag, output, population, scores] = \ +function [x fval exitflag output population scores] = \ ga (fitnessfcn_or_problem, nvars, A = [], b = [], @@ -117,29 +114,26 @@ endif endfunction -%!function retval = test_parabola (x) -%! retval = x ** 2; +%!xtest assert (ga (@(x) x ** 2, 1, [], [], [], [], [], [], [], gaoptimset ('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) +%!function retval = test_pseudo_rastriginsfcn (x) %! retval = (x ** 2) - (cos (2 * pi * x)) + 1; -%!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)) +%!xtest assert (ga (@test_pseudo_rastriginsfcn, 1, [], [], [], [], [], [], [], gaoptimset ('EliteCount', 1, 'FitnessLimit', 0.001, 'Generations', 25, 'PopInitRange', [-5; 5])), 0, sqrt(0.001)) %!xtest assert (ga (@rastriginsfcn, 2), [0, 0], 1e-6) -%!function retval = test_rastriginsfcn_traslato (t) +%!function retval = test_bias_rastriginsfcn (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))); -%!xtest assert (ga (@test_rastriginsfcn_traslato, 2, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-2; 2], 'PopulationSize', 100)), [1, 0], sqrt(0.001)) +%!xtest assert (ga (@test_bias_rastriginsfcn, 2, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-2; 2], 'PopulationSize', 100)), [1, 0], sqrt(0.001)) -%!function retval = test_4_variabili (x) +%!function retval = test_4_variables (x) %! retval = 0; %! retval += 20 + (x(1) ** 2) + (x(2) ** 2) - 10 * (cos (2 * pi * x(1)) + cos (2 * pi * x(2))); %! retval += (x(3) ** 2) - (cos (2 * pi * x(3))) + 1; %! retval += x(4) ** 2; -%!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 +%!xtest assert (ga (@test_4_variables, 4, [], [], [], [], [], [], [], gaoptimset ('FitnessLimit', 0.001, 'PopInitRange', [-1; 1])), [0, 0, 0, 0], sqrt(0.001)) \ No newline at end of file Modified: trunk/octave-forge/main/ga/inst/gacreationuniform.m =================================================================== --- trunk/octave-forge/main/ga/inst/gacreationuniform.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/gacreationuniform.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,20 +1,17 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn{Function File} {@var{Population} =} gacreationuniform (@var{GenomeLength}, @var{FitnessFcn}, @var{options}) @@ -40,7 +37,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 4.4 +## Version: 4.5 function Population = gacreationuniform (GenomeLength, FitnessFcn, options) [nr, nc] = size (options.PopInitRange); Modified: trunk/octave-forge/main/ga/inst/gaoptimset.m =================================================================== --- trunk/octave-forge/main/ga/inst/gaoptimset.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/gaoptimset.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,20 +1,17 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn{Function File} {@var{options} =} gaoptimset @@ -59,7 +56,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 4.3.5 +## Version: 4.4 function options = gaoptimset (varargin) if ((nargout != 1) || Modified: trunk/octave-forge/main/ga/inst/mutationgaussian.m =================================================================== --- trunk/octave-forge/main/ga/inst/mutationgaussian.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/mutationgaussian.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,23 +1,20 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.4.4 +## Version: 1.5 function mutationChildren = \ mutationgaussian (parents, options, nvars, FitnessFcn, Modified: trunk/octave-forge/main/ga/inst/rastriginsfcn.m =================================================================== --- trunk/octave-forge/main/ga/inst/rastriginsfcn.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/rastriginsfcn.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,20 +1,17 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## -*- texinfo -*- ## @deftypefn{Function File} {} rastriginsfcn (@var{x}) @@ -22,7 +19,7 @@ ## @end deftypefn ## Author: Luca Favatella <sla...@gm...> -## Version: 1.1 +## Version: 1.2 function retval = rastriginsfcn (x) retval = 20 + (x(1) ** 2) + (x(2) ** 2) - 10 * (cos (2 * pi * x(1)) + Modified: trunk/octave-forge/main/ga/inst/selectionstochunif.m =================================================================== --- trunk/octave-forge/main/ga/inst/selectionstochunif.m 2008-08-14 14:23:52 UTC (rev 5241) +++ trunk/octave-forge/main/ga/inst/selectionstochunif.m 2008-08-14 15:06:51 UTC (rev 5242) @@ -1,30 +1,27 @@ ## 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 of the License, or +## (at your option) any later version. ## -## 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. ## -## 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. +## along with this program; If not, see <http://www.gnu.org/licenses/>. ## Author: Luca Favatella <sla...@gm...> -## Version: 1.2.4 +## Version: 1.3 function parents = selectionstochunif (expectation, nParents, options) nc_expectation = columns (expectation); line(1, 1:nc_expectation) = cumsum (expectation(1, 1:nc_expectation)); max_step_size = line(1, nc_expectation); step_size = max_step_size * rand (); - steps(1, 1:nParents) = rem (step_size * ones (1, nParents), max_step_size); + steps(1, 1:nParents) = rem (step_size * (1:nParents), max_step_size); for index_steps = 1:nParents ## fix an entry of the steps (or parents) vector #assert (steps(1, index_steps) < max_step_size); ## DEBUG index_line = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |