Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/15/12 09:11:17 (13 years ago)
Author:
gkronber
Message:

#1081 merged r7462:7609 from trunk into time series branch

Location:
branches/HeuristicLab.TimeSeries
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

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

    r7268 r7615  
    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() {
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r7268 r7615  
    6464      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
    6565    }
    66     private ConstrainedValueParameter<ISelector> SelectorParameter {
     66    public ConstrainedValueParameter<ISelector> SelectorParameter {
    6767      get { return (ConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
    6868    }
    69     private ConstrainedValueParameter<ICrossover> CrossoverParameter {
     69    public ConstrainedValueParameter<ICrossover> CrossoverParameter {
    7070      get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
    7171    }
     
    7373      get { return (ValueParameter<PercentValue>)Parameters["MutationProbability"]; }
    7474    }
    75     private OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
     75    public OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
    7676      get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
    7777    }
     
    9191      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorUpperBound"]; }
    9292    }
    93     private OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier> ComparisonFactorModifierParameter {
     93    public OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier> ComparisonFactorModifierParameter {
    9494      get { return (OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["ComparisonFactorModifier"]; }
    9595    }
     
    447447      ICrossover oldCrossover = CrossoverParameter.Value;
    448448      CrossoverParameter.ValidValues.Clear();
     449      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
     450
    449451      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
    450452        CrossoverParameter.ValidValues.Add(crossover);
     453
    451454      if (oldCrossover != null) {
    452455        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
    453456        if (crossover != null) CrossoverParameter.Value = crossover;
    454       }
     457        else oldCrossover = null;
     458      }
     459      if (oldCrossover == null && defaultCrossover != null)
     460        CrossoverParameter.Value = defaultCrossover;
    455461    }
    456462    private void UpdateMutators() {
Note: See TracChangeset for help on using the changeset viewer.