Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithm.cs @ 3623

Last change on this file since 3623 was 3616, checked in by swagner, 15 years ago

Worked on refactoring of algorithm analysis and tracing (#999)

  • adapted GA and TSP
  • removed stuff related to visualizers
File size: 22.9 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.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Operators;
29using HeuristicLab.Optimization;
30using HeuristicLab.Optimization.Operators;
31using HeuristicLab.Parameters;
32using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
33using HeuristicLab.PluginInfrastructure;
34using HeuristicLab.Random;
35using HeuristicLab.Selection;
36
37namespace HeuristicLab.Algorithms.GeneticAlgorithm {
38  /// <summary>
39  /// An island genetic algorithm.
40  /// </summary>
41  [Item("Island Genetic Algorithm", "An island genetic algorithm.")]
42  [Creatable("Algorithms")]
43  [StorableClass]
44  public sealed class IslandGeneticAlgorithm : EngineAlgorithm {
45
46    #region Problem Properties
47    public override Type ProblemType {
48      get { return typeof(ISingleObjectiveProblem); }
49    }
50    public new ISingleObjectiveProblem Problem {
51      get { return (ISingleObjectiveProblem)base.Problem; }
52      set { base.Problem = value; }
53    }
54    #endregion
55
56    #region Parameter Properties
57    private ValueParameter<IntValue> SeedParameter {
58      get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
59    }
60    private ValueParameter<BoolValue> SetSeedRandomlyParameter {
61      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
62    }
63    private ValueParameter<IntValue> NumberOfIslandsParameter {
64      get { return (ValueParameter<IntValue>)Parameters["NumberOfIslands"]; }
65    }
66    private ValueParameter<IntValue> MigrationIntervalParameter {
67      get { return (ValueParameter<IntValue>)Parameters["MigrationInterval"]; }
68    }
69    private ValueParameter<PercentValue> MigrationRateParameter {
70      get { return (ValueParameter<PercentValue>)Parameters["MigrationRate"]; }
71    }
72    private ConstrainedValueParameter<IMigrator> MigratorParameter {
73      get { return (ConstrainedValueParameter<IMigrator>)Parameters["Migrator"]; }
74    }
75    private ConstrainedValueParameter<ISelector> EmigrantsSelectorParameter {
76      get { return (ConstrainedValueParameter<ISelector>)Parameters["EmigrantsSelector"]; }
77    }
78    private ConstrainedValueParameter<IReplacer> ImmigrationReplacerParameter {
79      get { return (ConstrainedValueParameter<IReplacer>)Parameters["ImmigrationReplacer"]; }
80    }
81    private ValueParameter<IntValue> PopulationSizeParameter {
82      get { return (ValueParameter<IntValue>)Parameters["PopulationSize"]; }
83    }
84    private ValueParameter<IntValue> MaximumGenerationsParameter {
85      get { return (ValueParameter<IntValue>)Parameters["MaximumGenerations"]; }
86    }
87    private ConstrainedValueParameter<ISelector> SelectorParameter {
88      get { return (ConstrainedValueParameter<ISelector>)Parameters["Selector"]; }
89    }
90    private ConstrainedValueParameter<ICrossover> CrossoverParameter {
91      get { return (ConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
92    }
93    private ValueParameter<PercentValue> MutationProbabilityParameter {
94      get { return (ValueParameter<PercentValue>)Parameters["MutationProbability"]; }
95    }
96    private OptionalConstrainedValueParameter<IManipulator> MutatorParameter {
97      get { return (OptionalConstrainedValueParameter<IManipulator>)Parameters["Mutator"]; }
98    }
99    private ValueParameter<IntValue> ElitesParameter {
100      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
101    }
102    private ValueParameter<BoolValue> ParallelParameter {
103      get { return (ValueParameter<BoolValue>)Parameters["Parallel"]; }
104    }
105    #endregion
106
107    #region Properties
108    public IntValue Seed {
109      get { return SeedParameter.Value; }
110      set { SeedParameter.Value = value; }
111    }
112    public BoolValue SetSeedRandomly {
113      get { return SetSeedRandomlyParameter.Value; }
114      set { SetSeedRandomlyParameter.Value = value; }
115    }
116    public IntValue NumberOfIslands {
117      get { return NumberOfIslandsParameter.Value; }
118      set { NumberOfIslandsParameter.Value = value; }
119    }
120    public IntValue MigrationInterval {
121      get { return MigrationIntervalParameter.Value; }
122      set { MigrationIntervalParameter.Value = value; }
123    }
124    public PercentValue MigrationRate {
125      get { return MigrationRateParameter.Value; }
126      set { MigrationRateParameter.Value = value; }
127    }
128    public IMigrator Migrator {
129      get { return MigratorParameter.Value; }
130      set { MigratorParameter.Value = value; }
131    }
132    public ISelector EmigrantsSelector {
133      get { return EmigrantsSelectorParameter.Value; }
134      set { EmigrantsSelectorParameter.Value = value; }
135    }
136    public IReplacer ImmigrationReplacer {
137      get { return ImmigrationReplacerParameter.Value; }
138      set { ImmigrationReplacerParameter.Value = value; }
139    }
140    public IntValue PopulationSize {
141      get { return PopulationSizeParameter.Value; }
142      set { PopulationSizeParameter.Value = value; }
143    }
144    public IntValue MaximumGenerations {
145      get { return MaximumGenerationsParameter.Value; }
146      set { MaximumGenerationsParameter.Value = value; }
147    }
148    public ISelector Selector {
149      get { return SelectorParameter.Value; }
150      set { SelectorParameter.Value = value; }
151    }
152    public ICrossover Crossover {
153      get { return CrossoverParameter.Value; }
154      set { CrossoverParameter.Value = value; }
155    }
156    public PercentValue MutationProbability {
157      get { return MutationProbabilityParameter.Value; }
158      set { MutationProbabilityParameter.Value = value; }
159    }
160    public IManipulator Mutator {
161      get { return MutatorParameter.Value; }
162      set { MutatorParameter.Value = value; }
163    }
164    public IntValue Elites {
165      get { return ElitesParameter.Value; }
166      set { ElitesParameter.Value = value; }
167    }
168    public BoolValue Parallel {
169      get { return ParallelParameter.Value; }
170      set { ParallelParameter.Value = value; }
171    }
172    private List<ISelector> selectors;
173    private IEnumerable<ISelector> Selectors {
174      get { return selectors; }
175    }
176    private List<ISelector> emigrantsSelectors;
177    private List<IReplacer> immigrationReplacers;
178    private List<IMigrator> migrators;
179    private RandomCreator RandomCreator {
180      get { return (RandomCreator)OperatorGraph.InitialOperator; }
181    }
182    private UniformSubScopesProcessor IslandProcessor {
183      get { return ((RandomCreator.Successor as SubScopesCreator).Successor as UniformSubScopesProcessor); }
184    }
185    private SolutionsCreator SolutionsCreator {
186      get { return (SolutionsCreator)IslandProcessor.Operator; }
187    }
188    private IslandGeneticAlgorithmMainLoop MainLoop {
189      get { return (IslandGeneticAlgorithmMainLoop)IslandProcessor.Successor; }
190    }
191    #endregion
192
193    [StorableConstructor]
194    private IslandGeneticAlgorithm(bool deserializing) : base(deserializing) { }
195    public IslandGeneticAlgorithm()
196      : base() {
197      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
198      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
199      Parameters.Add(new ValueParameter<IntValue>("NumberOfIslands", "The number of islands.", new IntValue(5)));
200      Parameters.Add(new ValueParameter<IntValue>("MigrationInterval", "The number of generations that should pass between migration phases.", new IntValue(20)));
201      Parameters.Add(new ValueParameter<PercentValue>("MigrationRate", "The proportion of individuals that should migrate between the islands.", new PercentValue(0.15)));
202      Parameters.Add(new ConstrainedValueParameter<IMigrator>("Migrator", "The migration strategy."));
203      Parameters.Add(new ConstrainedValueParameter<ISelector>("EmigrantsSelector", "Selects the individuals that will be migrated."));
204      Parameters.Add(new ConstrainedValueParameter<IReplacer>("ImmigrationReplacer", "Selects the population from the unification of the original population and the immigrants."));
205      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(100)));
206      Parameters.Add(new ValueParameter<IntValue>("MaximumGenerations", "The maximum number of generations that should be processed.", new IntValue(1000)));
207      Parameters.Add(new ConstrainedValueParameter<ISelector>("Selector", "The operator used to select solutions for reproduction."));
208      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
209      Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05)));
210      Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));
211      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1)));
212      Parameters.Add(new ValueParameter<BoolValue>("Parallel", "True if the islands should be run in parallel (also requires a parallel engine)", new BoolValue(false)));
213
214      RandomCreator randomCreator = new RandomCreator();
215      SubScopesCreator populationCreator = new SubScopesCreator();
216      UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor();
217      SolutionsCreator solutionsCreator = new SolutionsCreator();
218      IslandGeneticAlgorithmMainLoop mainLoop = new IslandGeneticAlgorithmMainLoop();
219      OperatorGraph.InitialOperator = randomCreator;
220
221      randomCreator.RandomParameter.ActualName = "Random";
222      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
223      randomCreator.SeedParameter.Value = null;
224      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
225      randomCreator.SetSeedRandomlyParameter.Value = null;
226      randomCreator.Successor = populationCreator;
227
228      populationCreator.NumberOfSubScopesParameter.ActualName = NumberOfIslandsParameter.Name;
229      populationCreator.Successor = ussp1;
230
231      ussp1.Parallel = null;
232      ussp1.ParallelParameter.ActualName = ParallelParameter.Name;
233      ussp1.Operator = solutionsCreator;
234      ussp1.Successor = mainLoop;
235
236      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
237      solutionsCreator.Successor = null;
238
239      mainLoop.EmigrantsSelectorParameter.ActualName = EmigrantsSelectorParameter.Name;
240      mainLoop.ImmigrationReplacerParameter.ActualName = ImmigrationReplacerParameter.Name;
241      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
242      mainLoop.MigrationIntervalParameter.ActualName = MigrationIntervalParameter.Name;
243      mainLoop.MigrationRateParameter.ActualName = MigrationRateParameter.Name;
244      mainLoop.MigratorParameter.ActualName = MigratorParameter.Name;
245      mainLoop.NumberOfIslandsParameter.ActualName = NumberOfIslandsParameter.Name;
246      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
247      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
248      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
249      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
250      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
251      mainLoop.RandomParameter.ActualName = randomCreator.RandomParameter.ActualName;
252      mainLoop.ResultsParameter.ActualName = "Results";
253
254      mainLoop.Successor = null;
255
256      Initialize();
257    }
258
259    public override IDeepCloneable Clone(Cloner cloner) {
260      IslandGeneticAlgorithm clone = (IslandGeneticAlgorithm)base.Clone(cloner);
261      clone.Initialize();
262      return clone;
263    }
264
265    public override void Prepare() {
266      if (Problem != null) base.Prepare();
267    }
268
269    #region Events
270    protected override void OnProblemChanged() {
271      ParameterizeStochasticOperator(Problem.SolutionCreator);
272      ParameterizeStochasticOperator(Problem.Evaluator);
273      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
274      ParameterizeSolutionsCreator();
275      ParameterizeMainLoop();
276      ParameterizeSelectors();
277      UpdateCrossovers();
278      UpdateMutators();
279      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
280      base.OnProblemChanged();
281    }
282
283    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
284      ParameterizeStochasticOperator(Problem.SolutionCreator);
285      ParameterizeSolutionsCreator();
286      base.Problem_SolutionCreatorChanged(sender, e);
287    }
288    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
289      ParameterizeStochasticOperator(Problem.Evaluator);
290      ParameterizeSolutionsCreator();
291      ParameterizeMainLoop();
292      ParameterizeSelectors();
293      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
294      base.Problem_EvaluatorChanged(sender, e);
295    }
296    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
297      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
298      UpdateCrossovers();
299      UpdateMutators();
300      base.Problem_OperatorsChanged(sender, e);
301    }
302    private void ElitesParameter_ValueChanged(object sender, EventArgs e) {
303      Elites.ValueChanged += new EventHandler(Elites_ValueChanged);
304      ParameterizeSelectors();
305    }
306    private void Elites_ValueChanged(object sender, EventArgs e) {
307      ParameterizeSelectors();
308    }
309    private void PopulationSizeParameter_ValueChanged(object sender, EventArgs e) {
310      NumberOfIslands.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
311      ParameterizeSelectors();
312    }
313    private void PopulationSize_ValueChanged(object sender, EventArgs e) {
314      ParameterizeSelectors();
315    }
316    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
317      ParameterizeMainLoop();
318      ParameterizeSelectors();
319    }
320    private void MigrationRateParameter_ValueChanged(object sender, EventArgs e) {
321      MigrationRate.ValueChanged += new EventHandler(MigrationRate_ValueChanged);
322      ParameterizeSelectors();
323    }
324    private void MigrationRate_ValueChanged(object sender, EventArgs e) {
325      ParameterizeSelectors();
326    }
327    #endregion
328
329    #region Helpers
330    [StorableHook(HookType.AfterDeserialization)]
331    private void Initialize() {
332      InitializeSelectors();
333      UpdateSelectors();
334      InitializeMigrators();
335      UpdateMigrators();
336      PopulationSizeParameter.ValueChanged += new EventHandler(PopulationSizeParameter_ValueChanged);
337      PopulationSize.ValueChanged += new EventHandler(PopulationSize_ValueChanged);
338      MigrationRateParameter.ValueChanged += new EventHandler(MigrationRateParameter_ValueChanged);
339      MigrationRate.ValueChanged += new EventHandler(MigrationRate_ValueChanged);
340      ElitesParameter.ValueChanged += new EventHandler(ElitesParameter_ValueChanged);
341      Elites.ValueChanged += new EventHandler(Elites_ValueChanged);
342      if (Problem != null) {
343        UpdateCrossovers();
344        UpdateMutators();
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 ParameterizeMainLoop() {
353      MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
354      MainLoop.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
355      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
356      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
357    }
358    private void ParameterizeStochasticOperator(IOperator op) {
359      if (op is IStochasticOperator)
360        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
361    }
362    private void InitializeSelectors() {
363      selectors = new List<ISelector>();
364      selectors.AddRange(ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name));
365      emigrantsSelectors = new List<ISelector>();
366      emigrantsSelectors.AddRange(ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name));
367      immigrationReplacers = new List<IReplacer>();
368      immigrationReplacers.AddRange(ApplicationManager.Manager.GetInstances<IReplacer>().OrderBy(x => x.Name));
369      ParameterizeSelectors();
370    }
371    private void InitializeMigrators() {
372      migrators = new List<IMigrator>();
373      migrators.AddRange(ApplicationManager.Manager.GetInstances<IMigrator>().OrderBy(x => x.Name));
374      UpdateMigrators();
375    }
376    private void ParameterizeSelectors() {
377      foreach (ISelector selector in Selectors) {
378        selector.CopySelected = new BoolValue(true);
379        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSize.Value - Elites.Value));
380        ParameterizeStochasticOperator(selector);
381      }
382      foreach (ISelector selector in emigrantsSelectors) {
383        selector.CopySelected = new BoolValue(true);
384        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue((int)Math.Ceiling(PopulationSize.Value * MigrationRate.Value));
385        ParameterizeStochasticOperator(selector);
386      }
387      foreach (IReplacer replacer in immigrationReplacers) {
388        ParameterizeStochasticOperator(replacer);
389      }
390      if (Problem != null) {
391        foreach (ISingleObjectiveSelector selector in Selectors.OfType<ISingleObjectiveSelector>()) {
392          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
393          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
394        }
395        foreach (ISingleObjectiveSelector selector in emigrantsSelectors.OfType<ISingleObjectiveSelector>()) {
396          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
397          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
398        }
399        foreach (ISingleObjectiveReplacer selector in immigrationReplacers.OfType<ISingleObjectiveReplacer>()) {
400          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
401          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
402        }
403      }
404    }
405    private void UpdateSelectors() {
406      ISelector oldSelector = SelectorParameter.Value;
407      SelectorParameter.ValidValues.Clear();
408      foreach (ISelector selector in Selectors.OrderBy(x => x.Name))
409        SelectorParameter.ValidValues.Add(selector);
410
411      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
412      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
413
414      if (oldSelector != null) {
415        ISelector selector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
416        if (selector != null) SelectorParameter.Value = selector;
417      }
418
419      oldSelector = EmigrantsSelector;
420      EmigrantsSelectorParameter.ValidValues.Clear();
421      foreach (ISelector selector in emigrantsSelectors)
422        EmigrantsSelectorParameter.ValidValues.Add(selector);
423      if (oldSelector != null) {
424        ISelector selector = EmigrantsSelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
425        if (selector != null) EmigrantsSelectorParameter.Value = selector;
426      }
427
428      IReplacer oldReplacer = ImmigrationReplacerParameter.Value;
429      ImmigrationReplacerParameter.ValidValues.Clear();
430      foreach (IReplacer replacer in immigrationReplacers)
431        ImmigrationReplacerParameter.ValidValues.Add(replacer);
432      if (oldReplacer != null) {
433        IReplacer replacer = ImmigrationReplacerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
434        if (replacer != null) ImmigrationReplacerParameter.Value = replacer;
435      }
436    }
437    private void UpdateMigrators() {
438      IMigrator oldMigrator = Migrator;
439      MigratorParameter.ValidValues.Clear();
440      foreach (IMigrator migrator in migrators)
441        MigratorParameter.ValidValues.Add(migrator);
442      if (oldMigrator != null) {
443        IMigrator migrator = MigratorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMigrator.GetType());
444        if (migrator != null) MigratorParameter.Value = migrator;
445      } else if (MigratorParameter.ValidValues.Count > 0) MigratorParameter.Value = MigratorParameter.ValidValues.First();
446    }
447    private void UpdateCrossovers() {
448      ICrossover oldCrossover = CrossoverParameter.Value;
449      CrossoverParameter.ValidValues.Clear();
450      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
451        CrossoverParameter.ValidValues.Add(crossover);
452      if (oldCrossover != null) {
453        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
454        if (crossover != null) CrossoverParameter.Value = crossover;
455      }
456    }
457    private void UpdateMutators() {
458      IManipulator oldMutator = MutatorParameter.Value;
459      MutatorParameter.ValidValues.Clear();
460      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
461        MutatorParameter.ValidValues.Add(mutator);
462      if (oldMutator != null) {
463        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
464        if (mutator != null) MutatorParameter.Value = mutator;
465      }
466    }
467    #endregion
468  }
469}
Note: See TracBrowser for help on using the repository browser.