Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs @ 3799

Last change on this file since 3799 was 3799, checked in by gkronber, 14 years ago

Changed execution order of analyzers (algorithm analyzers after problem analyzers) #893

File size: 23.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using HeuristicLab.Analysis;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Optimization;
29using HeuristicLab.Optimization.Operators;
30using HeuristicLab.Parameters;
31using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
32using HeuristicLab.PluginInfrastructure;
33using HeuristicLab.Random;
34using HeuristicLab.Common;
35
36namespace HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm {
37  /// <summary>
38  /// An offspring selection genetic algorithm.
39  /// </summary>
40  [Item("Offspring Selection Genetic Algorithm", "An offspring selection genetic algorithm (Affenzeller, M. et al. 2009. Genetic Algorithms and Genetic Programming - Modern Concepts and Practical Applications. CRC Press).")]
41  [Creatable("Algorithms")]
42  [StorableClass]
43  public sealed class OffspringSelectionGeneticAlgorithm : EngineAlgorithm {
44    #region Problem Properties
45    public override Type ProblemType {
46      get { return typeof(ISingleObjectiveProblem); }
47    }
48    public new ISingleObjectiveProblem Problem {
49      get { return (ISingleObjectiveProblem)base.Problem; }
50      set { base.Problem = value; }
51    }
52    #endregion
53
54    #region Parameter Properties
55    private ValueParameter<IntValue> SeedParameter {
56      get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
57    }
58    private ValueParameter<BoolValue> SetSeedRandomlyParameter {
59      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
60    }
61    private ValueParameter<IntValue> PopulationSizeParameter {
62      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
63    }
64    private ConstrainedValueParameter<ISelector> SelectorParameter {
65      get { return (ConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
66    }
67    private ConstrainedValueParameter<ICrossover> CrossoverParameter {
68      get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
69    }
70    private ValueParameter<PercentValue> MutationProbabilityParameter {
71      get { return (ValueParameter<PercentValue>)Parameters["MutationProbability"]; }
72    }
73    private OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
74      get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
75    }
76    private ValueParameter<IntValue> ElitesParameter {
77      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
78    }
79    private ValueParameter<IntValue> MaximumGenerationsParameter {
80      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
81    }
82    private ValueLookupParameter<DoubleValue> SuccessRatioParameter {
83      get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; }
84    }
85    private ValueLookupParameter<DoubleValue> ComparisonFactorLowerBoundParameter {
86      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorLowerBound"]; }
87    }
88    private ValueLookupParameter<DoubleValue> ComparisonFactorUpperBoundParameter {
89      get { return (ValueLookupParameter<DoubleValue>)Parameters["ComparisonFactorUpperBound"]; }
90    }
91    private OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier> ComparisonFactorModifierParameter {
92      get { return (OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>)Parameters["ComparisonFactorModifier"]; }
93    }
94    private ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
95      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
96    }
97    private ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter {
98      get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; }
99    }
100    private ValueLookupParameter<IntValue> SelectedParentsParameter {
101      get { return (ValueLookupParameter<IntValue>)Parameters["SelectedParents"]; }
102    }
103    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
104      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
105    }
106    #endregion
107
108    #region Properties
109    public IntValue Seed {
110      get { return SeedParameter.Value; }
111      set { SeedParameter.Value = value; }
112    }
113    public BoolValue SetSeedRandomly {
114      get { return SetSeedRandomlyParameter.Value; }
115      set { SetSeedRandomlyParameter.Value = value; }
116    }
117    public IntValue PopulationSize {
118      get { return PopulationSizeParameter.Value; }
119      set { PopulationSizeParameter.Value = value; }
120    }
121    public ISelector Selector {
122      get { return SelectorParameter.Value; }
123      set { SelectorParameter.Value = value; }
124    }
125    public ICrossover Crossover {
126      get { return CrossoverParameter.Value; }
127      set { CrossoverParameter.Value = value; }
128    }
129    public PercentValue MutationProbability {
130      get { return MutationProbabilityParameter.Value; }
131      set { MutationProbabilityParameter.Value = value; }
132    }
133    public IManipulator Mutator {
134      get { return MutatorParameter.Value; }
135      set { MutatorParameter.Value = value; }
136    }
137    public IntValue Elites {
138      get { return ElitesParameter.Value; }
139      set { ElitesParameter.Value = value; }
140    }
141    public IntValue MaximumGenerations {
142      get { return MaximumGenerationsParameter.Value; }
143      set { MaximumGenerationsParameter.Value = value; }
144    }
145    public DoubleValue SuccessRatio {
146      get { return SuccessRatioParameter.Value; }
147      set { SuccessRatioParameter.Value = value; }
148    }
149    public DoubleValue ComparisonFactorLowerBound {
150      get { return ComparisonFactorLowerBoundParameter.Value; }
151      set { ComparisonFactorLowerBoundParameter.Value = value; }
152    }
153    public DoubleValue ComparisonFactorUpperBound {
154      get { return ComparisonFactorUpperBoundParameter.Value; }
155      set { ComparisonFactorUpperBoundParameter.Value = value; }
156    }
157    public IDiscreteDoubleValueModifier ComparisonFactorModifier {
158      get { return ComparisonFactorModifierParameter.Value; }
159      set { ComparisonFactorModifierParameter.Value = value; }
160    }
161    public DoubleValue MaximumSelectionPressure {
162      get { return MaximumSelectionPressureParameter.Value; }
163      set { MaximumSelectionPressureParameter.Value = value; }
164    }
165    public BoolValue OffspringSelectionBeforeMutation {
166      get { return OffspringSelectionBeforeMutationParameter.Value; }
167      set { OffspringSelectionBeforeMutationParameter.Value = value; }
168    }
169    public IntValue SelectedParents {
170      get { return SelectedParentsParameter.Value; }
171      set { SelectedParentsParameter.Value = value; }
172    }
173    public MultiAnalyzer Analyzer {
174      get { return AnalyzerParameter.Value; }
175      set { AnalyzerParameter.Value = value; }
176    }
177    private RandomCreator RandomCreator {
178      get { return (RandomCreator)OperatorGraph.InitialOperator; }
179    }
180    private SolutionsCreator SolutionsCreator {
181      get { return (SolutionsCreator)RandomCreator.Successor; }
182    }
183    private OffspringSelectionGeneticAlgorithmMainLoop MainLoop {
184      get { return (OffspringSelectionGeneticAlgorithmMainLoop)SolutionsCreator.Successor; }
185    }
186    [Storable]
187    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
188    [Storable]
189    private ValueAnalyzer selectionPressureAnalyzer;
190    #endregion
191
192    [StorableConstructor]
193    private OffspringSelectionGeneticAlgorithm(bool deserializing) : base(deserializing) { }
194    public OffspringSelectionGeneticAlgorithm()
195      : base() {
196      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
197      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
198      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
199      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
200      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
201      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
202      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
203      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
204      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations which should be processed.", new IntValue(1000)));
205      Parameters.Add(new ValueLookupParameter<DoubleValue>("SuccessRatio", "The ratio of successful to total children that should be achieved.", new DoubleValue(1)));
206      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorLowerBound", "The lower bound of the comparison factor (start).", new DoubleValue(0)));
207      Parameters.Add(new ValueLookupParameter<DoubleValue>("ComparisonFactorUpperBound", "The upper bound of the comparison factor (end).", new DoubleValue(1)));
208      Parameters.Add(new OptionalConstrainedValueParameter<IDiscreteDoubleValueModifier>("ComparisonFactorModifier", "The operator used to modify the comparison factor.", new ItemSet<IDiscreteDoubleValueModifier>(new IDiscreteDoubleValueModifier[] { new LinearDiscreteDoubleValueModifier() }), new LinearDiscreteDoubleValueModifier()));
209      Parameters.Add(new ValueLookupParameter<DoubleValue>("MaximumSelectionPressure", "The maximum selection pressure that terminates the algorithm.", new DoubleValue(100)));
210      Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.", new BoolValue(false)));
211      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "How much parents should be selected each time the offspring selection step is performed until the population is filled. This parameter should be about the same or twice the size of PopulationSize for smaller problems, and less for large problems.", new IntValue(200)));
212      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
213     
214      RandomCreator randomCreator = new RandomCreator();
215      SolutionsCreator solutionsCreator = new SolutionsCreator();
216      OffspringSelectionGeneticAlgorithmMainLoop mainLoop = new OffspringSelectionGeneticAlgorithmMainLoop();
217      OperatorGraph.InitialOperator = randomCreator;
218
219      randomCreator.RandomParameter.ActualName = "Random";
220      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
221      randomCreator.SeedParameter.Value = null;
222      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
223      randomCreator.SetSeedRandomlyParameter.Value = null;
224      randomCreator.Successor = solutionsCreator;
225
226      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
227      solutionsCreator.Successor = mainLoop;
228
229      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
230      mainLoop.ComparisonFactorModifierParameter.ActualName = ComparisonFactorModifierParameter.Name;
231      mainLoop.ComparisonFactorParameter.ActualName = "ComparisonFactor";
232      mainLoop.ComparisonFactorStartParameter.ActualName = ComparisonFactorLowerBoundParameter.Name;
233      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
234      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
235      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
236      mainLoop.MaximumSelectionPressureParameter.ActualName = MaximumSelectionPressureParameter.Name;
237      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
238      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
239      mainLoop.OffspringSelectionBeforeMutationParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name;
240      mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
241      mainLoop.ResultsParameter.ActualName = "Results";
242      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
243      mainLoop.SuccessRatioParameter.ActualName = SuccessRatioParameter.Name;
244
245      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
246        SelectorParameter.ValidValues.Add(selector);
247      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
248      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
249      ParameterizeSelectors();
250
251      foreach (IDiscreteDoubleValueModifier modifier in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name))
252        ComparisonFactorModifierParameter.ValidValues.Add(modifier);
253      IDiscreteDoubleValueModifier linearModifier = ComparisonFactorModifierParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("LinearDiscreteDoubleValueModifier"));
254      if (linearModifier != null) ComparisonFactorModifierParameter.Value = linearModifier;
255      ParameterizeComparisonFactorModifiers();
256
257      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
258      selectionPressureAnalyzer = new ValueAnalyzer();
259      ParameterizeAnalyzers();
260      UpdateAnalyzers();
261
262      Initialize();
263    }
264
265    public override IDeepCloneable Clone(Cloner cloner) {
266      OffspringSelectionGeneticAlgorithm clone = (OffspringSelectionGeneticAlgorithm)base.Clone(cloner);
267      clone.qualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(qualityAnalyzer);
268      clone.selectionPressureAnalyzer = (ValueAnalyzer)cloner.Clone(selectionPressureAnalyzer);
269      clone.Initialize();
270      return clone;
271    }
272
273    public override void Prepare() {
274      if (Problem != null) base.Prepare();
275    }
276
277    #region Events
278    protected override void OnProblemChanged() {
279      ParameterizeStochasticOperator(Problem.SolutionCreator);
280      ParameterizeStochasticOperator(Problem.Evaluator);
281      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
282      ParameterizeSolutionsCreator();
283      ParameterizMainLoop();
284      ParameterizeSelectors();
285      ParameterizeAnalyzers();
286      ParameterizeIterationBasedOperators();
287      UpdateCrossovers();
288      UpdateMutators();
289      UpdateAnalyzers();
290      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
291      base.OnProblemChanged();
292    }
293
294    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
295      ParameterizeStochasticOperator(Problem.SolutionCreator);
296      ParameterizeSolutionsCreator();
297      base.Problem_SolutionCreatorChanged(sender, e);
298    }
299    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
300      ParameterizeStochasticOperator(Problem.Evaluator);
301      ParameterizeSolutionsCreator();
302      ParameterizMainLoop();
303      ParameterizeSelectors();
304      ParameterizeAnalyzers();
305      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
306      base.Problem_EvaluatorChanged(sender, e);
307    }
308    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
309      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
310      ParameterizeIterationBasedOperators();
311      UpdateCrossovers();
312      UpdateMutators();
313      UpdateAnalyzers();
314      base.Problem_OperatorsChanged(sender, e);
315    }
316    private void ElitesParameter_ValueChanged(object sender, EventArgs e) {
317      Elites.ValueChanged += new EventHandler(Elites_ValueChanged);
318      ParameterizeSelectors();
319    }
320    private void Elites_ValueChanged(object sender, EventArgs e) {
321      ParameterizeSelectors();
322    }
323    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
324      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
325      ParameterizeSelectors();
326    }
327    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
328      ParameterizeSelectors();
329    }
330    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
331      ParameterizMainLoop();
332      ParameterizeSelectors();
333      ParameterizeAnalyzers();
334    }
335    #endregion
336
337    #region Helpers
338    [StorableHook(HookType.AfterDeserialization)]
339    private void Initialize() {
340      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
341      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
342      ElitesParameter.ValueChanged += new EventHandler(ElitesParameter_ValueChanged);
343      Elites.ValueChanged += new EventHandler(Elites_ValueChanged);
344      if (Problem != null) {
345        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
346      }
347    }
348    private void ParameterizeSolutionsCreator() {
349      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
350      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
351    }
352    private void ParameterizMainLoop() {
353      MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
354      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
355      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
356    }
357    private void ParameterizeStochasticOperator(IOperator op) {
358      if (op is IStochasticOperator)
359        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
360    }
361    private void ParameterizeSelectors() {
362      foreach (ISelector selector in SelectorParameter.ValidValues) {
363        selector.CopySelected = new BoolValue(true);
364        selector.NumberOfSelectedSubScopesParameter.Value = null;
365        selector.NumberOfSelectedSubScopesParameter.ActualName = SelectedParentsParameter.Name;
366        ParameterizeStochasticOperator(selector);
367      }
368      if (Problem != null) {
369        foreach (ISingleObjectiveSelector selector in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
370          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
371          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
372        }
373      }
374    }
375    private void ParameterizeAnalyzers() {
376      qualityAnalyzer.ResultsParameter.ActualName = "Results";
377      selectionPressureAnalyzer.Name = "SelectionPressure Analyzer";
378      selectionPressureAnalyzer.ResultsParameter.ActualName = "Results";
379      selectionPressureAnalyzer.ValueParameter.ActualName = "SelectionPressure";
380      selectionPressureAnalyzer.ValueParameter.Depth = 0;
381      selectionPressureAnalyzer.ValuesParameter.ActualName = "Selection Pressure History";
382      if (Problem != null) {
383        qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
384        qualityAnalyzer.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
385        qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
386      }
387    }
388    private void ParameterizeComparisonFactorModifiers() {
389      foreach (IDiscreteDoubleValueModifier modifier in ComparisonFactorModifierParameter.ValidValues) {
390        modifier.IndexParameter.ActualName = "Generations";
391        modifier.EndIndexParameter.ActualName = MaximumGenerationsParameter.Name;
392        modifier.EndValueParameter.ActualName = ComparisonFactorUpperBoundParameter.Name;
393        modifier.StartIndexParameter.Value = new IntValue(0);
394        modifier.StartValueParameter.ActualName = ComparisonFactorLowerBoundParameter.Name;
395        modifier.ValueParameter.ActualName = "ComparisonFactor";
396      }
397    }
398    private void ParameterizeIterationBasedOperators() {
399      if (Problem != null) {
400        foreach (IIterationBasedOperator op in Problem.Operators.OfType<IIterationBasedOperator>()) {
401          op.IterationsParameter.ActualName = "Generations";
402          op.MaximumIterationsParameter.ActualName = MaximumGenerationsParameter.Name;
403        }
404      }
405    }
406    private void UpdateCrossovers() {
407      ICrossover oldCrossover = CrossoverParameter.Value;
408      CrossoverParameter.ValidValues.Clear();
409      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
410        CrossoverParameter.ValidValues.Add(crossover);
411      if (oldCrossover != null) {
412        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
413        if (crossover != null) CrossoverParameter.Value = crossover;
414      }
415    }
416    private void UpdateMutators() {
417      IManipulator oldMutator = MutatorParameter.Value;
418      MutatorParameter.ValidValues.Clear();
419      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
420        MutatorParameter.ValidValues.Add(mutator);
421      if (oldMutator != null) {
422        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
423        if (mutator != null) MutatorParameter.Value = mutator;
424      }
425    }
426    private void UpdateAnalyzers() {
427      Analyzer.Operators.Clear();
428      if (Problem != null) {
429        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name)) {
430          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
431            param.Depth = 1;
432          Analyzer.Operators.Add(analyzer);
433        }
434      }
435      Analyzer.Operators.Add(qualityAnalyzer);
436      Analyzer.Operators.Add(selectionPressureAnalyzer);
437    }
438    #endregion
439  }
440}
Note: See TracBrowser for help on using the repository browser.