Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/24/12 09:25:32 (13 years ago)
Author:
mkommend
Message:

#1691: Updated IslandGA, NSGA2 and IslandOSGA to use default operators.

File:
1 edited

Legend:

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

    r7259 r7511  
    598598    private void UpdateCrossovers() {
    599599      ICrossover oldCrossover = CrossoverParameter.Value;
     600      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
    600601      CrossoverParameter.ValidValues.Clear();
    601602      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
     
    604605        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
    605606        if (crossover != null) CrossoverParameter.Value = crossover;
    606       }
     607        else oldCrossover = null;
     608      }
     609      if (oldCrossover == null && defaultCrossover != null)
     610        CrossoverParameter.Value = defaultCrossover;
    607611    }
    608612    private void UpdateMutators() {
Note: See TracChangeset for help on using the changeset viewer.