Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17198


Ignore:
Timestamp:
08/10/19 12:16:18 (5 years ago)
Author:
mkommend
Message:

#3020: Adapated AfterDeserializationHook of genetic algorithms to check if the mutator parameter already has the correct type.
In detail the following algorithms have been adapted: ALPS-GA, ALPS-OSGA, GA, Island-GA, NSGA-2, Island-OSGA, OSGA, SASEGASA.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.ALPS/3.3/AlpsGeneticAlgorithm.cs

    r17180 r17198  
    253253      #region Backwards compatible code, remove with 3.4
    254254      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    255       if (optionalMutatorParameter != null) {
     255      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     256      if (mutatorParameter == null && optionalMutatorParameter != null) {
    256257        Parameters.Remove(optionalMutatorParameter);
    257258        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.ALPS/3.3/AlpsOffspringSelectionGeneticAlgorithm.cs

    r17180 r17198  
    300300      #region Backwards compatible code, remove with 3.4
    301301      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    302       if (optionalMutatorParameter != null) {
     302      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     303      if (mutatorParameter == null && optionalMutatorParameter != null) {
    303304        Parameters.Remove(optionalMutatorParameter);
    304305        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs

    r17180 r17198  
    221221        Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });
    222222      }
     223
    223224      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    224       if (optionalMutatorParameter != null) {
     225      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     226      if (mutatorParameter == null && optionalMutatorParameter != null) {
    225227        Parameters.Remove(optionalMutatorParameter);
    226228        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs

    r17180 r17198  
    211211        Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true });
    212212      }
     213
    213214      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    214       if (optionalMutatorParameter != null) {
     215      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     216      if (mutatorParameter == null && optionalMutatorParameter != null) {
    215217        Parameters.Remove(optionalMutatorParameter);
    216218        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs

    r17180 r17198  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Analysis;
    2526using HeuristicLab.Common;
     
    3031using HeuristicLab.Optimization.Operators;
    3132using HeuristicLab.Parameters;
    32 using HEAL.Attic;
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Random;
     
    326326      if (!Parameters.ContainsKey("DominateOnEqualQualities"))
    327327        Parameters.Add(new FixedValueParameter<BoolValue>("DominateOnEqualQualities", "Flag which determines wether solutions with equal quality values should be treated as dominated.", new BoolValue(false)));
     328
    328329      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    329       if (optionalMutatorParameter != null) {
     330      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     331      if (mutatorParameter == null && optionalMutatorParameter != null) {
    330332        Parameters.Remove(optionalMutatorParameter);
    331333        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs

    r17180 r17198  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Analysis;
    2526using HeuristicLab.Common;
     
    3031using HeuristicLab.Optimization.Operators;
    3132using HeuristicLab.Parameters;
    32 using HEAL.Attic;
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Random;
     
    282282
    283283      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    284       if (optionalMutatorParameter != null) {
     284      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     285      if (mutatorParameter == null && optionalMutatorParameter != null) {
    285286        Parameters.Remove(optionalMutatorParameter);
    286287        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r17180 r17198  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Analysis;
    2526using HeuristicLab.Common;
     
    3031using HeuristicLab.Optimization.Operators;
    3132using HeuristicLab.Parameters;
    32 using HEAL.Attic;
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Random;
     
    230230
    231231      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    232       if (optionalMutatorParameter != null) {
     232      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     233      if (mutatorParameter == null && optionalMutatorParameter != null) {
    233234        Parameters.Remove(optionalMutatorParameter);
    234235        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
  • trunk/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r17180 r17198  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Analysis;
    2526using HeuristicLab.Common;
     
    3031using HeuristicLab.Optimization.Operators;
    3132using HeuristicLab.Parameters;
    32 using HEAL.Attic;
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Random;
     
    258258
    259259      var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>;
    260       if (optionalMutatorParameter != null) {
     260      var mutatorParameter = MutatorParameter as ConstrainedValueParameter<IManipulator>;
     261      if (mutatorParameter == null && optionalMutatorParameter != null) {
    261262        Parameters.Remove(optionalMutatorParameter);
    262263        Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
Note: See TracChangeset for help on using the changeset viewer.