Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15007


Ignore:
Timestamp:
05/31/17 12:52:25 (7 years ago)
Author:
abeham
Message:

#2792: adapted wiring code to be the same as with crossover, choosing the default manipulator intead of the first (by name)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs

    r15006 r15007  
    397397      IManipulator oldMutator = MutatorParameter.Value;
    398398      MutatorParameter.ValidValues.Clear();
     399      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
     400
    399401      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
    400402        MutatorParameter.ValidValues.Add(mutator);
     403
    401404      if (oldMutator != null) {
    402405        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
    403406        if (mutator != null) MutatorParameter.Value = mutator;
    404       }
     407        else oldMutator = null;
     408      }
     409
     410      if (oldMutator != null && defaultMutator != null)
     411        MutatorParameter.Value = defaultMutator;
    405412    }
    406413    private void UpdateAnalyzers() {
Note: See TracChangeset for help on using the changeset viewer.