Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Algorithms.ScatterSearch/3.3/ScatterSearch.cs @ 9376

Last change on this file since 9376 was 8774, checked in by ascheibe, 12 years ago

#1331 fixed parameters of the random number generator so that the seed can be set

File size: 22.7 KB
RevLine 
[7789]1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 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.Linq;
24using HeuristicLab.Analysis;
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.Random;
34using HeuristicLab.Selection;
35
36namespace HeuristicLab.Algorithms.ScatterSearch {
37  /// <summary>
38  /// A scatter search algorithm.
39  /// </summary>
40  [Item("Scatter Search", "A scatter search algorithm.")]
41  [Creatable("Algorithms")]
42  [StorableClass]
43  public sealed class ScatterSearch : HeuristicOptimizationEngineAlgorithm, IStorableContent {
44    public string Filename { get; set; }
45
46    #region Problem Properties
47    public override Type ProblemType {
48      get { return typeof(ISingleObjectiveHeuristicOptimizationProblem); }
49    }
50    public new ISingleObjectiveHeuristicOptimizationProblem Problem {
51      get { return (ISingleObjectiveHeuristicOptimizationProblem)base.Problem; }
52      set { base.Problem = value; }
53    }
54    #endregion
55
56    #region Parameter Properties
57    public IValueParameter<MultiAnalyzer> AnalyzerParameter {
58      get { return (IValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
59    }
[8332]60    public IConstrainedValueParameter<ICrossover> CrossoverParameter {
61      get { return (IConstrainedValueParameter<ICrossover>)Parameters["Crossover"]; }
[7789]62    }
63    public IValueParameter<BoolValue> ExecutePathRelinkingParameter {
64      get { return (IValueLookupParameter<BoolValue>)Parameters["ExecutePathRelinking"]; }
65    }
[8332]66    public IConstrainedValueParameter<IImprovementOperator> ImproverParameter {
67      get { return (IConstrainedValueParameter<IImprovementOperator>)Parameters["Improver"]; }
[7789]68    }
69    public IValueParameter<IntValue> MaximumIterationsParameter {
70      get { return (IValueParameter<IntValue>)Parameters["MaximumIterations"]; }
71    }
72    public IValueParameter<IntValue> NumberOfHighQualitySolutionsParameter {
73      get { return (IValueParameter<IntValue>)Parameters["NumberOfHighQualitySolutions"]; }
74    }
[8332]75    public IConstrainedValueParameter<IPathRelinker> PathRelinkerParameter {
76      get { return (IConstrainedValueParameter<IPathRelinker>)Parameters["PathRelinker"]; }
[7789]77    }
78    public IValueParameter<IntValue> PopulationSizeParameter {
79      get { return (IValueParameter<IntValue>)Parameters["PopulationSize"]; }
80    }
81    public IValueParameter<IntValue> ReferenceSetSizeParameter {
82      get { return (IValueParameter<IntValue>)Parameters["ReferenceSetSize"]; }
83    }
84    public IValueParameter<IntValue> SeedParameter {
85      get { return (IValueParameter<IntValue>)Parameters["Seed"]; }
86    }
87    public IValueParameter<BoolValue> SetSeedRandomlyParameter {
88      get { return (IValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
89    }
[8628]90    public IConstrainedValueParameter<ISingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter {
91      get { return (IConstrainedValueParameter<ISingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; }
[7789]92    }
93    #endregion
94
95    #region Properties
[8332]96    public MultiAnalyzer Analyzer {
[7789]97      get { return AnalyzerParameter.Value; }
98      set { AnalyzerParameter.Value = value; }
99    }
[8332]100    public ICrossover Crossover {
[7789]101      get { return CrossoverParameter.Value; }
102      set { CrossoverParameter.Value = value; }
103    }
[8332]104    public BoolValue ExecutePathRelinking {
[7789]105      get { return ExecutePathRelinkingParameter.Value; }
106      set { ExecutePathRelinkingParameter.Value = value; }
107    }
[8332]108    public IImprovementOperator Improver {
[7789]109      get { return ImproverParameter.Value; }
110      set { ImproverParameter.Value = value; }
111    }
[8332]112    public IntValue MaximumIterations {
[7789]113      get { return MaximumIterationsParameter.Value; }
114      set { MaximumIterationsParameter.Value = value; }
115    }
[8332]116    public IntValue NumberOfHighQualitySolutions {
[7789]117      get { return NumberOfHighQualitySolutionsParameter.Value; }
118      set { NumberOfHighQualitySolutionsParameter.Value = value; }
119    }
[8332]120    public IPathRelinker PathRelinker {
[7789]121      get { return PathRelinkerParameter.Value; }
122      set { PathRelinkerParameter.Value = value; }
123    }
[8332]124    public IntValue PopulationSize {
[7789]125      get { return PopulationSizeParameter.Value; }
126      set { PopulationSizeParameter.Value = value; }
127    }
[8332]128    public IntValue ReferenceSetSize {
[7789]129      get { return ReferenceSetSizeParameter.Value; }
130      set { ReferenceSetSizeParameter.Value = value; }
131    }
[8332]132    public IntValue Seed {
[7789]133      get { return SeedParameter.Value; }
134      set { SeedParameter.Value = value; }
135    }
[8332]136    public BoolValue SetSeedRandomly {
[7789]137      get { return SetSeedRandomlyParameter.Value; }
138      set { SetSeedRandomlyParameter.Value = value; }
139    }
[8628]140    public ISingleObjectiveSolutionSimilarityCalculator SimilarityCalculator {
[7789]141      get { return SimilarityCalculatorParameter.Value; }
142      set { SimilarityCalculatorParameter.Value = value; }
143    }
144    private RandomCreator RandomCreator {
145      get { return (RandomCreator)OperatorGraph.InitialOperator; }
146    }
147    private SolutionsCreator SolutionsCreator {
148      get { return (SolutionsCreator)RandomCreator.Successor; }
149    }
150    private ScatterSearchMainLoop MainLoop {
151      get { return FindMainLoop(SolutionsCreator.Successor); }
152    }
153
154    [Storable]
155    private BestAverageWorstQualityAnalyzer qualityAnalyzer;
156    #endregion
157
158    [StorableConstructor]
159    private ScatterSearch(bool deserializing) : base(deserializing) { }
160    [StorableHook(HookType.AfterDeserialization)]
161    private void AfterDeserialization() {
162      Initialize();
163    }
164    private ScatterSearch(ScatterSearch original, Cloner cloner)
165      : base(original, cloner) {
166      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
167      Initialize();
168    }
169    public override IDeepCloneable Clone(Cloner cloner) {
170      return new ScatterSearch(this, cloner);
171    }
172    public ScatterSearch()
173      : base() {
174      #region Create parameters
[8086]175      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The analyzer used to analyze each iteration.", new MultiAnalyzer()));
176      Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions."));
177      Parameters.Add(new ValueParameter<BoolValue>("ExecutePathRelinking", "True if path relinking should be executed instead of crossover, otherwise false.", new BoolValue(true)));
178      Parameters.Add(new ConstrainedValueParameter<IImprovementOperator>("Improver", "The operator used to improve solutions."));
179      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of iterations which should be processed.", new IntValue(100)));
180      Parameters.Add(new ValueParameter<IntValue>("NumberOfHighQualitySolutions", "The number of high quality solutions in the reference set.", new IntValue(5)));
181      Parameters.Add(new ConstrainedValueParameter<IPathRelinker>("PathRelinker", "The operator used to execute path relinking."));
182      Parameters.Add(new ValueParameter<IntValue>("PopulationSize", "The size of the population of solutions.", new IntValue(50)));
183      Parameters.Add(new ValueParameter<IntValue>("ReferenceSetSize", "The size of the reference set.", new IntValue(20)));
184      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
185      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
[8628]186      Parameters.Add(new ConstrainedValueParameter<ISingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator", "The operator used to calculate the similarity between two solutions."));
[7789]187      #endregion
188
189      #region Create operators
190      RandomCreator randomCreator = new RandomCreator();
191      SolutionsCreator solutionsCreator = new SolutionsCreator();
192      UniformSubScopesProcessor uniformSubScopesProcessor = new UniformSubScopesProcessor();
193      Placeholder solutionEvaluator = new Placeholder();
194      Placeholder solutionImprover = new Placeholder();
[8086]195      VariableCreator variableCreator = new VariableCreator();
196      DataReducer dataReducer = new DataReducer();
[7954]197      ResultsCollector resultsCollector = new ResultsCollector();
[7789]198      BestSelector bestSelector = new BestSelector();
199      ScatterSearchMainLoop mainLoop = new ScatterSearchMainLoop();
200      #endregion
201
202      #region Create operator graph
203      OperatorGraph.InitialOperator = randomCreator;
204      randomCreator.RandomParameter.ActualName = "Random";
205      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
[8774]206      randomCreator.SeedParameter.Value = null;
[7789]207      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
[8774]208      randomCreator.SetSeedRandomlyParameter.Value = null;
[7789]209      randomCreator.Successor = solutionsCreator;
210
211      solutionsCreator.Name = "DiversificationGenerationMethod";
212      solutionsCreator.NumberOfSolutionsParameter.ActualName = "PopulationSize";
213      solutionsCreator.Successor = uniformSubScopesProcessor;
214
215      uniformSubScopesProcessor.Operator = solutionImprover;
[8380]216      uniformSubScopesProcessor.ParallelParameter.Value = new BoolValue(true);
[8086]217      uniformSubScopesProcessor.Successor = variableCreator;
[7789]218
219      solutionImprover.Name = "SolutionImprover";
220      solutionImprover.OperatorParameter.ActualName = "Improver";
221      solutionImprover.Successor = solutionEvaluator;
222
223      solutionEvaluator.Name = "SolutionEvaluator";
224      solutionEvaluator.OperatorParameter.ActualName = "Evaluator";
225      solutionEvaluator.Successor = null;
226
[8086]227      variableCreator.Name = "Initialize EvaluatedSolutions";
228      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue()));
229      variableCreator.Successor = dataReducer;
[7954]230
[8086]231      dataReducer.Name = "Increment EvaluatedSolutions";
232      dataReducer.ParameterToReduce.ActualName = "LocalEvaluatedSolutions";
233      dataReducer.TargetParameter.ActualName = "EvaluatedSolutions";
234      dataReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum);
235      dataReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Sum);
236      dataReducer.Successor = resultsCollector;
237
[7954]238      resultsCollector.Name = "ResultsCollector";
239      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions", null, "EvaluatedSolutions"));
240      resultsCollector.Successor = bestSelector;
241
[7789]242      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = NumberOfHighQualitySolutionsParameter.Name;
243      bestSelector.CopySelected = new BoolValue(false);
244      bestSelector.Successor = mainLoop;
245
246      mainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
247      mainLoop.RandomParameter.ActualName = randomCreator.RandomParameter.ActualName;
248      mainLoop.ResultsParameter.ActualName = "Results";
249      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
250      mainLoop.IterationsParameter.ActualName = "Iterations";
[8086]251      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
[7789]252      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
253      mainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
254      mainLoop.NumberOfHighQualitySolutionsParameter.ActualName = NumberOfHighQualitySolutionsParameter.Name;
255      mainLoop.Successor = null;
256      #endregion
257
258      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
259      ParameterizeAnalyzers();
260      UpdateAnalyzers();
261
262      Initialize();
263    }
264
265    public override void Prepare() {
[8746]266      if (Problem != null && Improver != null && (PathRelinker != null || ExecutePathRelinking.Value == false) && SimilarityCalculator != null)
[7789]267        base.Prepare();
268    }
269
270    #region Events
271    protected override void OnProblemChanged() {
272      ParameterizeStochasticOperator(Problem.SolutionCreator);
273      ParameterizeStochasticOperator(Problem.Evaluator);
[8086]274      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
[7789]275      ParameterizeAnalyzers();
276      ParameterizeSolutionsCreator();
277      ParameterizeBestSelector();
278      UpdateAnalyzers();
279      UpdateCrossovers();
[8348]280      UpdateImprovers();
[7789]281      UpdatePathRelinkers();
282      UpdateSimilarityCalculators();
283      ParameterizeMainLoop();
284      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
285      base.OnProblemChanged();
286    }
287    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
288      ParameterizeStochasticOperator(Problem.SolutionCreator);
289      ParameterizeSolutionsCreator();
290      base.Problem_SolutionCreatorChanged(sender, e);
291    }
292    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
293      ParameterizeStochasticOperator(Problem.Evaluator);
294      ParameterizeSolutionsCreator();
295      ParameterizeMainLoop();
296      ParameterizeAnalyzers();
297      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
298      base.Problem_EvaluatorChanged(sender, e);
299    }
300    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
[8086]301      foreach (IOperator op in Problem.Operators.OfType<IOperator>()) ParameterizeStochasticOperator(op);
[7789]302      UpdateAnalyzers();
303      UpdateCrossovers();
304      UpdatePathRelinkers();
305      UpdateSimilarityCalculators();
306      UpdateImprovers();
307      ParameterizeMainLoop();
308      ParameterizeAnalyzers();
309      base.Problem_OperatorsChanged(sender, e);
310    }
[8628]311    private void SimilarityCalculatorParameter_ValueChanged(object sender, EventArgs e) {
312      ParameterizeMainLoop();
313    }
[7789]314    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
315      ParameterizeMainLoop();
316      ParameterizeAnalyzers();
317      ParameterizeBestSelector();
[8628]318      ParameterizeSimilarityCalculators();
[7789]319    }
320    #endregion
321
322    #region Helpers
323    private void Initialize() {
[8628]324      SimilarityCalculatorParameter.ValueChanged += new EventHandler(SimilarityCalculatorParameter_ValueChanged);
[8346]325      if (Problem != null)
[7789]326        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
327    }
328    private void UpdateAnalyzers() {
329      Analyzer.Operators.Clear();
330      if (Problem != null) {
331        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>()) {
332          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
333            param.Depth = 1;
334          Analyzer.Operators.Add(analyzer, analyzer.EnabledByDefault);
335        }
336      }
337      Analyzer.Operators.Add(qualityAnalyzer, qualityAnalyzer.EnabledByDefault);
338    }
339    private void UpdateCrossovers() {
340      ICrossover oldCrossover = CrossoverParameter.Value;
341      CrossoverParameter.ValidValues.Clear();
342      ICrossover defaultCrossover = Problem.Operators.OfType<ICrossover>().FirstOrDefault();
343
344      foreach (ICrossover crossover in Problem.Operators.OfType<ICrossover>().OrderBy(x => x.Name))
345        CrossoverParameter.ValidValues.Add(crossover);
346
347      if (oldCrossover != null) {
348        ICrossover crossover = CrossoverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldCrossover.GetType());
349        if (crossover != null) CrossoverParameter.Value = crossover;
350        else oldCrossover = null;
351      }
352      if (oldCrossover == null && defaultCrossover != null)
353        CrossoverParameter.Value = defaultCrossover;
354    }
355    private void UpdateImprovers() {
356      IImprovementOperator oldImprover = ImproverParameter.Value;
357      ImproverParameter.ValidValues.Clear();
358      IImprovementOperator defaultImprover = Problem.Operators.OfType<IImprovementOperator>().FirstOrDefault();
359
360      foreach (IImprovementOperator improver in Problem.Operators.OfType<IImprovementOperator>().OrderBy(x => x.Name))
361        ImproverParameter.ValidValues.Add(improver);
362
363      if (oldImprover != null) {
364        IImprovementOperator improver = ImproverParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldImprover.GetType());
365        if (improver != null) ImproverParameter.Value = improver;
366        else oldImprover = null;
367      }
368      if (oldImprover == null && defaultImprover != null)
369        ImproverParameter.Value = defaultImprover;
370    }
371    private void UpdatePathRelinkers() {
372      IPathRelinker oldPathRelinker = PathRelinkerParameter.Value;
373      PathRelinkerParameter.ValidValues.Clear();
374      IPathRelinker defaultPathRelinker = Problem.Operators.OfType<IPathRelinker>().FirstOrDefault();
375
376      foreach (IPathRelinker pathRelinker in Problem.Operators.OfType<IPathRelinker>().OrderBy(x => x.Name))
377        PathRelinkerParameter.ValidValues.Add(pathRelinker);
378
379      if (oldPathRelinker != null) {
380        IPathRelinker pathRelinker = PathRelinkerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldPathRelinker.GetType());
381        if (pathRelinker != null) PathRelinkerParameter.Value = pathRelinker;
382        else oldPathRelinker = null;
383      }
384      if (oldPathRelinker == null && defaultPathRelinker != null)
385        PathRelinkerParameter.Value = defaultPathRelinker;
386    }
387    private void UpdateSimilarityCalculators() {
[8628]388      ISingleObjectiveSolutionSimilarityCalculator oldSimilarityCalculator = SimilarityCalculatorParameter.Value;
[7789]389      SimilarityCalculatorParameter.ValidValues.Clear();
[8628]390      ISingleObjectiveSolutionSimilarityCalculator defaultSimilarityCalculator = Problem.Operators.OfType<ISingleObjectiveSolutionSimilarityCalculator>().FirstOrDefault();
[7789]391
[8628]392      SimilarityCalculatorParameter.ValidValues.Add(new QualitySimilarityCalculator { QualityVariableName = Problem.Evaluator.QualityParameter.ActualName });
[8662]393      SimilarityCalculatorParameter.ValidValues.Add(new NoSimilarityCalculator { QualityVariableName = Problem.Evaluator.QualityParameter.ActualName });
[8628]394
395      foreach (ISingleObjectiveSolutionSimilarityCalculator similarityCalculator in Problem.Operators.OfType<ISingleObjectiveSolutionSimilarityCalculator>())
[8319]396        SimilarityCalculatorParameter.ValidValues.Add(similarityCalculator);
[7789]397
[8319]398      if (oldSimilarityCalculator != null) {
[8628]399        ISingleObjectiveSolutionSimilarityCalculator similarityCalculator = SimilarityCalculatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldSimilarityCalculator.GetType());
[8319]400        if (similarityCalculator != null) SimilarityCalculatorParameter.Value = similarityCalculator;
401        else oldSimilarityCalculator = null;
[7789]402      }
[8319]403      if (oldSimilarityCalculator == null && defaultSimilarityCalculator != null)
404        SimilarityCalculatorParameter.Value = defaultSimilarityCalculator;
[7789]405    }
406    private void ParameterizeBestSelector() {
407      OperatorGraph.Operators.OfType<ISingleObjectiveSelector>()
408                             .First().QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
409    }
410    private void ParameterizeSolutionsCreator() {
411      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
412      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
413    }
414    private void ParameterizeMainLoop() {
415      if (Problem != null && Improver != null) {
416        MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
417        MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
418        MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
[8319]419        MainLoop.OperatorGraph.Operators.OfType<PopulationRebuildMethod>().Single().QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
420        MainLoop.OperatorGraph.Operators.OfType<SolutionPoolUpdateMethod>().Single().QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
[8086]421        foreach (ISimilarityBasedOperator op in MainLoop.OperatorGraph.Operators.OfType<ISimilarityBasedOperator>())
422          op.SimilarityCalculator = SimilarityCalculator;
[7789]423      }
424    }
425    private void ParameterizeStochasticOperator(IOperator op) {
426      if (op is IStochasticOperator) {
427        IStochasticOperator stOp = (IStochasticOperator)op;
428        stOp.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
429        stOp.RandomParameter.Hidden = true;
430      }
431    }
432    private void ParameterizeAnalyzers() {
433      qualityAnalyzer.ResultsParameter.ActualName = "Results";
434      qualityAnalyzer.ResultsParameter.Hidden = true;
435      if (Problem != null) {
436        qualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
437        qualityAnalyzer.MaximizationParameter.Hidden = true;
438        qualityAnalyzer.QualityParameter.Hidden = false;
439        qualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
440        qualityAnalyzer.BestKnownQualityParameter.Hidden = true;
441      } else {
442        qualityAnalyzer.MaximizationParameter.Hidden = false;
443        qualityAnalyzer.BestKnownQualityParameter.Hidden = false;
444      }
445    }
[8628]446    private void ParameterizeSimilarityCalculators() {
447      foreach (ISingleObjectiveSolutionSimilarityCalculator calc in SimilarityCalculatorParameter.ValidValues) {
448        calc.QualityVariableName = Problem.Evaluator.QualityParameter.ActualName;
449      }
450    }
[7789]451    private ScatterSearchMainLoop FindMainLoop(IOperator start) {
452      IOperator mainLoop = start;
453      while (mainLoop != null && !(mainLoop is ScatterSearchMainLoop))
454        mainLoop = ((SingleSuccessorOperator)mainLoop).Successor;
455      return mainLoop as ScatterSearchMainLoop;
456    }
457    #endregion
458  }
459}
Note: See TracBrowser for help on using the repository browser.