Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/23/17 11:17:18 (8 years ago)
Author:
abeham
Message:

#2258: merged r14001:15280 from trunk into branch

Location:
branches/Async
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/Async

  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r13173 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    280280      if (!Parameters.ContainsKey("FillPopulationWithParents"))
    281281        Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
     282
     283      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
     284      if (optionalMutatorParameter != null) {
     285        Parameters.Remove(optionalMutatorParameter);
     286        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     287        foreach (var m in optionalMutatorParameter.ValidValues)
     288          MutatorParameter.ValidValues.Add(m);
     289        if (optionalMutatorParameter.Value == null) MutationProbability.Value = 0; // to guarantee that the old configuration results in the same behavior
     290        else Mutator = optionalMutatorParameter.Value;
     291        optionalMutatorParameter.ValidValues.Clear(); // to avoid dangling references to the old parameter its valid values are cleared
     292      }
    282293      #endregion
    283294
     
    311322      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    312323      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
    313       Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     324      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    314325      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
    315326      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
     
    642653      IManipulator oldMutator = MutatorParameter.Value;
    643654      MutatorParameter.ValidValues.Clear();
     655      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
     656
    644657      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
    645658        MutatorParameter.ValidValues.Add(mutator);
     659
    646660      if (oldMutator != null) {
    647661        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
    648662        if (mutator != null) MutatorParameter.Value = mutator;
    649       }
     663        else oldMutator = null;
     664      }
     665
     666      if (oldMutator == null && defaultMutator != null)
     667        MutatorParameter.Value = defaultMutator;
    650668    }
    651669    private void UpdateAnalyzers() {
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs

    r12012 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r13173 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5555
    5656    #region Parameter Properties
    57     private ValueParameter<IntValue> SeedParameter {
     57    public IValueParameter<IntValue> SeedParameter {
    5858      get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
    5959    }
    60     private ValueParameter<BoolValue> SetSeedRandomlyParameter {
     60    public IValueParameter<BoolValue> SetSeedRandomlyParameter {
    6161      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
    6262    }
    63     private ValueParameter<IntValue> PopulationSizeParameter {
     63    public IValueParameter<IntValue> PopulationSizeParameter {
    6464      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
    6565    }
     
    7070      get { return (IConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
    7171    }
    72     private ValueParameter<PercentValue> MutationProbabilityParameter {
     72    public IValueParameter<PercentValue> MutationProbabilityParameter {
    7373      get { return (ValueParameter<PercentValue>)Parameters["MutationProbability"]; }
    7474    }
     
    7676      get { return (IConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    7777    }
    78     private ValueParameter<IntValue> ElitesParameter {
     78    public IValueParameter<IntValue> ElitesParameter {
    7979      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
    8080    }
    81     private IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
     81    public IFixedValueParameter<BoolValue> ReevaluateElitesParameter {
    8282      get { return (IFixedValueParameter<BoolValue>)Parameters["ReevaluateElites"]; }
    8383    }
    84     private ValueParameter<IntValue> MaximumGenerationsParameter {
     84    public IValueParameter<IntValue> MaximumGenerationsParameter {
    8585      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
    8686    }
    87     private ValueLookupParameter<DoubleValue> SuccessRatioParameter {
     87    public IValueLookupParameter<DoubleValue> SuccessRatioParameter {
    8888      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
    8989    }
    90     private ValueLookupParameter<DoubleValue> ComparisonFactorLowerBoundParameter {
     90    public IValueLookupParameter<DoubleValue> ComparisonFactorLowerBoundParameter {
    9191      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorLowerBound"]; }
    9292    }
    93     private ValueLookupParameter<DoubleValue> ComparisonFactorUpperBoundParameter {
     93    public IValueLookupParameter<DoubleValue> ComparisonFactorUpperBoundParameter {
    9494      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorUpperBound"]; }
    9595    }
     
    9797      get { return (IConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["ComparisonFactorModifier"]; }
    9898    }
    99     private ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
     99    public IValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
    100100      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
    101101    }
    102     private ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
     102    public IValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
    103103      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
    104104    }
    105     private ValueLookupParameter<IntValue> SelectedParentsParameter {
     105    public IValueLookupParameter<IntValue> SelectedParentsParameter {
    106106      get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
    107107    }
    108     private ValueParameter<MultiAnalyzer> AnalyzerParameter {
     108    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
    109109      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    110110    }
    111     private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
     111    public IValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
    112112      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
    113113    }
    114     private IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
     114    public IFixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
    115115      get { return (IFixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    116116    }
     
    228228      if (!Parameters.ContainsKey("FillPopulationWithParents"))
    229229        Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
     230
     231      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
     232      if (optionalMutatorParameter != null) {
     233        Parameters.Remove(optionalMutatorParameter);
     234        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     235        foreach (var m in optionalMutatorParameter.ValidValues)
     236          MutatorParameter.ValidValues.Add(m);
     237        if (optionalMutatorParameter.Value == null) MutationProbability.Value = 0; // to guarantee that the old configuration results in the same behavior
     238        else Mutator = optionalMutatorParameter.Value;
     239        optionalMutatorParameter.ValidValues.Clear(); // to avoid dangling references to the old parameter its valid values are cleared
     240      }
    230241      #endregion
    231242
     
    250261      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    251262      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
    252       Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     263      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    253264      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
    254265      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
     
    487498      IManipulator oldMutator = MutatorParameter.Value;
    488499      MutatorParameter.ValidValues.Clear();
     500      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
     501
    489502      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
    490503        MutatorParameter.ValidValues.Add(mutator);
     504
    491505      if (oldMutator != null) {
    492506        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
    493507        if (mutator != null) MutatorParameter.Value = mutator;
    494       }
     508        else oldMutator = null;
     509      }
     510
     511      if (oldMutator == null && defaultMutator != null)
     512        MutatorParameter.Value = defaultMutator;
    495513    }
    496514    private void UpdateAnalyzers() {
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r12012 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainOperator.cs

    r12012 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Plugin.cs.frame

    r13321 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626  /// Plugin class for HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3.13.$WCREV$")]
     28  [Plugin("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm", "3.3.14.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/Properties/AssemblyInfo.cs.frame

    r13321 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3131[assembly: AssemblyCompany("")]
    3232[assembly: AssemblyProduct("HeuristicLab")]
    33 [assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
     33[assembly: AssemblyCopyright("(c) 2002-2016 HEAL")]
    3434[assembly: AssemblyTrademark("")]
    3535[assembly: AssemblyCulture("")]
     
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.3.0.0")]
    55 [assembly: AssemblyFileVersion("3.3.13.$WCREV$")]
     55[assembly: AssemblyFileVersion("3.3.14.$WCREV$")]
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r12504 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    256256      if (!Parameters.ContainsKey("FillPopulationWithParents"))
    257257        Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded.", new BoolValue(false)) { Hidden = true });
     258
     259      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
     260      if (optionalMutatorParameter != null) {
     261        Parameters.Remove(optionalMutatorParameter);
     262        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     263        foreach (var m in optionalMutatorParameter.ValidValues)
     264          MutatorParameter.ValidValues.Add(m);
     265        if (optionalMutatorParameter.Value == null) MutationProbability.Value = 0; // to guarantee that the old configuration results in the same behavior
     266        else Mutator = optionalMutatorParameter.Value;
     267        optionalMutatorParameter.ValidValues.Clear(); // to avoid dangling references to the old parameter its valid values are cleared
     268      }
    258269      #endregion
    259270
     
    282293      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
    283294      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
    284       Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
     295      Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
    285296      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
    286297      Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true });
     
    561572      ICrossover oldCrossover = CrossoverParameter.Value;
    562573      CrossoverParameter.ValidValues.Clear();
     574      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
     575
    563576      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
    564577        CrossoverParameter.ValidValues.Add(crossover);
     578
    565579      if (oldCrossover != null) {
    566580        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
    567581        if (crossover != null) CrossoverParameter.Value = crossover;
    568       }
     582        else oldCrossover = null;
     583      }
     584      if (oldCrossover == null && defaultCrossover != null)
     585        CrossoverParameter.Value = defaultCrossover;
    569586    }
    570587    private void UpdateMutators() {
    571588      IManipulator oldMutator = MutatorParameter.Value;
    572589      MutatorParameter.ValidValues.Clear();
     590      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
     591
    573592      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
    574593        MutatorParameter.ValidValues.Add(mutator);
     594
    575595      if (oldMutator != null) {
    576596        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
    577597        if (mutator != null) MutatorParameter.Value = mutator;
    578       }
     598        else oldMutator = null;
     599      }
     600
     601      if (oldMutator == null && defaultMutator != null)
     602        MutatorParameter.Value = defaultMutator;
    579603    }
    580604    private void UpdateAnalyzers() {
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r12886 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/Async/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SuccessfulOffspringAnalysis/SuccessfulOffspringAnalyzer.cs

    r12012 r15281  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
Note: See TracChangeset for help on using the changeset viewer.