source: branches/2989_MovingPeaksBenchmark/HeuristicLab.Problems.MovingPeaksBenchmark/3.3/MovingPeaksBenchmarkProblem.cs @ 16609

Last change on this file since 16609 was 16609, checked in by swagner, 3 years ago

#2989: Worked on Moving Peaks Benchmark

File size: 22.6 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 System;
23using System.Collections.Generic;
24using System.Linq;
25//using HeuristicLab.Analysis;
26using HeuristicLab.Common;
27using HeuristicLab.Core;
28using HeuristicLab.Data;
29using HeuristicLab.Encodings.RealVectorEncoding;
30using HeuristicLab.Optimization;
31//using HeuristicLab.Optimization.Operators;
32using HeuristicLab.Parameters;
33using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
34using HeuristicLab.PluginInfrastructure;
35//using HeuristicLab.Problems.Instances;
36
37namespace HeuristicLab.Problems.MovingPeaksBenchmark {
38  [Item("Moving Peaks Benchmark", "Moving peaks benchmark problem for dynamic optimization.")]
39  [StorableClass]
40  [Creatable(CreatableAttribute.Categories.Problems, Priority = 97)]
41  public sealed class MovingPeaksBenchmarkProblem : SingleObjectiveHeuristicOptimizationProblem<IMovingPeaksBenchmarkProblemEvaluator, IRealVectorCreator>, IStorableContent {
42    public string Filename { get; set; }
43
44    //[Storable]
45    //private StdDevStrategyVectorCreator strategyVectorCreator;
46    //[Storable]
47    //private StdDevStrategyVectorCrossover strategyVectorCrossover;
48    //[Storable]
49    //private StdDevStrategyVectorManipulator strategyVectorManipulator;
50
51    #region Parameter Properties
52    public ValueParameter<DoubleMatrix> BoundsParameter {
53      get { return (ValueParameter<DoubleMatrix>)Parameters["Bounds"]; }
54    }
55    public ValueParameter<IntValue> ProblemSizeParameter {
56      get { return (ValueParameter<IntValue>)Parameters["ProblemSize"]; }
57    }
58    public ValueParameter<IntValue> PeaksParameter {
59      get { return (ValueParameter<IntValue>)Parameters["Peaks"]; }
60    }
61    public ValueParameter<DoubleMatrix> InitialPeakLocationsParameter {
62      get { return (ValueParameter<DoubleMatrix>)Parameters["InitialPeakLocations"]; }
63    }
64    public ValueParameter<DoubleArray> InitialPeakWidthsParameter {
65      get { return (ValueParameter<DoubleArray>)Parameters["InitialPeakWidths"]; }
66    }
67    public ValueParameter<DoubleArray> InitialPeakHeightsParameter {
68      get { return (ValueParameter<DoubleArray>)Parameters["InitialPeakHeights"]; }
69    }
70    public FixedValueParameter<IntValue> MovingPeaksRandomSeedParameter {
71      get { return (FixedValueParameter<IntValue>)Parameters["MovingPeaksRandomSeed"]; }
72    }
73    public FixedValueParameter<IntValue> PeakMovementIntervalParameter {
74      get { return (FixedValueParameter<IntValue>)Parameters["PeakMovementInterval"]; }
75    }
76    public FixedValueParameter<DoubleValue> PeakMovementStrengthParameter {
77      get { return (FixedValueParameter<DoubleValue>)Parameters["PeakMovementStrength"]; }
78    }
79    public OptionalValueParameter<RealVector> BestKnownSolutionParameter {
80      get { return (OptionalValueParameter<RealVector>)Parameters["BestKnownSolution"]; }
81    }
82    #endregion
83
84    #region Properties
85    public DoubleMatrix Bounds {
86      get { return BoundsParameter.Value; }
87      set { BoundsParameter.Value = value; }
88    }
89    public IntValue ProblemSize {
90      get { return ProblemSizeParameter.Value; }
91      set { ProblemSizeParameter.Value = value; }
92    }
93    public IntValue Peaks {
94      get { return PeaksParameter.Value; }
95      set { PeaksParameter.Value = value; }
96    }
97    public DoubleMatrix InitialPeakLocations {
98      get { return InitialPeakLocationsParameter.Value; }
99      set { InitialPeakLocationsParameter.Value = value; }
100    }
101    public DoubleArray InitialPeakWidths {
102      get { return InitialPeakWidthsParameter.Value; }
103      set { InitialPeakWidthsParameter.Value = value; }
104    }
105    public DoubleArray InitialPeakHeights {
106      get { return InitialPeakHeightsParameter.Value; }
107      set { InitialPeakHeightsParameter.Value = value; }
108    }
109    public IntValue MovingPeaksRandomSeed {
110      get { return MovingPeaksRandomSeedParameter.Value; }
111    }
112    public IntValue PeakMovementInterval {
113      get { return PeakMovementIntervalParameter.Value; }
114    }
115    public DoubleValue PeakMovementStrength {
116      get { return PeakMovementStrengthParameter.Value; }
117    }
118    private BestMovingPeaksBenchmarkSolutionAnalyzer BestMovingPeaksBenchmarkSolutionAnalyzer {
119      get { return Operators.OfType<BestMovingPeaksBenchmarkSolutionAnalyzer>().FirstOrDefault(); }
120    }
121    #endregion
122
123    [StorableConstructor]
124    private MovingPeaksBenchmarkProblem(bool deserializing) : base(deserializing) { }
125    private MovingPeaksBenchmarkProblem(MovingPeaksBenchmarkProblem original, Cloner cloner)
126      : base(original, cloner) {
127      //strategyVectorCreator = cloner.Clone(original.strategyVectorCreator);
128      //strategyVectorCrossover = cloner.Clone(original.strategyVectorCrossover);
129      //strategyVectorManipulator = cloner.Clone(original.strategyVectorManipulator);
130      RegisterEventHandlers();
131    }
132    public MovingPeaksBenchmarkProblem()
133      : base(new MovingPeaksBenchmarkProblemEvaluator(), new UniformRandomRealVectorCreator()) {
134      var defaultBounds = new double[,] {
135        { 0.0, 100.0 }
136      };
137      var defaultPeaks = new double[,] {
138        { 08.0, 64.0, 67.0, 55.0, 04.0 },
139        { 50.0, 13.0, 76.0, 15.0, 07.0 },
140        { 09.0, 19.0, 27.0, 67.0, 24.0 },
141        { 66.0, 87.0, 65.0, 19.0, 43.0 },
142        { 76.0, 32.0, 43.0, 54.0, 65.0 }
143      };
144      var defaultWidths = new double[] { 0.1, 0.1, 0.1, 0.1, 0.1 };
145      var defaultHeights = new double[] { 50.0, 50.0, 50.0, 50.0, 50.0 };
146      var defaultBestKnown = new double[] { 08.0, 64.0, 67.0, 55.0, 04.0 };
147
148      Parameters.Add(new ValueParameter<DoubleMatrix>("Bounds", "The lower and upper bounds in each dimension.", new DoubleMatrix(defaultBounds)));
149      Parameters.Add(new ValueParameter<IntValue>("ProblemSize", "The dimension of the problem.", new IntValue(5)));
150      Parameters.Add(new ValueParameter<IntValue>("Peaks", "The number of peaks.", new IntValue(5)));
151      Parameters.Add(new ValueParameter<DoubleMatrix>("InitialPeakLocations", "Initial coordinates of each peaks.", new DoubleMatrix(defaultPeaks)));
152      Parameters.Add(new ValueParameter<DoubleArray>("InitialPeakWidths", "Initial width of each peak.", new DoubleArray(defaultWidths)));
153      Parameters.Add(new ValueParameter<DoubleArray>("InitialPeakHeights", "Initial height of each peak.", new DoubleArray(defaultHeights)));
154      Parameters.Add(new FixedValueParameter<IntValue>("MovingPeaksRandomSeed", "The random seed for initializing the PRNG for changing the peaks.", new IntValue(666)));
155      Parameters.Add(new FixedValueParameter<IntValue>("PeakMovementInterval", "The interval in evaluated solutions in which peaks are moved.", new IntValue(1000)));
156      Parameters.Add(new FixedValueParameter<DoubleValue>("PeakMovementStrength", "The length of the random vector used for changing peak locations.", new DoubleValue(1.0)));
157      Parameters.Add(new OptionalValueParameter<RealVector>("BestKnownSolution", "The location of the highest peak.", new RealVector(defaultBestKnown)));
158
159      Maximization.Value = true;
160      BestKnownQuality = new DoubleValue(defaultHeights.Max());
161
162      //strategyVectorCreator = new StdDevStrategyVectorCreator();
163      //strategyVectorCreator.LengthParameter.ActualName = ProblemSizeParameter.Name;
164      //strategyVectorCrossover = new StdDevStrategyVectorCrossover();
165      //strategyVectorManipulator = new StdDevStrategyVectorManipulator();
166      //strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(0.5);
167      //strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(0.5);
168
169      SolutionCreator.RealVectorParameter.ActualName = "Point";
170      ParameterizeSolutionCreator();
171      ParameterizeEvaluator();
172
173      InitializeOperators();
174      RegisterEventHandlers();
175      UpdateStrategyVectorBounds();
176    }
177
178    public override IDeepCloneable Clone(Cloner cloner) {
179      return new MovingPeaksBenchmarkProblem(this, cloner);
180    }
181
182    #region Events
183    protected override void OnSolutionCreatorChanged() {
184      base.OnSolutionCreatorChanged();
185      ParameterizeSolutionCreator();
186      ParameterizeAnalyzers();
187      SolutionCreator.RealVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_RealVectorParameter_ActualNameChanged);
188      SolutionCreator_RealVectorParameter_ActualNameChanged(null, EventArgs.Empty);
189    }
190    protected override void OnEvaluatorChanged() {
191      base.OnEvaluatorChanged();
192      ParameterizeEvaluator();
193      UpdateMoveEvaluators();
194      ParameterizeAnalyzers();
195      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
196      Evaluator_QualityParameter_ActualNameChanged(null, EventArgs.Empty);
197      OnReset();
198    }
199    private void ProblemSizeParameter_ValueChanged(object sender, EventArgs e) {
200      ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged);
201      ProblemSize_ValueChanged(null, EventArgs.Empty);
202    }
203    private void ProblemSize_ValueChanged(object sender, EventArgs e) {
204      if (ProblemSize.Value < 1) ProblemSize.Value = 1;
205      ParameterizeSolutionCreator();
206      ParameterizeEvaluator();
207      //strategyVectorManipulator.GeneralLearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * ProblemSize.Value));
208      //strategyVectorManipulator.LearningRateParameter.Value = new DoubleValue(1.0 / Math.Sqrt(2 * Math.Sqrt(ProblemSize.Value)));
209      OnReset();
210    }
211    private void SolutionCreator_RealVectorParameter_ActualNameChanged(object sender, EventArgs e) {
212      ParameterizeEvaluator();
213      ParameterizeOperators();
214      ParameterizeAnalyzers();
215    }
216    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
217      ParameterizeOperators();
218    }
219    private void BoundsParameter_ValueChanged(object sender, EventArgs e) {
220      Bounds.ToStringChanged += new EventHandler(Bounds_ToStringChanged);
221      Bounds_ToStringChanged(null, EventArgs.Empty);
222    }
223    private void Bounds_ToStringChanged(object sender, EventArgs e) {
224      if (Bounds.Columns != 2 || Bounds.Rows < 1)
225        Bounds = new DoubleMatrix(1, 2);
226      ParameterizeOperators();
227      UpdateStrategyVectorBounds();
228    }
229    private void Bounds_ItemChanged(object sender, EventArgs<int, int> e) {
230      if (e.Value2 == 0 && Bounds[e.Value, 1] <= Bounds[e.Value, 0])
231        Bounds[e.Value, 1] = Bounds[e.Value, 0] + 0.1;
232      if (e.Value2 == 1 && Bounds[e.Value, 0] >= Bounds[e.Value, 1])
233        Bounds[e.Value, 0] = Bounds[e.Value, 1] - 0.1;
234      ParameterizeOperators();
235      UpdateStrategyVectorBounds();
236    }
237    private void MoveGenerator_AdditiveMoveParameter_ActualNameChanged(object sender, EventArgs e) {
238      string name = ((ILookupParameter<AdditiveMove>)sender).ActualName;
239      foreach (IAdditiveRealVectorMoveOperator op in Operators.OfType<IAdditiveRealVectorMoveOperator>()) {
240        op.AdditiveMoveParameter.ActualName = name;
241      }
242    }
243    //private void SphereEvaluator_Parameter_ValueChanged(object sender, EventArgs e) {
244    //  SphereEvaluator eval = (Evaluator as SphereEvaluator);
245    //  if (eval != null) {
246    //    foreach (ISphereMoveEvaluator op in Operators.OfType<ISphereMoveEvaluator>()) {
247    //      op.C = eval.C;
248    //      op.Alpha = eval.Alpha;
249    //    }
250    //  }
251    //}
252    //private void RastriginEvaluator_Parameter_ValueChanged(object sender, EventArgs e) {
253    //  RastriginEvaluator eval = (Evaluator as RastriginEvaluator);
254    //  if (eval != null) {
255    //    foreach (IRastriginMoveEvaluator op in Operators.OfType<IRastriginMoveEvaluator>()) {
256    //      op.A = eval.A;
257    //    }
258    //  }
259    //}
260    //private void strategyVectorCreator_BoundsParameter_ValueChanged(object sender, EventArgs e) {
261    //  strategyVectorManipulator.BoundsParameter.Value = (DoubleMatrix)strategyVectorCreator.BoundsParameter.Value.Clone();
262    //}
263    //private void strategyVectorCreator_StrategyParameterParameter_ActualNameChanged(object sender, EventArgs e) {
264    //  string name = strategyVectorCreator.StrategyParameterParameter.ActualName;
265    //  strategyVectorCrossover.ParentsParameter.ActualName = name;
266    //  strategyVectorCrossover.StrategyParameterParameter.ActualName = name;
267    //  strategyVectorManipulator.StrategyParameterParameter.ActualName = name;
268    //}
269    #endregion
270
271    #region Helpers
272    [StorableHook(HookType.AfterDeserialization)]
273    private void AfterDeserialization() {
274      RegisterEventHandlers();
275    }
276
277    private void RegisterEventHandlers() {
278      ProblemSizeParameter.ValueChanged += new EventHandler(ProblemSizeParameter_ValueChanged);
279      ProblemSize.ValueChanged += new EventHandler(ProblemSize_ValueChanged);
280      BoundsParameter.ValueChanged += new EventHandler(BoundsParameter_ValueChanged);
281      Bounds.ToStringChanged += new EventHandler(Bounds_ToStringChanged);
282      Bounds.ItemChanged += new EventHandler<EventArgs<int, int>>(Bounds_ItemChanged);
283      SolutionCreator.RealVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_RealVectorParameter_ActualNameChanged);
284      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
285      //strategyVectorCreator.BoundsParameter.ValueChanged += new EventHandler(strategyVectorCreator_BoundsParameter_ValueChanged);
286      //strategyVectorCreator.StrategyParameterParameter.ActualNameChanged += new EventHandler(strategyVectorCreator_StrategyParameterParameter_ActualNameChanged);
287    }
288    private void ParameterizeAnalyzers() {
289      if (BestMovingPeaksBenchmarkSolutionAnalyzer != null) {
290        BestMovingPeaksBenchmarkSolutionAnalyzer.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
291        BestMovingPeaksBenchmarkSolutionAnalyzer.ResultsParameter.ActualName = "Results";
292        BestMovingPeaksBenchmarkSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
293        BestMovingPeaksBenchmarkSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name;
294        BestMovingPeaksBenchmarkSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name;
295        BestMovingPeaksBenchmarkSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;
296      }
297    }
298    private void InitializeOperators() {
299      //Operators.Add(new SingleObjectiveTestFunctionImprovementOperator());
300      //Operators.Add(new SingleObjectiveTestFunctionPathRelinker());
301      //Operators.Add(new SingleObjectiveTestFunctionSimilarityCalculator());
302      //Operators.Add(new HammingSimilarityCalculator());
303      //Operators.Add(new EuclideanSimilarityCalculator());
304      //Operators.Add(new QualitySimilarityCalculator());
305
306      Operators.Add(new BestMovingPeaksBenchmarkSolutionAnalyzer());
307      //Operators.Add(new PopulationSimilarityAnalyzer(Operators.OfType<ISolutionSimilarityCalculator>()));
308      ParameterizeAnalyzers();
309      Operators.AddRange(ApplicationManager.Manager.GetInstances<IRealVectorOperator>().Cast<IOperator>());
310      //Operators.Add(strategyVectorCreator);
311      //Operators.Add(strategyVectorCrossover);
312      //Operators.Add(strategyVectorManipulator);
313      UpdateMoveEvaluators();
314      ParameterizeOperators();
315      InitializeMoveGenerators();
316    }
317    private void InitializeMoveGenerators() {
318      foreach (IAdditiveRealVectorMoveOperator op in Operators.OfType<IAdditiveRealVectorMoveOperator>()) {
319        if (op is IMoveGenerator) {
320          op.AdditiveMoveParameter.ActualNameChanged += new EventHandler(MoveGenerator_AdditiveMoveParameter_ActualNameChanged);
321        }
322      }
323    }
324    private void UpdateMoveEvaluators() {
325      //foreach (ISingleObjectiveTestFunctionMoveEvaluator op in Operators.OfType<ISingleObjectiveTestFunctionMoveEvaluator>().ToList())
326      //  Operators.Remove(op);
327      //foreach (ISingleObjectiveTestFunctionMoveEvaluator op in ApplicationManager.Manager.GetInstances<ISingleObjectiveTestFunctionMoveEvaluator>())
328      //  if (op.EvaluatorType == Evaluator.GetType()) {
329      //    Operators.Add(op);
330      //    #region Synchronize evaluator specific parameters with the parameters of the corresponding move evaluators
331      //    if (op is ISphereMoveEvaluator) {
332      //      SphereEvaluator e = (Evaluator as SphereEvaluator);
333      //      e.AlphaParameter.ValueChanged += new EventHandler(SphereEvaluator_Parameter_ValueChanged);
334      //      e.CParameter.ValueChanged += new EventHandler(SphereEvaluator_Parameter_ValueChanged);
335      //      ISphereMoveEvaluator em = (op as ISphereMoveEvaluator);
336      //      em.C = e.C;
337      //      em.Alpha = e.Alpha;
338      //    } else if (op is IRastriginMoveEvaluator) {
339      //      RastriginEvaluator e = (Evaluator as RastriginEvaluator);
340      //      e.AParameter.ValueChanged += new EventHandler(RastriginEvaluator_Parameter_ValueChanged);
341      //      IRastriginMoveEvaluator em = (op as IRastriginMoveEvaluator);
342      //      em.A = e.A;
343      //    }
344      //    #endregion
345      //  }
346      ParameterizeOperators();
347      OnOperatorsChanged();
348    }
349    private void ParameterizeSolutionCreator() {
350      SolutionCreator.LengthParameter.Value = new IntValue(ProblemSize.Value);
351      SolutionCreator.LengthParameter.Hidden = true;
352      SolutionCreator.BoundsParameter.ActualName = BoundsParameter.Name;
353      SolutionCreator.BoundsParameter.Hidden = true;
354    }
355    private void ParameterizeEvaluator() {
356      Evaluator.PointParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
357      Evaluator.PointParameter.Hidden = true;
358      //try {
359      //  BestKnownSolutionParameter.Value = Evaluator.GetBestKnownSolution(ProblemSize.Value);
360      //}
361      //catch (ArgumentException e) {
362      //  ErrorHandling.ShowErrorDialog(e);
363      //  ProblemSize.Value = Evaluator.MinimumProblemSize;
364      //}
365    }
366    private void ParameterizeOperators() {
367      foreach (var op in Operators.OfType<IRealVectorCrossover>()) {
368        op.ParentsParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
369        op.ParentsParameter.Hidden = true;
370        op.ChildParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
371        op.ChildParameter.Hidden = true;
372        op.BoundsParameter.ActualName = BoundsParameter.Name;
373        op.BoundsParameter.Hidden = true;
374      }
375      foreach (var op in Operators.OfType<IRealVectorManipulator>()) {
376        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
377        op.RealVectorParameter.Hidden = true;
378        op.BoundsParameter.ActualName = BoundsParameter.Name;
379        op.BoundsParameter.Hidden = true;
380      }
381      foreach (var op in Operators.OfType<IRealVectorMoveOperator>()) {
382        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
383        op.RealVectorParameter.Hidden = true;
384      }
385      foreach (var op in Operators.OfType<IRealVectorMoveGenerator>()) {
386        op.BoundsParameter.ActualName = BoundsParameter.Name;
387        op.BoundsParameter.Hidden = true;
388      }
389      //foreach (var op in Operators.OfType<ISingleObjectiveTestFunctionAdditiveMoveEvaluator>()) {
390      //  op.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;
391      //  op.QualityParameter.Hidden = true;
392      //  op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
393      //  op.RealVectorParameter.Hidden = true;
394      //}
395      foreach (var op in Operators.OfType<IRealVectorParticleCreator>()) {
396        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
397        op.RealVectorParameter.Hidden = true;
398        op.BoundsParameter.ActualName = BoundsParameter.Name;
399        op.BoundsParameter.Hidden = true;
400      }
401      foreach (var op in Operators.OfType<IRealVectorParticleUpdater>()) {
402        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
403        op.RealVectorParameter.Hidden = true;
404        op.BoundsParameter.ActualName = BoundsParameter.Name;
405        op.BoundsParameter.Hidden = true;
406      }
407      foreach (var op in Operators.OfType<IRealVectorSwarmUpdater>()) {
408        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
409        op.RealVectorParameter.Hidden = true;
410        op.MaximizationParameter.ActualName = MaximizationParameter.Name;
411        op.MaximizationParameter.Hidden = true;
412      }
413      foreach (var op in Operators.OfType<IRealVectorMultiNeighborhoodShakingOperator>()) {
414        op.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
415        op.RealVectorParameter.Hidden = true;
416      }
417      foreach (var op in Operators.OfType<ISingleObjectiveImprovementOperator>()) {
418        op.SolutionParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
419        op.SolutionParameter.Hidden = true;
420      }
421      foreach (var op in Operators.OfType<ISingleObjectivePathRelinker>()) {
422        op.ParentsParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName;
423        op.ParentsParameter.Hidden = true;
424      }
425      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
426        op.SolutionVariableName = SolutionCreator.RealVectorParameter.ActualName;
427        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
428        //var calc = op as SingleObjectiveTestFunctionSimilarityCalculator;
429        //if (calc != null) calc.Bounds = Bounds;
430      }
431    }
432    private void UpdateStrategyVectorBounds() {
433      //var strategyBounds = (DoubleMatrix)Bounds.Clone();
434      //for (int i = 0; i < strategyBounds.Rows; i++) {
435      //  if (strategyBounds[i, 0] < 0) strategyBounds[i, 0] = 0;
436      //  strategyBounds[i, 1] = 0.1 * (Bounds[i, 1] - Bounds[i, 0]);
437      //}
438      //strategyVectorCreator.BoundsParameter.Value = strategyBounds;
439    }
440    #endregion
441  }
442}
Note: See TracBrowser for help on using the repository browser.