Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 3694 was 3689, checked in by abeham, 15 years ago

#893

  • fixed wiring in the algorithms
File size: 22.9 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    [Storable]
146    private BestAverageWorstQualityAnalyzer moveQualityAnalyzer;
147    [Storable]
148    private TabuNeighborhoodAnalyzer tabuNeighborhoodAnalyzer;
149    #endregion
150
151    public TabuSearch()
152      : base() {
153      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
154      Parameters.Add(new ValueParameter<BoolValue>("SetSeedRandomly", "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true)));
155      Parameters.Add(new ConstrainedValueParameter<IMoveGenerator>("MoveGenerator", "The operator used to generate moves to the neighborhood of the current solution."));
156      Parameters.Add(new ConstrainedValueParameter<IMoveMaker>("MoveMaker", "The operator used to perform a move."));
157      Parameters.Add(new ConstrainedValueParameter<ISingleObjectiveMoveEvaluator>("MoveEvaluator", "The operator used to evaluate a move."));
158      Parameters.Add(new ConstrainedValueParameter<ITabuChecker>("TabuChecker", "The operator to check whether a move is tabu or not."));
159      Parameters.Add(new ConstrainedValueParameter<ITabuMaker>("TabuMaker", "The operator used to insert attributes of a move into the tabu list."));
160      Parameters.Add(new ValueParameter<IntValue>("TabuTenure", "The length of the tabu list.", new IntValue(10)));
161      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000)));
162      Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The neighborhood size for stochastic sampling move generators", new IntValue(100)));
163      Parameters.Add(new ValueParameter<MultiAnalyzer>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer()));
164      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer()));
165     
166      RandomCreator randomCreator = new RandomCreator();
167      SolutionsCreator solutionsCreator = new SolutionsCreator();
168      TabuSearchMainLoop tsMainLoop = new TabuSearchMainLoop();
169      OperatorGraph.InitialOperator = randomCreator;
170
171      randomCreator.RandomParameter.ActualName = "Random";
172      randomCreator.SeedParameter.ActualName = SeedParameter.Name;
173      randomCreator.SeedParameter.Value = null;
174      randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameter.Name;
175      randomCreator.SetSeedRandomlyParameter.Value = null;
176      randomCreator.Successor = solutionsCreator;
177
178      solutionsCreator.NumberOfSolutions = new IntValue(1);
179      solutionsCreator.Successor = tsMainLoop;
180
181      tsMainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name;
182      tsMainLoop.MoveMakerParameter.ActualName = MoveMakerParameter.Name;
183      tsMainLoop.MoveEvaluatorParameter.ActualName = MoveEvaluatorParameter.Name;
184      tsMainLoop.TabuCheckerParameter.ActualName = TabuCheckerParameter.Name;
185      tsMainLoop.TabuMakerParameter.ActualName = TabuMakerParameter.Name;
186      tsMainLoop.MaximumIterationsParameter.ActualName = MaximumIterationsParameter.Name;
187      tsMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
188      tsMainLoop.ResultsParameter.ActualName = "Results";
189      tsMainLoop.MoveAnalyzerParameter.ActualName = MoveAnalyzerParameter.Name;
190      tsMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
191
192      moveQualityAnalyzer = new BestAverageWorstQualityAnalyzer();
193      tabuNeighborhoodAnalyzer = new TabuNeighborhoodAnalyzer();
194      ParameterizeAnalyzers();
195      UpdateAnalyzers();
196
197      Initialize();
198    }
199    [StorableConstructor]
200    private TabuSearch(bool deserializing) : base(deserializing) { }
201
202    public override IDeepCloneable Clone(Cloner cloner) {
203      TabuSearch clone = (TabuSearch)base.Clone(cloner);
204      clone.moveQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(moveQualityAnalyzer);
205      clone.tabuNeighborhoodAnalyzer = (TabuNeighborhoodAnalyzer)cloner.Clone(tabuNeighborhoodAnalyzer);
206      clone.Initialize();
207      return clone;
208    }
209
210    public override void Prepare() {
211      if (Problem != null && MoveGenerator != null && MoveMaker != null && MoveEvaluator != null &&
212          TabuChecker != null && TabuMaker != null)
213        base.Prepare();
214    }
215
216    #region Events
217    protected override void OnProblemChanged() {
218      ParameterizeStochasticOperator(Problem.SolutionCreator);
219      ParameterizeStochasticOperator(Problem.Evaluator);
220      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
221      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
222        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
223      }
224      foreach (ITabuChecker op in Problem.Operators.OfType<ITabuChecker>()) {
225        op.MoveTabuParameter.ActualNameChanged += new EventHandler(TabuChecker_MoveTabuParameter_ActualNameChanged);
226      }
227      ParameterizeSolutionsCreator();
228      ParameterizeMainLoop();
229      UpdateMoveGenerator();
230      UpdateMoveParameters();
231      UpdateAnalyzers();
232      ParameterizeMoveGenerators();
233      ParameterizeMoveEvaluator();
234      ParameterizeMoveMaker();
235      ParameterizeTabuMaker();
236      ParameterizeTabuChecker();
237      ParameterizeAnalyzers();
238      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
239      base.OnProblemChanged();
240    }
241    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
242      ParameterizeStochasticOperator(Problem.SolutionCreator);
243      ParameterizeSolutionsCreator();
244      base.Problem_SolutionCreatorChanged(sender, e);
245    }
246    protected override void Problem_EvaluatorChanged(object sender, EventArgs e) {
247      ParameterizeStochasticOperator(Problem.Evaluator);
248      ParameterizeSolutionsCreator();
249      ParameterizeMainLoop();
250      ParameterizeMoveEvaluator();
251      ParameterizeMoveMaker();
252      ParameterizeTabuMaker();
253      ParameterizeTabuChecker();
254      ParameterizeAnalyzers();
255      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
256      base.Problem_EvaluatorChanged(sender, e);
257    }
258    protected override void Problem_OperatorsChanged(object sender, EventArgs e) {
259      foreach (IOperator op in Problem.Operators) ParameterizeStochasticOperator(op);
260      // This may seem pointless, but some operators already have the eventhandler registered, others don't
261      // FIXME: Is there another way to solve this problem?
262      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
263        op.MoveQualityParameter.ActualNameChanged -= new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
264        op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
265      }
266      foreach (ITabuChecker op in Problem.Operators.OfType<ITabuChecker>()) {
267        op.MoveTabuParameter.ActualNameChanged -= new EventHandler(TabuChecker_MoveTabuParameter_ActualNameChanged);
268        op.MoveTabuParameter.ActualNameChanged += new EventHandler(TabuChecker_MoveTabuParameter_ActualNameChanged);
269      }
270      UpdateMoveGenerator();
271      UpdateMoveParameters();
272      UpdateAnalyzers();
273      ParameterizeMainLoop();
274      ParameterizeMoveGenerators();
275      ParameterizeMoveEvaluator();
276      ParameterizeMoveMaker();
277      ParameterizeTabuMaker();
278      ParameterizeTabuChecker();
279      ParameterizeAnalyzers();
280      base.Problem_OperatorsChanged(sender, e);
281    }
282    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
283      ParameterizeMainLoop();
284      ParameterizeMoveEvaluator();
285      ParameterizeMoveMaker();
286      ParameterizeTabuMaker();
287      ParameterizeTabuChecker();
288    }
289    private void MoveGeneratorParameter_ValueChanged(object sender, EventArgs e) {
290      UpdateMoveParameters();
291    }
292    private void MoveEvaluatorParameter_ValueChanged(object sender, EventArgs e) {
293      ParameterizeMainLoop();
294      ParameterizeMoveEvaluator();
295      ParameterizeMoveMaker();
296      ParameterizeTabuMaker();
297      ParameterizeTabuChecker();
298      ParameterizeAnalyzers();
299    }
300    private void MoveEvaluator_MoveQualityParameter_ActualNameChanged(object sender, EventArgs e) {
301      ParameterizeMainLoop();
302      ParameterizeMoveEvaluator();
303      ParameterizeMoveMaker();
304      ParameterizeTabuMaker();
305      ParameterizeTabuChecker();
306      ParameterizeAnalyzers();
307    }
308    private void TabuCheckerParameter_ValueChanged(object sender, EventArgs e) {
309      ParameterizeMainLoop();
310      ParameterizeAnalyzers();
311    }
312    private void TabuChecker_MoveTabuParameter_ActualNameChanged(object sender, EventArgs e) {
313      ParameterizeMainLoop();
314      ParameterizeAnalyzers();
315    }
316    private void SampleSizeParameter_NameChanged(object sender, EventArgs e) {
317      ParameterizeMoveGenerators();
318    }
319    #endregion
320
321    #region Helpers
322    [StorableHook(HookType.AfterDeserialization)]
323    private void Initialize() {
324      if (Problem != null) {
325        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
326        foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
327          op.MoveQualityParameter.ActualNameChanged += new EventHandler(MoveEvaluator_MoveQualityParameter_ActualNameChanged);
328        }
329      }
330      MoveGeneratorParameter.ValueChanged += new EventHandler(MoveGeneratorParameter_ValueChanged);
331      MoveEvaluatorParameter.ValueChanged += new EventHandler(MoveEvaluatorParameter_ValueChanged);
332      TabuCheckerParameter.ValueChanged += new EventHandler(TabuCheckerParameter_ValueChanged);
333      SampleSizeParameter.NameChanged += new EventHandler(SampleSizeParameter_NameChanged);
334    }
335    private void UpdateMoveGenerator() {
336      IMoveGenerator oldMoveGenerator = MoveGenerator;
337      MoveGeneratorParameter.ValidValues.Clear();
338      if (Problem != null) {
339        foreach (IMoveGenerator generator in Problem.Operators.OfType<IMoveGenerator>().OrderBy(x => x.Name)) {
340          MoveGeneratorParameter.ValidValues.Add(generator);
341        }
342      }
343      if (oldMoveGenerator != null && MoveGeneratorParameter.ValidValues.Any(x => x.GetType() == oldMoveGenerator.GetType()))
344        MoveGenerator = MoveGeneratorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveGenerator.GetType());
345      if (MoveGenerator == null) {
346        ClearMoveParameters();
347      }
348    }
349    private void UpdateMoveParameters() {
350      IMoveMaker oldMoveMaker = MoveMaker;
351      ISingleObjectiveMoveEvaluator oldMoveEvaluator = MoveEvaluator;
352      ITabuChecker oldTabuMoveEvaluator = TabuChecker;
353      ITabuMaker oldTabuMoveMaker = TabuMaker;
354      ClearMoveParameters();
355      if (MoveGenerator != null) {
356        List<Type> moveTypes = MoveGenerator.GetType().GetInterfaces().Where(x => typeof(IMoveOperator).IsAssignableFrom(x)).ToList();
357        foreach (Type type in moveTypes.ToList()) {
358          if (moveTypes.Any(t => t != type && type.IsAssignableFrom(t)))
359            moveTypes.Remove(type);
360        }
361        foreach (Type type in moveTypes) {
362          var operators = Problem.Operators.Where(x => type.IsAssignableFrom(x.GetType())).OrderBy(x => x.Name);
363          foreach (IMoveMaker moveMaker in operators.OfType<IMoveMaker>())
364            MoveMakerParameter.ValidValues.Add(moveMaker);
365          foreach (ISingleObjectiveMoveEvaluator moveEvaluator in operators.OfType<ISingleObjectiveMoveEvaluator>())
366            MoveEvaluatorParameter.ValidValues.Add(moveEvaluator);
367          foreach (ITabuChecker tabuMoveEvaluator in operators.OfType<ITabuChecker>())
368            TabuCheckerParameter.ValidValues.Add(tabuMoveEvaluator);
369          foreach (ITabuMaker tabuMoveMaker in operators.OfType<ITabuMaker>())
370            TabuMakerParameter.ValidValues.Add(tabuMoveMaker);
371        }
372        if (oldMoveMaker != null) {
373          IMoveMaker mm = MoveMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveMaker.GetType());
374          if (mm != null) MoveMaker = mm;
375        }
376        if (oldMoveEvaluator != null) {
377          ISingleObjectiveMoveEvaluator me = MoveEvaluatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMoveEvaluator.GetType());
378          if (me != null) MoveEvaluator = me;
379        }
380        if (oldTabuMoveMaker != null) {
381          ITabuMaker tmm = TabuMakerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveMaker.GetType());
382          if (tmm != null) TabuMaker = tmm;
383        }
384        if (oldTabuMoveEvaluator != null) {
385          ITabuChecker tme = TabuCheckerParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldTabuMoveEvaluator.GetType());
386          if (tme != null) TabuChecker = tme;
387        }
388      }
389    }
390    private void UpdateAnalyzers() {
391      Analyzer.Operators.Clear();
392      MoveAnalyzer.Operators.Clear();
393      MoveAnalyzer.Operators.Add(moveQualityAnalyzer);
394      MoveAnalyzer.Operators.Add(tabuNeighborhoodAnalyzer);
395      if (Problem != null) {
396        foreach (IAnalyzer analyzer in Problem.Operators.OfType<IAnalyzer>().OrderBy(x => x.Name)) {
397          foreach (IScopeTreeLookupParameter param in analyzer.Parameters.OfType<IScopeTreeLookupParameter>())
398            param.Depth = 0;
399          Analyzer.Operators.Add(analyzer);
400        }
401      }
402    }
403    private void ClearMoveParameters() {
404      MoveMakerParameter.ValidValues.Clear();
405      MoveEvaluatorParameter.ValidValues.Clear();
406      TabuCheckerParameter.ValidValues.Clear();
407      TabuMakerParameter.ValidValues.Clear();
408    }
409    private void ParameterizeSolutionsCreator() {
410      SolutionsCreator.EvaluatorParameter.ActualName = Problem.EvaluatorParameter.Name;
411      SolutionsCreator.SolutionCreatorParameter.ActualName = Problem.SolutionCreatorParameter.Name;
412    }
413    private void ParameterizeMainLoop() {
414      MainLoop.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
415      MainLoop.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
416      MainLoop.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
417      if (MoveEvaluator != null)
418        MainLoop.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
419      if (TabuChecker != null)
420        MainLoop.MoveTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName;
421    }
422    private void ParameterizeStochasticOperator(IOperator op) {
423      if (op is IStochasticOperator)
424        ((IStochasticOperator)op).RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
425    }
426    private void ParameterizeMoveGenerators() {
427      if (Problem != null) {
428        foreach (IMultiMoveGenerator generator in Problem.Operators.OfType<IMultiMoveGenerator>())
429          generator.SampleSizeParameter.ActualName = SampleSizeParameter.Name;
430      }
431    }
432    private void ParameterizeMoveEvaluator() {
433      foreach (ISingleObjectiveMoveEvaluator op in Problem.Operators.OfType<ISingleObjectiveMoveEvaluator>()) {
434        op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
435      }
436    }
437    private void ParameterizeMoveMaker() {
438      foreach (IMoveMaker op in Problem.Operators.OfType<IMoveMaker>()) {
439        op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
440        if (MoveEvaluator != null)
441          op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
442      }
443    }
444    private void ParameterizeTabuMaker() {
445      foreach (ITabuMaker op in Problem.Operators.OfType<ITabuMaker>()) {
446        op.QualityParameter.ActualName = Problem.Evaluator.QualityParameter.ActualName;
447        if (MoveEvaluator != null)
448          op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
449      }
450    }
451    private void ParameterizeTabuChecker() {
452      foreach (ITabuChecker op in Problem.Operators.OfType<ITabuChecker>()) {
453        if (MoveEvaluator != null)
454          op.MoveQualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
455        if (TabuChecker != null)
456          op.MoveTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName;
457      }
458    }
459    private void ParameterizeAnalyzers() {
460      moveQualityAnalyzer.ResultsParameter.ActualName = "Results";
461      tabuNeighborhoodAnalyzer.ResultsParameter.ActualName = "Results";
462      tabuNeighborhoodAnalyzer.PercentTabuParameter.ActualName = "PercentTabu";
463      if (Problem != null) {
464        moveQualityAnalyzer.MaximizationParameter.ActualName = Problem.MaximizationParameter.Name;
465        if (MoveEvaluator != null)
466          moveQualityAnalyzer.QualityParameter.ActualName = MoveEvaluator.MoveQualityParameter.ActualName;
467        moveQualityAnalyzer.BestKnownQualityParameter.ActualName = Problem.BestKnownQualityParameter.Name;
468        if (TabuChecker != null)
469          tabuNeighborhoodAnalyzer.IsTabuParameter.ActualName = TabuChecker.MoveTabuParameter.ActualName;
470      }
471    }
472    #endregion
473  }
474}
Note: See TracBrowser for help on using the repository browser.