Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/EMMBaseAlgorithm.cs @ 17002

Last change on this file since 17002 was 17002, checked in by msemenki, 5 years ago

#2988:
Class HelpFuction get new static functions that are used in different Map’s classes and possible in other classes.
Branch was adapted to Hive.
New version of class structure for Maps:

  1. 3 new variants of maps (RankMap, SuccessMap and ZeroMap) are added.
  2. BaseMap class was simplified, some class members were deleted and other were transported to child class, because some of them are not used in all kinds of maps.
  3. Functions between base class and child class were divided in other way.
  4. Mutation operators were adapted to work with new class structure. Now mutation make less work for ModelNodes than previously.
  5. ModelNode and Model symbols were simplified. They should not take into account a map type.
  6. Models frequency analyzers were adapted for new variants of maps.
  7. EMMAlgorithm class was adapted to new maps
File size: 23.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2019 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 HEAL.Attic;
23using HeuristicLab.Algorithms.DataAnalysis;
24using HeuristicLab.Analysis;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
29using HeuristicLab.Optimization;
30using HeuristicLab.Parameters;
31using HeuristicLab.PluginInfrastructure;
32using HeuristicLab.Problems.DataAnalysis;
33using HeuristicLab.Problems.DataAnalysis.Symbolic;
34using HeuristicLab.Random;
35using System;
36using System.Collections.Generic;
37using System.IO;
38using System.Linq;
39using CancellationToken = System.Threading.CancellationToken;
40using ExecutionContext = HeuristicLab.Core.ExecutionContext;
41
42namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
43  [Item("MOEADAlgorithmBase", "Base class for all MOEA/D algorithm variants.")]
44  [StorableType("A56A396B-965A-4ADE-8A2B-AE3A45F9C239")]
45  public abstract class EvolvmentModelsOfModelsAlgorithmBase : FixedDataAnalysisAlgorithm<ISymbolicDataAnalysisSingleObjectiveProblem> {
46    #region data members
47    [Storable]
48    protected IList<IEMMSolution> Solutions;
49    [Storable]
50    protected List<IEMMSolution> Population;
51    [Storable]
52    protected int EvaluatedSolutions;
53    [Storable]
54    protected ExecutionContext executionContext;
55    [Storable]
56    protected IScope globalScope;
57    [Storable]
58    protected ExecutionState previousExecutionState;
59    [Storable]
60    protected IEnumerable<ISymbolicExpressionTree> trees;
61
62    [Storable]
63    protected ExecutionState currentExecutionState;
64    #endregion
65
66    #region parameters
67    private const string SeedParameterName = "Seed";
68    private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
69    private const string PopulationSizeParameterName = "PopulationSize";
70    private const string SelectorParameterName = "Selector";
71    private const string GroupSizeParameterName = "GroupSize";
72    private const string CrossoverProbabilityParameterName = "CrossoverProbability";
73    private const string CrossoverParameterName = "Crossover";
74    private const string MutationProbabilityParameterName = "MutationProbability";
75    private const string MutatorParameterName = "Mutator";
76    private const string MaximumEvaluatedSolutionsParameterName = "MaximumEvaluatedSolutions";
77    private const string RandomParameterName = "Random";
78    private const string AnalyzerParameterName = "Analyzer";
79    private const string InputFileParameterName = "InputFile";
80    private const string ClusterNumbersParameterName = "ClusterNumbers";
81    private const string ClusterNumbersShowParameterName = "ClusterNumbersShow";
82    private const string AlgorithmImplementationTypeParameterName = "AlgorithmImplementationType";
83    private const string MapParameterName = "Map";
84    private const string NegbourTypeParameterName = "NegbourType";
85    private const string NegbourNumberParameterName = "NegbourNumber";
86    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
87      get { return (ValueParameter<MultiAnalyzer>)Parameters[AnalyzerParameterName]; }
88    }
89    public IFixedValueParameter<IntValue> SeedParameter {
90      get { return (IFixedValueParameter<IntValue>)Parameters[SeedParameterName]; }
91    }
92    public IValueParameter<IntValue> ClusterNumbersParameter {
93      get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersParameterName]; }
94    }
95    public IValueParameter<IntValue> ClusterNumbersShowParameter {
96      get { return (IValueParameter<IntValue>)Parameters[ClusterNumbersShowParameterName]; }
97    }
98    public IConstrainedValueParameter<StringValue> AlgorithmImplementationTypeParameter {
99      get { return (IConstrainedValueParameter<StringValue>)Parameters[AlgorithmImplementationTypeParameterName]; }
100    }
101    public IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>> MapParameter {
102      get { return (IConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>)Parameters[MapParameterName]; }
103    }
104    public IFixedValueParameter<StringValue> NegbourTypeParameter {
105      get { return (IFixedValueParameter<StringValue>)Parameters[NegbourTypeParameterName]; }
106    }
107    public IFixedValueParameter<IntValue> NegbourNumberParameter {
108      get { return (IFixedValueParameter<IntValue>)Parameters[NegbourNumberParameterName]; }
109    }
110    public IFixedValueParameter<StringValue> InputFileParameter {
111      get { return (IFixedValueParameter<StringValue>)Parameters[InputFileParameterName]; }
112    }
113    public IFixedValueParameter<BoolValue> SetSeedRandomlyParameter {
114      get { return (IFixedValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; }
115    }
116    private IValueParameter<IntValue> PopulationSizeParameter {
117      get { return (IValueParameter<IntValue>)Parameters[PopulationSizeParameterName]; }
118    }
119    public IValueParameter<PercentValue> CrossoverProbabilityParameter {
120      get { return (IValueParameter<PercentValue>)Parameters[CrossoverProbabilityParameterName]; }
121    }
122    public IValueParameter<IntValue> GroupSizeParameter {
123      get { return (IValueParameter<IntValue>)Parameters[GroupSizeParameterName]; }
124    }
125    public IConstrainedValueParameter<ICrossover> CrossoverParameter {
126      get { return (IConstrainedValueParameter<ICrossover>)Parameters[CrossoverParameterName]; }
127    }
128    public IConstrainedValueParameter<ISelector> SelectorParameter {
129      get { return (IConstrainedValueParameter<ISelector>)Parameters[SelectorParameterName]; }
130    }
131    public IValueParameter<PercentValue> MutationProbabilityParameter {
132      get { return (IValueParameter<PercentValue>)Parameters[MutationProbabilityParameterName]; }
133    }
134    public IConstrainedValueParameter<IManipulator> MutatorParameter {
135      get { return (IConstrainedValueParameter<IManipulator>)Parameters[MutatorParameterName]; }
136    }
137    public IValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
138      get { return (IValueParameter<IntValue>)Parameters[MaximumEvaluatedSolutionsParameterName]; }
139    }
140    public IValueParameter<IRandom> RandomParameter {
141      get { return (IValueParameter<IRandom>)Parameters[RandomParameterName]; }
142    }
143    #endregion
144
145    #region parameter properties
146    public ValueParameter<IntValue> ElitesParameter {
147      get { return (ValueParameter<IntValue>)Parameters["Elites"]; }
148    }
149    public int Seed {
150      get { return SeedParameter.Value.Value; }
151      set { SeedParameter.Value.Value = value; }
152    }
153    public IntValue ClusterNumbers {
154      get { return ClusterNumbersParameter.Value; }
155      set { ClusterNumbersParameter.Value = value; }
156    }
157    public IntValue ClusterNumbersShow {
158      get { return ClusterNumbersShowParameter.Value; }
159      set { ClusterNumbersShowParameter.Value = value; }
160    }
161    public StringValue AlgorithmImplemetationType {
162      get { return AlgorithmImplementationTypeParameter.Value; }
163      set { AlgorithmImplementationTypeParameter.Value.Value = value.Value; }
164    }
165    public EMMMapBase<ISymbolicExpressionTree> Map {
166      get { return MapParameter.Value; }
167      set { MapParameter.Value = value; }
168    }
169    public StringValue NegbourType {
170      get { return NegbourTypeParameter.Value; }
171      set { NegbourTypeParameter.Value.Value = value.Value; }
172    }
173    public IntValue NegbourNumber {
174      get { return NegbourNumberParameter.Value; }
175      set { NegbourNumberParameter.Value.Value = value.Value; }
176    }
177    public StringValue InputFile {
178      get { return InputFileParameter.Value; }
179      set { InputFileParameter.Value.Value = value.Value; }
180    }
181    public bool SetSeedRandomly {
182      get { return SetSeedRandomlyParameter.Value.Value; }
183      set { SetSeedRandomlyParameter.Value.Value = value; }
184    }
185    public IntValue PopulationSize {
186      get { return PopulationSizeParameter.Value; }
187      set { PopulationSizeParameter.Value = value; }
188    }
189    public PercentValue CrossoverProbability {
190      get { return CrossoverProbabilityParameter.Value; }
191      set { CrossoverProbabilityParameter.Value = value; }
192    }
193    public IntValue GroupSize {
194      get { return GroupSizeParameter.Value; }
195      set { GroupSizeParameter.Value = value; }
196    }
197    public ICrossover Crossover {
198      get { return CrossoverParameter.Value; }
199      set { CrossoverParameter.Value = value; }
200    }
201    public ISelector Selector {
202      get { return SelectorParameter.Value; }
203      set { SelectorParameter.Value = value; }
204    }
205    public PercentValue MutationProbability {
206      get { return MutationProbabilityParameter.Value; }
207      set { MutationProbabilityParameter.Value = value; }
208    }
209    public IManipulator Mutator {
210      get { return MutatorParameter.Value; }
211      set { MutatorParameter.Value = value; }
212    }
213    public MultiAnalyzer Analyzer {
214      get { return AnalyzerParameter.Value; }
215      set { AnalyzerParameter.Value = value; }
216    }
217    public IntValue MaximumEvaluatedSolutions {
218      get { return MaximumEvaluatedSolutionsParameter.Value; }
219      set { MaximumEvaluatedSolutionsParameter.Value = value; }
220    }
221    public IntValue Elites {
222      get { return ElitesParameter.Value; }
223    }
224    #endregion
225
226    #region constructors
227    public EvolvmentModelsOfModelsAlgorithmBase() {
228
229      Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
230      Parameters.Add(new FixedValueParameter<StringValue>(InputFileParameterName, "The file with set of models that will be.", new StringValue("input.txt")));
231      Parameters.Add(new ConstrainedValueParameter<StringValue>(AlgorithmImplementationTypeParameterName, "The Type of possible algorith, implemetation, choose one: OnlyMap, Full, Read."));
232      Parameters.Add(new ConstrainedValueParameter<EMMMapBase<ISymbolicExpressionTree>>(MapParameterName, "The type of map crearion algorithm. Use one from: IslandMap, NetworkMap."));
233      Parameters.Add(new FixedValueParameter<IntValue>(NegbourNumberParameterName, "The parametr for FullMap type of map crearion algorithm. Use one from: 10, 20.", new IntValue(10)));
234      Parameters.Add(new FixedValueParameter<StringValue>(NegbourTypeParameterName, "The parametr for FullMap type of map crearion algorithm. Use one from: Percent, Number.", new StringValue("Number")));
235      Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
236      Parameters.Add(new ValueParameter<IntValue>(PopulationSizeParameterName, "The size of the population of Solutions.", new IntValue(100)));
237      Parameters.Add(new ConstrainedValueParameter<ISelector>(SelectorParameterName, "The operator used to sellect parents."));
238      Parameters.Add(new ValueParameter<PercentValue>(CrossoverProbabilityParameterName, "The probability that the crossover operator is applied.", new PercentValue(0.9)));
239      Parameters.Add(new ValueParameter<IntValue>(GroupSizeParameterName, "The GoupSize that the Selector operator is applied.", new IntValue(3)));
240      Parameters.Add(new ConstrainedValueParameter<ICrossover>(CrossoverParameterName, "The operator used to cross Solutions."));
241      Parameters.Add(new ValueParameter<PercentValue>(MutationProbabilityParameterName, "The probability that the mutation operator is applied on a solution.", new PercentValue(0.25)));
242      Parameters.Add(new ConstrainedValueParameter<IManipulator>(MutatorParameterName, "The operator used to mutate Solutions."));
243      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
244      Parameters.Add(new ValueParameter<IntValue>(MaximumEvaluatedSolutionsParameterName, "The maximum number of evaluated Solutions (approximately).", new IntValue(100_000)));
245      Parameters.Add(new ValueParameter<IRandom>(RandomParameterName, new MersenneTwister()));
246      Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite Solutions which are kept in each generation.", new IntValue(1)));
247      Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersParameterName, "The number of clusters for model Map.", new IntValue(10)));
248      Parameters.Add(new ValueParameter<IntValue>(ClusterNumbersShowParameterName, "The number of clusters for model Map.", new IntValue(10)));
249      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
250        SelectorParameter.ValidValues.Add(selector);
251      ISelector proportionalSelector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType().Name.Equals("ProportionalSelector"));
252      if (proportionalSelector != null) SelectorParameter.Value = proportionalSelector;
253      ParameterizeSelectors();
254
255      //begin hack ...
256      InputFile.ValueChanged += InputFile_ValueChanged;
257      InfixExpressionParser parser = new InfixExpressionParser();
258      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse).ToArray();
259      // end hack
260
261      ProblemChanged += EvolvmentModelsOfModelsAlgorithmBase_ProblemChanged;
262      MapParameterUpdate();
263
264    }
265
266    // also hack vvvvvvvvv
267    private void InputFile_ValueChanged(object sender, EventArgs e) {
268      InfixExpressionParser parser = new InfixExpressionParser();
269      trees = File.ReadAllLines(InputFileParameter.Value.Value).Select(parser.Parse);
270    }
271    // remove again ^^^^^^^^^
272
273    private void EvolvmentModelsOfModelsAlgorithmBase_ProblemChanged(object sender, EventArgs e) {
274      if (Problem != null) {
275        Problem.SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeBatchInterpreter();
276        //Problem.SymbolicExpressionTreeGrammar = new EMMGrammar();
277      }
278    }
279    protected void MapParameterUpdate() {
280      int neghboorNumber = 10;
281
282      switch (NegbourType.Value) {
283        case "Percent": neghboorNumber = Convert.ToInt32((Convert.ToDouble(ClusterNumbersParameter.Value.Value)) * (Convert.ToDouble(NegbourNumber.Value)) / 100.0); break;
284        case "Number": neghboorNumber = NegbourNumber.Value; break;
285        default: neghboorNumber = NegbourNumber.Value; break;
286      }
287      var mapTypes = new EMMMapBase<ISymbolicExpressionTree>[]
288      {
289        new EMMIslandMap(),
290        new EMMNetworkMap(neghboorNumber),
291        new EMMDisatanceMap(),
292        new EMMRankMap(),
293        new EMMSucsessMap (),
294        new EMMZeroMap ()
295      };
296      foreach (var t in mapTypes) {
297        MapParameter.ValidValues.Add(t);
298      }
299      var algorithmType = new StringValue[]
300        {
301          new StringValue("Full"),
302          new StringValue("Read"),
303          new StringValue ("OnlyMap")
304        };
305      foreach (var t in algorithmType) {
306        AlgorithmImplementationTypeParameter.ValidValues.Add(t);
307      }
308    }
309
310    protected EvolvmentModelsOfModelsAlgorithmBase(EvolvmentModelsOfModelsAlgorithmBase original, Cloner cloner) : base(original, cloner) {
311      EvaluatedSolutions = original.EvaluatedSolutions;
312      previousExecutionState = original.previousExecutionState;
313
314      if (original.Solutions != null) {
315        Solutions = original.Solutions.Select(cloner.Clone).ToArray();
316      }
317
318      if (original.Population != null) {
319        Population = original.Population.Select(cloner.Clone).ToList();
320      }
321
322      //if (original.offspringPopulation != null) {
323      //  offspringPopulation = original.offspringPopulation.Select(cloner.Clone).ToList();
324      //}
325
326      //if (original.jointPopulation != null) {
327      //  jointPopulation = original.jointPopulation.Select(x => cloner.Clone(x)).ToList();
328      //}
329
330      if (original.executionContext != null) {
331        executionContext = cloner.Clone(original.executionContext);
332      }
333
334      if (original.globalScope != null) {
335        globalScope = cloner.Clone(original.globalScope);
336      }
337
338      // hack
339      trees = original.trees.Select(x => cloner.Clone(x)).ToArray();
340    }
341
342    [StorableConstructor]
343    protected EvolvmentModelsOfModelsAlgorithmBase(StorableConstructorFlag _) : base(_) { }
344    #endregion
345
346
347    public override void Prepare() {
348      base.Prepare();
349    }
350
351    protected override void Initialize(CancellationToken cancellationToken) {
352      base.Initialize(cancellationToken);
353    }
354
355    public override bool SupportsPause => true;
356
357    // implements random number generation from https://en.wikipedia.org/wiki/Dirichlet_distribution#Random_number_generation
358
359    public IList<IEMMSolution> GetResult(IRandom random) {
360      return Population;
361    }
362
363    #region operator wiring and events
364    private void ParameterizeStochasticOperator(IOperator op) {
365      IStochasticOperator stochasticOp = op as IStochasticOperator;
366      if (stochasticOp != null) {
367        stochasticOp.RandomParameter.ActualName = "Random";
368        stochasticOp.RandomParameter.Hidden = true;
369      }
370    }
371    private void ParameterizeSelectors() {
372      foreach (ISelector selector in SelectorParameter.ValidValues) {
373        selector.CopySelected = new BoolValue(true);
374        selector.NumberOfSelectedSubScopesParameter.Value = new IntValue(2 * (PopulationSizeParameter.Value.Value - ElitesParameter.Value.Value));
375        selector.NumberOfSelectedSubScopesParameter.Hidden = true;
376        ParameterizeStochasticOperator(selector);
377      }
378      if (Problem != null) {
379        foreach (ISingleObjectiveSelector selector in SelectorParameter.ValidValues.OfType<ISingleObjectiveSelector>()) {
380          selector.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
381          selector.MaximizationParameter.Hidden = true;
382          selector.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
383          selector.QualityParameter.Hidden = true;
384        }
385      }
386    }
387    protected void ExecuteOperation(ExecutionContext executionContext, CancellationToken cancellationToken, IOperation operation) {
388      Stack<IOperation> executionStack = new Stack<IOperation>();
389      executionStack.Push(operation);
390      while (executionStack.Count > 0) {
391        cancellationToken.ThrowIfCancellationRequested();
392        IOperation next = executionStack.Pop();
393        if (next is OperationCollection) {
394          OperationCollection coll = (OperationCollection)next;
395          for (int i = coll.Count - 1; i >= 0; i--)
396            if (coll[i] != null) executionStack.Push(coll[i]);
397        } else if (next is IAtomicOperation) {
398          IAtomicOperation op = (IAtomicOperation)next;
399          next = op.Operator.Execute((IExecutionContext)op, cancellationToken);
400          if (next != null) executionStack.Push(next);
401        }
402      }
403    }
404
405    private void UpdateAnalyzers() {
406      Analyzer.Operators.Clear();
407      if (Problem != null) {
408        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
409          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
410            param.Depth = 1;
411          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
412        }
413      }
414    }
415
416    private void UpdateCrossovers() {
417      ICrossover oldCrossover = CrossoverParameter.Value;
418      CrossoverParameter.ValidValues.Clear();
419      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
420
421      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
422        CrossoverParameter.ValidValues.Add(crossover);
423
424      if (oldCrossover != null) {
425        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
426        if (crossover != null) CrossoverParameter.Value = crossover;
427        else oldCrossover = null;
428      }
429      if (oldCrossover == null && defaultCrossover != null)
430        CrossoverParameter.Value = defaultCrossover;
431    }
432
433    private void UpdateMutators() {
434      IManipulator oldMutator = MutatorParameter.Value;
435      MutatorParameter.ValidValues.Clear();
436      IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault();
437
438      foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name))
439        MutatorParameter.ValidValues.Add(mutator);
440
441      if (oldMutator != null) {
442        IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType());
443        if (mutator != null) MutatorParameter.Value = mutator;
444        else oldMutator = null;
445      }
446
447      if (oldMutator == null && defaultMutator != null)
448        MutatorParameter.Value = defaultMutator;
449    }
450    private void UpdateSelectors() {
451      ISelector oldSelector = SelectorParameter.Value;
452      SelectorParameter.ValidValues.Clear();
453      ISelector defaultSelector = Problem.Operators.OfType<ISelector>().FirstOrDefault();
454
455      foreach (ISelector selector in Problem.Operators.OfType<ISelector>().OrderBy(x => x.Name))
456        SelectorParameter.ValidValues.Add(selector);
457
458      if (oldSelector != null) {
459        ISelector selector = SelectorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSelector.GetType());
460        if (selector != null) SelectorParameter.Value = selector;
461        else oldSelector = null;
462      }
463
464      if (oldSelector == null && defaultSelector != null)
465        SelectorParameter.Value = defaultSelector;
466    }
467    protected override void OnProblemChanged() {
468      UpdateCrossovers();
469      UpdateMutators();
470      UpdateAnalyzers();
471      base.OnProblemChanged();
472    }
473
474    protected override void OnExecutionStateChanged() {
475      previousExecutionState = currentExecutionState;
476      currentExecutionState = ExecutionState;
477      base.OnExecutionStateChanged();
478    }
479
480    protected override void OnStopped() {
481      if (Solutions != null) {
482        Solutions.Clear();
483      }
484      if (Population != null) {
485        Population.Clear();
486      }
487      //if (offspringPopulation != null) {
488      //  offspringPopulation.Clear();
489      //}
490      //if (jointPopulation != null) {
491      //  jointPopulation.Clear();
492      //}
493      executionContext.Scope.SubScopes.Clear();
494      base.OnStopped();
495    }
496    #endregion
497  }
498}
Note: See TracBrowser for help on using the repository browser.