Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs @ 3658

Last change on this file since 3658 was 3658, checked in by swagner, 12 years ago

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

  • removed specific analyzer interfaces
  • adapted MultiAnalyzer
File size: 22.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28using HeuristicLab.Optimization;
29using HeuristicLab.Operators;
30using HeuristicLab.Optimization.Operators;
31using HeuristicLab.Parameters;
32using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
33using HeuristicLab.PluginInfrastructure;
34using HeuristicLab.Random;
35using HeuristicLab.Analysis;
36
37namespace HeuristicLab.Algorithms.TabuSearch {
38  [Item("Tabu Search", "A tabu search algorithm.")]
39  [Creatable("Algorithms")]
40  [StorableClass]
41  public sealed class TabuSearch : EngineAlgorithm {
42    #region Problem Properties
43    public override Type ProblemType {
44      get { return typeof(ISingleObjectiveProblem); }
45    }
46    public new ISingleObjectiveProblem Problem {
47      get { return (ISingleObjectiveProblem)base.Problem; }
48      set { base.Problem = value; }
49    }
50    #endregion
51
52    #region Parameter Properties
53    private ValueParameter<IntValue> SeedParameter {
54      get { return (ValueParameter<IntValue>)Parameters["Seed"]; }
55    }
56    private ValueParameter<BoolValue> SetSeedRandomlyParameter {
57      get { return (ValueParameter<BoolValue>)Parameters["SetSeedRandomly"]; }
58    }
59    private ConstrainedValueParameter<IMoveGenerator> MoveGeneratorParameter {
60      get { return (ConstrainedValueParameter<IMoveGenerator>)Parameters["MoveGenerator"]; }
61    }
62    private ConstrainedValueParameter<IMoveMaker> MoveMakerParameter {
63      get { return (ConstrainedValueParameter<IMoveMaker>)Parameters["MoveMaker"]; }
64    }
65    private ConstrainedValueParameter<ISingleObjectiveMoveEvaluator> MoveEvaluatorParameter {
66      get { return (ConstrainedValueParameter<ISingleObjectiveMoveEvaluator>)Parameters["MoveEvaluator"]; }
67    }
68    private ConstrainedValueParameter<ITabuChecker> TabuCheckerParameter {
69      get { return (ConstrainedValueParameter<ITabuChecker>)Parameters["TabuChecker"]; }
70    }
71    private ConstrainedValueParameter<ITabuMaker> TabuMakerParameter {
72      get { return (ConstrainedValueParameter<ITabuMaker>)Parameters["TabuMaker"]; }
73    }
74    private ValueParameter<IntValue> TabuTenureParameter {
75      get { return (ValueParameter<IntValue>)Parameters["TabuTenure"]; }
76    }
77    private ValueParameter<IntValue> MaximumIterationsParameter {
78      get { return (ValueParameter<IntValue>)Parameters["MaximumIterations"]; }
79    }
80    private ValueParameter<IntValue> SampleSizeParameter {
81      get { return (ValueParameter<IntValue>)Parameters["SampleSize"]; }
82    }
83    private ValueParameter<MultiAnalyzer> MoveAnalyzerParameter {
84      get { return (ValueParameter<MultiAnalyzer>)Parameters["MoveAnalyzer"]; }
85    }
86    private ValueParameter<MultiAnalyzer> AnalyzerParameter {
87      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
88    }
89    #endregion
90
91    #region Properties
92    public IntValue Seed {
93      get { return SeedParameter.Value; }
94      set { SeedParameter.Value = value; }
95    }
96    public BoolValue SetSeedRandomly {
97      get { return SetSeedRandomlyParameter.Value; }
98      set { SetSeedRandomlyParameter.Value = value; }
99    }
100    public IMoveGenerator MoveGenerator {
101      get { return MoveGeneratorParameter.Value; }
102      set { MoveGeneratorParameter.Value = value; }
103    }
104    public IMoveMaker MoveMaker {
105      get { return MoveMakerParameter.Value; }
106      set { MoveMakerParameter.Value = value; }
107    }
108    public ISingleObjectiveMoveEvaluator MoveEvaluator {
109      get { return MoveEvaluatorParameter.Value; }
110      set { MoveEvaluatorParameter.Value = value; }
111    }
112    public ITabuChecker TabuChecker {
113      get { return TabuCheckerParameter.Value; }
114      set { TabuCheckerParameter.Value = value; }
115    }
116    public ITabuMaker TabuMaker {
117      get { return TabuMakerParameter.Value; }
118      set { TabuMakerParameter.Value = value; }
119    }
120    public IntValue TabuTenure {
121      get { return TabuTenureParameter.Value; }
122      set { TabuTenureParameter.Value = value; }
123    }
124    public IntValue MaximumIterations {
125      get { return MaximumIterationsParameter.Value; }
126      set { MaximumIterationsParameter.Value = value; }
127    }
128    public MultiAnalyzer MoveAnalyzer {
129      get { return MoveAnalyzerParameter.Value; }
130      set { MoveAnalyzerParameter.Value = value; }
131    }
132    public MultiAnalyzer Analyzer {
133      get { return AnalyzerParameter.Value; }
134      set { AnalyzerParameter.Value = value; }
135    }
136    private RandomCreator RandomCreator {
137      get { return (RandomCreator)OperatorGraph.InitialOperator; }
138    }
139    private SolutionsCreator SolutionsCreator {
140      get { return (SolutionsCreator)RandomCreator.Successor; }
141    }
142    private TabuSearchMainLoop MainLoop {
143      get { return (TabuSearchMainLoop)SolutionsCreator.Successor; }
144    }
145    private PopulationBestAverageWorstQualityAnalyzer moveQualityAnalyzer;
146    private TabuNeighborhoodAnalyzer tabuNeighborhoodAnalyzer;
147    #endregion
148
149    public TabuSearch()
150      : base() {
151      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
152      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
153      Parameters.Add(new ConstrainedValueParameter<IMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution."));
154      Parameters.Add(new ConstrainedValueParameter<IMoveMaker>("MoveMaker", "The operator used to perform a move."));
155      Parameters.Add(new ConstrainedValueParameter<ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move."));
156      Parameters.Add(new ConstrainedValueParameter<ITabuChecker>("TabuChecker", "The operator to check whether a move is tabu or not."));
157      Parameters.Add(new ConstrainedValueParameter<ITabuMaker>("TabuMaker", "The operator used to insert attributes of a move into the tabu list."));
158      Parameters.Add(new ValueParameter<IntValue>("TabuTenure", "The length of the tabu list.", new IntValue(10)));
159      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000)));
160      Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The neighborhood size for stochastic sampling move generators", new IntValue(100)));
161      Parameters.Add(new ValueParameter<MultiAnalyzer>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer()));
162      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer()));
163     
164      RandomCreator randomCreator = new RandomCreator();
165      SolutionsCreator solutionsCreator = new SolutionsCreator();
166      TabuSearchMainLoop tsMainLoop = new TabuSearchMainLoop();
167      OperatorGraph.InitialOperator = randomCreator;
168
169      randomCreator.RandomParameter.ActualName = "Random";
170      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
171      randomCreator.SeedParameter.Value = null;
172      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
173      randomCreator.SetSeedRandomlyParameter.Value = null;
174      randomCreator.Successor = solutionsCreator;
175
176      solutionsCreator.NumberOfSolutions = new IntValue(1);
177      solutionsCreator.Successor = tsMainLoop;
178
179      tsMainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name;
180      tsMainLoop.MoveMakerParameter.ActualName = MoveMakerParameter.Name;
181      tsMainLoop.MoveEvaluatorParameter.ActualName = MoveEvaluatorParameter.Name;
182      tsMainLoop.TabuCheckerParameter.ActualName = TabuCheckerParameter.Name;
183      tsMainLoop.TabuMakerParameter.ActualName = TabuMakerParameter.Name;
184      tsMainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
185      tsMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
186      tsMainLoop.ResultsParameter.ActualName = "Results";
187      tsMainLoop.MoveAnalyzerParameter.ActualName = MoveAnalyzerParameter.Name;
188      tsMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
189
190      Initialize();
191    }
192    [StorableConstructor]
193    private TabuSearch(bool deserializing) : base(deserializing) { }
194
195    public override IDeepCloneable Clone(Cloner cloner) {
196      TabuSearch clone = (TabuSearch)base.Clone(cloner);
197      clone.Initialize();
198      return clone;
199    }
200
201    public override void Prepare() {
202      if (Problem != null && MoveGenerator != null && MoveMaker != null && MoveEvaluator != null &&
203          TabuChecker != null && TabuMaker != null)
204        base.Prepare();
205    }
206
207    #region Events
208    protected override void OnProblemChanged() {
209      ParameterizeStochasticOperator(Problem.SolutionCreator);
210      ParameterizeStochasticOperator(Problem.Evaluator);
211      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
212      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
213        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
214      }
215      foreach (ITabuChecker op in Problem.Operators.OfType<ITabuChecker>()) {
216        op.MoveTabuParameter.ActualNameChanged += new EventHandler(TabuChecker_MoveTabuParameter_ActualNameChanged);
217      }
218      ParameterizeSolutionsCreator();
219      ParameterizeMainLoop();
220      UpdateMoveGenerator();
221      UpdateMoveParameters();
222      UpdateAnalyzers();
223      ParameterizeMoveGenerators();
224      ParameterizeMoveEvaluator();
225      ParameterizeMoveMaker();
226      ParameterizeTabuMaker();
227      ParameterizeTabuChecker();
228      ParameterizeAnalyzers();
229      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
230      base.OnProblemChanged();
231    }
232    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
233      ParameterizeStochasticOperator(Problem.SolutionCreator);
234      ParameterizeSolutionsCreator();
235      base.Problem_SolutionCreatorChanged(sender, e);
236    }
237    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
238      ParameterizeStochasticOperator(Problem.Evaluator);
239      ParameterizeSolutionsCreator();
240      ParameterizeMainLoop();
241      ParameterizeMoveEvaluator();
242      ParameterizeMoveMaker();
243      ParameterizeTabuMaker();
244      ParameterizeTabuChecker();
245      ParameterizeAnalyzers();
246      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
247      base.Problem_EvaluatorChanged(sender, e);
248    }
249    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
250      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
251      // This may seem pointless, but some operators already have the eventhandler registered, others don't
252      // FIXME: Is there another way to solve this problem?
253      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
254        op.MoveQualityParameter.ActualNameChanged -= new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
255        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
256      }
257      foreach (ITabuChecker op in Problem.Operators.OfType<ITabuChecker>()) {
258        op.MoveTabuParameter.ActualNameChanged -= new EventHandler(TabuChecker_MoveTabuParameter_ActualNameChanged);
259        op.MoveTabuParameter.ActualNameChanged += new EventHandler(TabuChecker_MoveTabuParameter_ActualNameChanged);
260      }
261      UpdateMoveGenerator();
262      UpdateMoveParameters();
263      UpdateAnalyzers();
264      ParameterizeMainLoop();
265      ParameterizeMoveGenerators();
266      ParameterizeMoveEvaluator();
267      ParameterizeMoveMaker();
268      ParameterizeTabuMaker();
269      ParameterizeTabuChecker();
270      ParameterizeAnalyzers();
271      base.Problem_OperatorsChanged(sender, e);
272    }
273    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
274      ParameterizeMainLoop();
275      ParameterizeMoveEvaluator();
276      ParameterizeMoveMaker();
277      ParameterizeTabuMaker();
278      ParameterizeTabuChecker();
279    }
280    private void MoveGeneratorParameter_ValueChanged(object sender, EventArgs e) {
281      UpdateMoveParameters();
282    }
283    private void MoveEvaluatorParameter_ValueChanged(object sender, EventArgs e) {
284      ParameterizeMainLoop();
285      ParameterizeMoveEvaluator();
286      ParameterizeMoveMaker();
287      ParameterizeTabuMaker();
288      ParameterizeTabuChecker();
289      ParameterizeAnalyzers();
290    }
291    private void MoveEvaluator_MoveQualityParameter_ActualNameChanged(object sender, EventArgs e) {
292      ParameterizeMainLoop();
293      ParameterizeMoveEvaluator();
294      ParameterizeMoveMaker();
295      ParameterizeTabuMaker();
296      ParameterizeTabuChecker();
297      ParameterizeAnalyzers();
298    }
299    private void TabuCheckerParameter_ValueChanged(object sender, EventArgs e) {
300      ParameterizeMainLoop();
301      ParameterizeAnalyzers();
302    }
303    private void TabuChecker_MoveTabuParameter_ActualNameChanged(object sender, EventArgs e) {
304      ParameterizeMainLoop();
305      ParameterizeAnalyzers();
306    }
307    private void SampleSizeParameter_NameChanged(object sender, EventArgs e) {
308      ParameterizeMoveGenerators();
309    }
310    #endregion
311
312    #region Helpers
313    [StorableHook(HookType.AfterDeserialization)]
314    private void Initialize() {
315      InitializeAnalyzers();
316      UpdateAnalyzers();
317      if (Problem != null) {
318        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
319        foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
320          op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
321        }
322      }
323      MoveGeneratorParameter.ValueChanged += new EventHandler(MoveGeneratorParameter_ValueChanged);
324      MoveEvaluatorParameter.ValueChanged += new EventHandler(MoveEvaluatorParameter_ValueChanged);
325      TabuCheckerParameter.ValueChanged += new EventHandler(TabuCheckerParameter_ValueChanged);
326      SampleSizeParameter.NameChanged += new EventHandler(SampleSizeParameter_NameChanged);
327    }
328    private void InitializeAnalyzers() {
329      moveQualityAnalyzer = new PopulationBestAverageWorstQualityAnalyzer();
330      tabuNeighborhoodAnalyzer = new TabuNeighborhoodAnalyzer();
331      ParameterizeAnalyzers();
332    }
333    private void UpdateMoveGenerator() {
334      IMoveGenerator oldMoveGenerator = MoveGenerator;
335      MoveGeneratorParameter.ValidValues.Clear();
336      if (Problem != null) {
337        foreach (IMoveGenerator generator in Problem.Operators.OfType<IMoveGenerator>().OrderBy(x => x.Name)) {
338          MoveGeneratorParameter.ValidValues.Add(generator);
339        }
340      }
341      if (oldMoveGenerator != null && MoveGeneratorParameter.ValidValues.Any(x => x.GetType() == oldMoveGenerator.GetType()))
342        MoveGenerator = MoveGeneratorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveGenerator.GetType());
343      if (MoveGenerator == null) {
344        ClearMoveParameters();
345      }
346    }
347    private void UpdateMoveParameters() {
348      IMoveMaker oldMoveMaker = MoveMaker;
349      ISingleObjectiveMoveEvaluator oldMoveEvaluator = MoveEvaluator;
350      ITabuChecker oldTabuMoveEvaluator = TabuChecker;
351      ITabuMaker oldTabuMoveMaker = TabuMaker;
352      ClearMoveParameters();
353      if (MoveGenerator != null) {
354        List<Type> moveTypes = MoveGenerator.GetType().GetInterfaces().Where(x => typeof(IMoveOperator).IsAssignableFrom(x)).ToList();
355        foreach (Type type in moveTypes.ToList()) {
356          if (moveTypes.Any(t => t != type && type.IsAssignableFrom(t)))
357            moveTypes.Remove(type);
358        }
359        foreach (Type type in moveTypes) {
360          var operators = Problem.Operators.Where(x => type.IsAssignableFrom(x.GetType())).OrderBy(x => x.Name);
361          foreach (IMoveMaker moveMaker in operators.OfType<IMoveMaker>())
362            MoveMakerParameter.ValidValues.Add(moveMaker);
363          foreach (ISingleObjectiveMoveEvaluator moveEvaluator in operators.OfType<ISingleObjectiveMoveEvaluator>())
364            MoveEvaluatorParameter.ValidValues.Add(moveEvaluator);
365          foreach (ITabuChecker tabuMoveEvaluator in operators.OfType<ITabuChecker>())
366            TabuCheckerParameter.ValidValues.Add(tabuMoveEvaluator);
367          foreach (ITabuMaker tabuMoveMaker in operators.OfType<ITabuMaker>())
368            TabuMakerParameter.ValidValues.Add(tabuMoveMaker);
369        }
370        if (oldMoveMaker != null) {
371          IMoveMaker mm = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType());
372          if (mm != null) MoveMaker = mm;
373        }
374        if (oldMoveEvaluator != null) {
375          ISingleObjectiveMoveEvaluator me = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType());
376          if (me != null) MoveEvaluator = me;
377        }
378        if (oldTabuMoveMaker != null) {
379          ITabuMaker tmm = TabuMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveMaker.GetType());
380          if (tmm != null) TabuMaker = tmm;
381        }
382        if (oldTabuMoveEvaluator != null) {
383          ITabuChecker tme = TabuCheckerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveEvaluator.GetType());
384          if (tme != null) TabuChecker = tme;
385        }
386      }
387    }
388    private void UpdateAnalyzers() {
389      Analyzer.Operators.Clear();
390      MoveAnalyzer.Operators.Clear();
391      MoveAnalyzer.Operators.Add(moveQualityAnalyzer);
392      MoveAnalyzer.Operators.Add(tabuNeighborhoodAnalyzer);
393      if (Problem != null) {
394        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name))
395          Analyzer.Operators.Add(analyzer);
396      }
397    }
398    private void ClearMoveParameters() {
399      MoveMakerParameter.ValidValues.Clear();
400      MoveEvaluatorParameter.ValidValues.Clear();
401      TabuCheckerParameter.ValidValues.Clear();
402      TabuMakerParameter.ValidValues.Clear();
403    }
404    private void ParameterizeSolutionsCreator() {
405      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
406      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
407    }
408    private void ParameterizeMainLoop() {
409      MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
410      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
411      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
412      if (MoveEvaluator != null)
413        MainLoop.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
414      if (TabuChecker != null)
415        MainLoop.MoveTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName;
416    }
417    private void ParameterizeStochasticOperator(IOperator op) {
418      if (op is IStochasticOperator)
419        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
420    }
421    private void ParameterizeMoveGenerators() {
422      if (Problem != null) {
423        foreach (IMultiMoveGenerator generator in Problem.Operators.OfType<IMultiMoveGenerator>())
424          generator.SampleSizeParameter.ActualName = SampleSizeParameter.Name;
425      }
426    }
427    private void ParameterizeMoveEvaluator() {
428      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
429        op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
430      }
431    }
432    private void ParameterizeMoveMaker() {
433      foreach (IMoveMaker op in Problem.Operators.OfType<IMoveMaker>()) {
434        op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
435        if (MoveEvaluator != null)
436          op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
437      }
438    }
439    private void ParameterizeTabuMaker() {
440      foreach (ITabuMaker op in Problem.Operators.OfType<ITabuMaker>()) {
441        op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
442        if (MoveEvaluator != null)
443          op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
444      }
445    }
446    private void ParameterizeTabuChecker() {
447      foreach (ITabuChecker op in Problem.Operators.OfType<ITabuChecker>()) {
448        if (MoveEvaluator != null)
449          op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
450        if (TabuChecker != null)
451          op.MoveTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName;
452      }
453    }
454    private void ParameterizeAnalyzers() {
455      moveQualityAnalyzer.ResultsParameter.ActualName = "Results";
456      tabuNeighborhoodAnalyzer.ResultsParameter.ActualName = "Results";
457      tabuNeighborhoodAnalyzer.PercentTabuParameter.ActualName = "PercentTabu";
458      if (Problem != null) {
459        moveQualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
460        if (MoveEvaluator != null)
461          moveQualityAnalyzer.QualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
462        moveQualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
463        if (TabuChecker != null)
464          tabuNeighborhoodAnalyzer.IsTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName;
465      }
466    }
467    #endregion
468  }
469}
Note: See TracBrowser for help on using the repository browser.