Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs @ 10278

Last change on this file since 10278 was 10278, checked in by bburlacu, 11 years ago

#1772: Implemented generic genealogy analyzer (should work with any encoding provided the proper wiring is performed in the problem class), and before/after operators for creation, mutation and crossover.

File size: 21.8 KB
RevLine 
[5577]1#region License Information
2/* HeuristicLab
[9456]3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[5577]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.Drawing;
[5618]24using System.Linq;
[5577]25using HeuristicLab.Common;
26using HeuristicLab.Common.Resources;
27using HeuristicLab.Core;
28using HeuristicLab.Data;
[5618]29using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
[10278]30using HeuristicLab.EvolutionTracking;
[5577]31using HeuristicLab.Optimization;
32using HeuristicLab.Parameters;
33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
[5618]34using HeuristicLab.PluginInfrastructure;
[7823]35using HeuristicLab.Problems.Instances;
[5577]36
[10278]37using TGraph = HeuristicLab.EvolutionTracking.IGenealogyGraph<HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>,
38                                                              HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>;
39using TVertex = HeuristicLab.EvolutionTracking.GenealogyGraphNode<HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ISymbolicExpressionTree>;
40
[5577]41namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
42  [StorableClass]
[7823]43  public abstract class SymbolicDataAnalysisProblem<T, U, V> : HeuristicOptimizationProblem<U, V>, IDataAnalysisProblem<T>, ISymbolicDataAnalysisProblem, IStorableContent,
44    IProblemInstanceConsumer<T>, IProblemInstanceExporter<T>
[6978]45    where T : class, IDataAnalysisProblemData
[5580]46    where U : class, ISymbolicDataAnalysisEvaluator<T>
47    where V : class, ISymbolicDataAnalysisSolutionCreator {
[5770]48
[5577]49    #region parameter names & descriptions
50    private const string ProblemDataParameterName = "ProblemData";
51    private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar";
52    private const string SymbolicExpressionTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
53    private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";
54    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
55    private const string MaximumFunctionDefinitionsParameterName = "MaximumFunctionDefinitions";
56    private const string MaximumFunctionArgumentsParameterName = "MaximumFunctionArguments";
[5759]57    private const string RelativeNumberOfEvaluatedSamplesParameterName = "RelativeNumberOfEvaluatedSamples";
[5733]58    private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition";
[5775]59    private const string ValidationPartitionParameterName = "ValidationPartition";
[8664]60    private const string ApplyLinearScalingParameterName = "ApplyLinearScaling";
[5577]61
62    private const string ProblemDataParameterDescription = "";
63    private const string SymbolicExpressionTreeGrammarParameterDescription = "The grammar that should be used for symbolic expression tree.";
64    private const string SymoblicExpressionTreeInterpreterParameterDescription = "The interpreter that should be used to evaluate the symbolic expression tree.";
65    private const string MaximumSymbolicExpressionTreeDepthParameterDescription = "Maximal depth of the symbolic expression. The minimum depth needed for the algorithm is 3 because two levels are reserved for the ProgramRoot and the Start symbol.";
66    private const string MaximumSymbolicExpressionTreeLengthParameterDescription = "Maximal length of the symbolic expression.";
67    private const string MaximumFunctionDefinitionsParameterDescription = "Maximal number of automatically defined functions";
68    private const string MaximumFunctionArgumentsParameterDescription = "Maximal number of arguments of automatically defined functions.";
[5759]69    private const string RelativeNumberOfEvaluatedSamplesParameterDescription = "The relative number of samples of the dataset partition, which should be randomly chosen for evaluation.";
70    private const string FitnessCalculationPartitionParameterDescription = "The partition of the problem data training partition, that should be used to calculate the fitness of an individual.";
[5857]71    private const string ValidationPartitionParameterDescription = "The partition of the problem data training partition, that should be used to select the best model from (optional).";
[8664]72    private const string ApplyLinearScalingParameterDescription = "Flag that indicates if the individual should be linearly scaled before evaluating.";
[5577]73    #endregion
74
75    #region parameter properties
76    IParameter IDataAnalysisProblem.ProblemDataParameter {
77      get { return ProblemDataParameter; }
78    }
79    public IValueParameter<T> ProblemDataParameter {
80      get { return (IValueParameter<T>)Parameters[ProblemDataParameterName]; }
81    }
82    public IValueParameter<ISymbolicDataAnalysisGrammar> SymbolicExpressionTreeGrammarParameter {
83      get { return (IValueParameter<ISymbolicDataAnalysisGrammar>)Parameters[SymbolicExpressionTreeGrammarParameterName]; }
84    }
[5624]85    public IValueParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
86      get { return (IValueParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
[5577]87    }
[5618]88    public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {
89      get { return (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }
[5577]90    }
[5618]91    public IFixedValueParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
92      get { return (IFixedValueParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
[5577]93    }
[5618]94    public IFixedValueParameter<IntValue> MaximumFunctionDefinitionsParameter {
95      get { return (IFixedValueParameter<IntValue>)Parameters[MaximumFunctionDefinitionsParameterName]; }
[5577]96    }
[5618]97    public IFixedValueParameter<IntValue> MaximumFunctionArgumentsParameter {
98      get { return (IFixedValueParameter<IntValue>)Parameters[MaximumFunctionArgumentsParameterName]; }
[5577]99    }
[5759]100    public IFixedValueParameter<PercentValue> RelativeNumberOfEvaluatedSamplesParameter {
101      get { return (IFixedValueParameter<PercentValue>)Parameters[RelativeNumberOfEvaluatedSamplesParameterName]; }
102    }
103    public IFixedValueParameter<IntRange> FitnessCalculationPartitionParameter {
104      get { return (IFixedValueParameter<IntRange>)Parameters[FitnessCalculationPartitionParameterName]; }
105    }
[5883]106    public IFixedValueParameter<IntRange> ValidationPartitionParameter {
[5775]107      get { return (IFixedValueParameter<IntRange>)Parameters[ValidationPartitionParameterName]; }
[5759]108    }
[8664]109    public IFixedValueParameter<BoolValue> ApplyLinearScalingParameter {
110      get { return (IFixedValueParameter<BoolValue>)Parameters[ApplyLinearScalingParameterName]; }
111    }
[5577]112    #endregion
113
114    #region properties
115    public string Filename { get; set; }
[7201]116    public static new Image StaticItemImage { get { return VSImageLibrary.Type; } }
[5577]117
118    IDataAnalysisProblemData IDataAnalysisProblem.ProblemData {
119      get { return ProblemData; }
120    }
121    public T ProblemData {
122      get { return ProblemDataParameter.Value; }
[5618]123      set { ProblemDataParameter.Value = value; }
[5577]124    }
125
126    public ISymbolicDataAnalysisGrammar SymbolicExpressionTreeGrammar {
127      get { return SymbolicExpressionTreeGrammarParameter.Value; }
[5618]128      set { SymbolicExpressionTreeGrammarParameter.Value = value; }
[5577]129    }
[5624]130    public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicExpressionTreeInterpreter {
[5577]131      get { return SymbolicExpressionTreeInterpreterParameter.Value; }
[5618]132      set { SymbolicExpressionTreeInterpreterParameter.Value = value; }
[5577]133    }
134
135    public IntValue MaximumSymbolicExpressionTreeDepth {
136      get { return MaximumSymbolicExpressionTreeDepthParameter.Value; }
137    }
138    public IntValue MaximumSymbolicExpressionTreeLength {
139      get { return MaximumSymbolicExpressionTreeLengthParameter.Value; }
140    }
141    public IntValue MaximumFunctionDefinitions {
142      get { return MaximumFunctionDefinitionsParameter.Value; }
143    }
144    public IntValue MaximumFunctionArguments {
[5618]145      get { return MaximumFunctionArgumentsParameter.Value; }
[5577]146    }
[5759]147    public PercentValue RelativeNumberOfEvaluatedSamples {
148      get { return RelativeNumberOfEvaluatedSamplesParameter.Value; }
149    }
150
151    public IntRange FitnessCalculationPartition {
152      get { return FitnessCalculationPartitionParameter.Value; }
153    }
[5775]154    public IntRange ValidationPartition {
[5883]155      get { return ValidationPartitionParameter.Value; }
[5759]156    }
[8664]157    public BoolValue ApplyLinearScaling {
158      get { return ApplyLinearScalingParameter.Value; }
159    }
[5577]160    #endregion
161
162    [StorableConstructor]
163    protected SymbolicDataAnalysisProblem(bool deserializing) : base(deserializing) { }
[5618]164    [StorableHook(HookType.AfterDeserialization)]
165    private void AfterDeserialization() {
[8664]166      if (!Parameters.ContainsKey(ApplyLinearScalingParameterName)) {
167        Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, ApplyLinearScalingParameterDescription, new BoolValue(false)));
168        ApplyLinearScalingParameter.Hidden = true;
[8666]169
170        //it is assumed that for all symbolic regression algorithms linear scaling was set to true
171        //there is no possibility to determine the previous value of the parameter as it was stored in the evaluator
172        if (GetType().Name.Contains("SymbolicRegression"))
173          ApplyLinearScaling.Value = true;
[8664]174      }
175
[5618]176      RegisterEventHandlers();
177    }
178    protected SymbolicDataAnalysisProblem(SymbolicDataAnalysisProblem<T, U, V> original, Cloner cloner)
179      : base(original, cloner) {
180      RegisterEventHandlers();
181    }
[5577]182
[5618]183    protected SymbolicDataAnalysisProblem(T problemData, U evaluator, V solutionCreator)
184      : base(evaluator, solutionCreator) {
185      Parameters.Add(new ValueParameter<T>(ProblemDataParameterName, ProblemDataParameterDescription, problemData));
[5577]186      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisGrammar>(SymbolicExpressionTreeGrammarParameterName, SymbolicExpressionTreeGrammarParameterDescription));
[5624]187      Parameters.Add(new ValueParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, SymoblicExpressionTreeInterpreterParameterDescription));
[5847]188      Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, MaximumSymbolicExpressionTreeDepthParameterDescription));
189      Parameters.Add(new FixedValueParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, MaximumSymbolicExpressionTreeLengthParameterDescription));
190      Parameters.Add(new FixedValueParameter<IntValue>(MaximumFunctionDefinitionsParameterName, MaximumFunctionDefinitionsParameterDescription));
191      Parameters.Add(new FixedValueParameter<IntValue>(MaximumFunctionArgumentsParameterName, MaximumFunctionArgumentsParameterDescription));
192      Parameters.Add(new FixedValueParameter<IntRange>(FitnessCalculationPartitionParameterName, FitnessCalculationPartitionParameterDescription));
193      Parameters.Add(new FixedValueParameter<IntRange>(ValidationPartitionParameterName, ValidationPartitionParameterDescription));
[5759]194      Parameters.Add(new FixedValueParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, RelativeNumberOfEvaluatedSamplesParameterDescription, new PercentValue(1)));
[8664]195      Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, ApplyLinearScalingParameterDescription, new BoolValue(false)));
[5618]196
[5854]197      SymbolicExpressionTreeInterpreterParameter.Hidden = true;
198      MaximumFunctionArgumentsParameter.Hidden = true;
199      MaximumFunctionDefinitionsParameter.Hidden = true;
[8664]200      ApplyLinearScalingParameter.Hidden = true;
[5854]201
[5618]202      SymbolicExpressionTreeGrammar = new TypeCoherentExpressionGrammar();
[9830]203      SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
[5618]204
[5770]205      FitnessCalculationPartition.Start = ProblemData.TrainingPartition.Start;
206      FitnessCalculationPartition.End = ProblemData.TrainingPartition.End;
207
[5722]208      InitializeOperators();
209
[5618]210      UpdateGrammar();
211      RegisterEventHandlers();
[5577]212    }
213
[5685]214    protected virtual void UpdateGrammar() {
[5726]215      SymbolicExpressionTreeGrammar.MaximumFunctionArguments = MaximumFunctionArguments.Value;
216      SymbolicExpressionTreeGrammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value;
[5685]217      foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Variable>()) {
[8936]218        if (!varSymbol.Fixed) {
219          varSymbol.AllVariableNames = ProblemData.InputVariables.Select(x => x.Value);
220          varSymbol.VariableNames = ProblemData.AllowedInputVariables;
221        }
[5685]222      }
223      foreach (var varSymbol in SymbolicExpressionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableCondition>()) {
[8936]224        if (!varSymbol.Fixed) {
225          varSymbol.AllVariableNames = ProblemData.InputVariables.Select(x => x.Value);
226          varSymbol.VariableNames = ProblemData.AllowedInputVariables;
227        }
[5685]228      }
229    }
230
[5618]231    private void InitializeOperators() {
232      Operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>());
[7506]233      Operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicDataAnalysisExpressionCrossover<T>>());
[5618]234      Operators.Add(new SymbolicExpressionSymbolFrequencyAnalyzer());
[5685]235      Operators.Add(new SymbolicDataAnalysisVariableFrequencyAnalyzer());
[5618]236      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
[6978]237      Operators.Add(new SymbolicExpressionTreeLengthAnalyzer());
[10278]238      Operators.Add(new GenealogyAnalyzer<TGraph, TVertex, ISymbolicExpressionTree>());
[5618]239      ParameterizeOperators();
240    }
241
[5685]242    #region events
[5618]243    private void RegisterEventHandlers() {
244      ProblemDataParameter.ValueChanged += new EventHandler(ProblemDataParameter_ValueChanged);
245      ProblemDataParameter.Value.Changed += (object sender, EventArgs e) => OnProblemDataChanged();
246
[5841]247      SymbolicExpressionTreeGrammarParameter.ValueChanged += new EventHandler(SymbolicExpressionTreeGrammarParameter_ValueChanged);
248
[5618]249      MaximumFunctionArguments.ValueChanged += new EventHandler(ArchitectureParameterValue_ValueChanged);
250      MaximumFunctionDefinitions.ValueChanged += new EventHandler(ArchitectureParameterValue_ValueChanged);
251      MaximumSymbolicExpressionTreeDepth.ValueChanged += new EventHandler(MaximumSymbolicExpressionTreeDepth_ValueChanged);
252    }
253
[5685]254    private void ProblemDataParameter_ValueChanged(object sender, EventArgs e) {
[5887]255      ValidationPartition.Start = 0;
256      ValidationPartition.End = 0;
[5685]257      ProblemDataParameter.Value.Changed += (object s, EventArgs args) => OnProblemDataChanged();
258      OnProblemDataChanged();
259    }
260
[5841]261    private void SymbolicExpressionTreeGrammarParameter_ValueChanged(object sender, EventArgs e) {
262      UpdateGrammar();
263    }
264
[5618]265    private void ArchitectureParameterValue_ValueChanged(object sender, EventArgs e) {
266      UpdateGrammar();
267    }
268
269    private void MaximumSymbolicExpressionTreeDepth_ValueChanged(object sender, EventArgs e) {
270      if (MaximumSymbolicExpressionTreeDepth != null && MaximumSymbolicExpressionTreeDepth.Value < 3)
271        MaximumSymbolicExpressionTreeDepth.Value = 3;
272    }
273
274    protected override void OnSolutionCreatorChanged() {
275      base.OnSolutionCreatorChanged();
276      SolutionCreator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged);
277      ParameterizeOperators();
278    }
[5685]279
[5618]280    private void SolutionCreator_SymbolicExpressionTreeParameter_ActualNameChanged(object sender, EventArgs e) {
281      ParameterizeOperators();
282    }
283
284    protected override void OnEvaluatorChanged() {
285      base.OnEvaluatorChanged();
[5685]286      ParameterizeOperators();
[5618]287    }
288
[5577]289    public event EventHandler ProblemDataChanged;
290    protected virtual void OnProblemDataChanged() {
[5770]291      FitnessCalculationPartition.Start = ProblemData.TrainingPartition.Start;
292      FitnessCalculationPartition.End = ProblemData.TrainingPartition.End;
293
[5618]294      UpdateGrammar();
[5685]295      ParameterizeOperators();
296
[5577]297      var handler = ProblemDataChanged;
298      if (handler != null) handler(this, EventArgs.Empty);
[5618]299
300      OnReset();
[5577]301    }
[5685]302    #endregion
[5618]303
[5685]304    protected virtual void ParameterizeOperators() {
[7506]305      var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators).ToList();
[5618]306
307      foreach (var op in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) {
[8664]308        op.SymbolicExpressionTreeGrammarParameter.ActualName = SymbolicExpressionTreeGrammarParameter.Name;
[5618]309      }
310      foreach (var op in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) {
[8664]311        op.MaximumSymbolicExpressionTreeDepthParameter.ActualName = MaximumSymbolicExpressionTreeDepthParameter.Name;
312        op.MaximumSymbolicExpressionTreeLengthParameter.ActualName = MaximumSymbolicExpressionTreeLengthParameter.Name;
[5618]313      }
314      foreach (var op in operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) {
[8664]315        op.MaximumFunctionArgumentsParameter.ActualName = MaximumFunctionArgumentsParameter.Name;
316        op.MaximumFunctionDefinitionsParameter.ActualName = MaximumFunctionDefinitionsParameter.Name;
[5618]317      }
318      foreach (var op in operators.OfType<ISymbolicDataAnalysisEvaluator<T>>()) {
[5685]319        op.ProblemDataParameter.ActualName = ProblemDataParameterName;
[5618]320        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
[5759]321        op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
322        op.RelativeNumberOfEvaluatedSamplesParameter.ActualName = RelativeNumberOfEvaluatedSamplesParameter.Name;
[8664]323        op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name;
[5618]324      }
325      foreach (var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) {
326        op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
327        op.ChildParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
328      }
329      foreach (var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) {
330        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
331      }
332      foreach (var op in operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {
333        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
334      }
[8664]335      foreach (var op in operators.OfType<ISymbolicDataAnalysisSingleObjectiveAnalyzer>()) {
336        op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name;
337      }
338      foreach (var op in operators.OfType<ISymbolicDataAnalysisMultiObjectiveAnalyzer>()) {
339        op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name;
340      }
[6135]341      foreach (var op in operators.OfType<ISymbolicDataAnalysisAnalyzer>()) {
342        op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
343      }
[5759]344      foreach (var op in operators.OfType<ISymbolicDataAnalysisValidationAnalyzer<U, T>>()) {
345        op.RelativeNumberOfEvaluatedSamplesParameter.ActualName = RelativeNumberOfEvaluatedSamplesParameter.Name;
[5883]346        op.ValidationPartitionParameter.ActualName = ValidationPartitionParameter.Name;
[5759]347      }
[5685]348      foreach (var op in operators.OfType<ISymbolicDataAnalysisInterpreterOperator>()) {
[8664]349        op.SymbolicDataAnalysisTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
[5685]350      }
[7506]351      foreach (var op in operators.OfType<ISymbolicDataAnalysisExpressionCrossover<T>>()) {
[8664]352        op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
[7506]353        op.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
354        op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
355        op.RelativeNumberOfEvaluatedSamplesParameter.ActualName = RelativeNumberOfEvaluatedSamplesParameter.Name;
356        op.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
357      }
[10278]358      // add tracking analyzer
359      foreach (var op in operators.OfType<GenealogyAnalyzer<TGraph, TVertex, ISymbolicExpressionTree>>()) {
360        var crossover = operators.OfType<ISymbolicExpressionTreeCrossover>().First();
361        op.CrossoverParentsParameterName = crossover.ParentsParameter.Name;
362        op.CrossoverChildParameterName = crossover.ChildParameter.Name;
363        var manipulator = operators.OfType<ISymbolicExpressionTreeManipulator>().First();
364        op.ManipulatorChildParameterName = manipulator.SymbolicExpressionTreeParameter.Name;
365        var creator = operators.OfType<ISymbolicExpressionTreeCreator>().First();
366        op.SolutionCreatorIndividualParameterName = creator.SymbolicExpressionTreeParameter.Name;
367      }
[5618]368    }
[5623]369
[7823]370    #region Import & Export
[9452]371    public virtual void Load(T data) {
[7823]372      Name = data.Name;
373      Description = data.Description;
374      ProblemData = data;
375    }
376
[9452]377    public virtual T Export() {
[7823]378      return ProblemData;
379    }
380    #endregion
[5577]381  }
382}
Note: See TracBrowser for help on using the repository browser.