Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3636 for trunk


Ignore:
Timestamp:
05/05/10 14:52:19 (15 years ago)
Author:
abeham
Message:

#999

  • changes in LS
    • counting evaluated moves
    • tracking best quality which is needed by the algorithm
  • changes in TS
    • adapted to analyzer
    • added a neighborhood analyzer that shows what percentage of the neighborhood is tabu
Location:
trunk/sources
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearch.cs

    r3626 r3636  
    140140      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000)));
    141141      Parameters.Add(new ValueParameter<IntValue>("SampleSize", "Number of moves that MultiMoveGenerators should create. This is ignored for Exhaustive- and SingleMoveGenerators.", new IntValue(100)));
    142       Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("MoveAnalyzer", "The operator used to analyze the moves in each iteration.", new MultiAnalyzer<IPopulationAnalyzer>()));
    143       Parameters.Add(new ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>("Analyzer", "The operator used to analyze each iteration.", new MultiAnalyzer<ISolutionAnalyzer>()));
     142      Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer<IPopulationAnalyzer>()));
     143      Parameters.Add(new ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer<ISolutionAnalyzer>()));
    144144     
    145145      RandomCreator randomCreator = new RandomCreator();
     
    229229      ParameterizeMoveEvaluators();
    230230      ParameterizeMoveMakers();
     231      ParameterizeAnalyzers();
    231232      base.Problem_OperatorsChanged(sender, e);
    232233    }
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

    r3621 r3636  
    104104      Parameters.Add(new ValueLookupParameter<IOperator>("MoveEvaluator", "The operator that evaluates a move."));
    105105
    106       Parameters.Add(new ValueLookupParameter<IOperator>("MoveAnalyzer", "The operator used to analyze the moves in each iteration."));
    107       Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze each iteration."));
     106      Parameters.Add(new ValueLookupParameter<IOperator>("MoveAnalyzer", "The operator used to analyze the moves."));
     107      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution."));
    108108      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope which represents a population of solutions on which the TS should be applied."));
    109109      #endregion
     
    111111      #region Create operators
    112112      VariableCreator variableCreator = new VariableCreator();
     113      SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
     114      Assigner bestQualityInitializer = new Assigner();
     115      Placeholder analyzer1 = new Placeholder();
    113116      ResultsCollector resultsCollector1 = new ResultsCollector();
    114       UniformSubScopesProcessor uniformSubScopesProcessor0 = new UniformSubScopesProcessor();
    115       Placeholder analyzer1 = new Placeholder();
    116       UniformSubScopesProcessor mainProcessor = new UniformSubScopesProcessor();
     117      SubScopesProcessor mainProcessor = new SubScopesProcessor();
    117118      Placeholder moveGenerator = new Placeholder();
    118119      UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor();
    119120      Placeholder moveEvaluator = new Placeholder();
     121      IntCounter evaluatedMovesCounter = new IntCounter();
    120122      Placeholder moveAnalyzer = new Placeholder();
    121123      BestSelector bestSelector = new BestSelector();
    122124      RightReducer rightReducer = new RightReducer();
    123       UniformSubScopesProcessor moveMakingProcessor = new UniformSubScopesProcessor();
     125      SubScopesProcessor moveMakingProcessor = new SubScopesProcessor();
    124126      QualityComparator qualityComparator = new QualityComparator();
    125127      ConditionalBranch improvesQualityBranch = new ConditionalBranch();
    126128      Placeholder moveMaker = new Placeholder();
     129      Assigner bestQualityUpdater = new Assigner();
    127130      SubScopesRemover subScopesRemover = new SubScopesRemover();
    128131      IntCounter iterationsCounter = new IntCounter();
    129132      Comparator iterationsComparator = new Comparator();
     133      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     134      Placeholder analyzer2 = new Placeholder();
    130135      ResultsCollector resultsCollector2 = new ResultsCollector();
    131       UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
    132       Placeholder analyzer2 = new Placeholder();
    133136      ConditionalBranch iterationsTermination = new ConditionalBranch();
    134137
    135138      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    136 
    137       resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    138       resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
     139      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     140      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue(0)));
     141
     142      bestQualityInitializer.Name = "Initialize BestQuality";
     143      bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";
     144      bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name;
    139145
    140146      analyzer1.Name = "Analyzer (placeholder)";
    141147      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
    142148
    143       mainProcessor.Name = "Solution processor (UniformSubScopesProcessor)";
     149      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     150      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     151      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     152      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    144153
    145154      moveGenerator.Name = "MoveGenerator (placeholder)";
     
    148157      moveEvaluator.Name = "MoveEvaluator (placeholder)";
    149158      moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;
     159
     160      evaluatedMovesCounter.Name = "EvaluatedMoves + 1";
     161      evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves";
     162      evaluatedMovesCounter.Increment = new IntValue(1);
    150163
    151164      moveAnalyzer.Name = "MoveAnalyzer (placeholder)";
     
    157170      bestSelector.QualityParameter.ActualName = MoveQualityParameter.Name;
    158171
    159       moveMakingProcessor.Name = "MoveMaking processor (UniformSubScopesProcessor)";
    160 
    161172      qualityComparator.LeftSideParameter.ActualName = MoveQualityParameter.Name;
    162173      qualityComparator.RightSideParameter.ActualName = QualityParameter.Name;
     
    167178      moveMaker.Name = "MoveMaker (placeholder)";
    168179      moveMaker.OperatorParameter.ActualName = MoveMakerParameter.Name;
     180
     181      bestQualityUpdater.Name = "Update BestQuality";
     182      bestQualityUpdater.LeftSideParameter.ActualName = "BestQuality";
     183      bestQualityUpdater.RightSideParameter.ActualName = QualityParameter.Name;
    169184
    170185      subScopesRemover.RemoveAllSubScopes = true;
     
    180195      iterationsComparator.ResultParameter.ActualName = "Terminate";
    181196
    182       resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    183       resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    184 
    185197      analyzer2.Name = "Analyzer (placeholder)";
    186198      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
     199
     200      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     201      resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     202      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     203      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    187204
    188205      iterationsTermination.Name = "Iterations Termination Condition";
     
    192209      #region Create operator graph
    193210      OperatorGraph.InitialOperator = variableCreator;
    194       variableCreator.Successor = resultsCollector1;
    195       resultsCollector1.Successor = uniformSubScopesProcessor0;
    196       uniformSubScopesProcessor0.Operator = analyzer1;
    197       uniformSubScopesProcessor0.Successor = mainProcessor;
     211      variableCreator.Successor = subScopesProcessor0;
     212      subScopesProcessor0.Operators.Add(bestQualityInitializer);
     213      subScopesProcessor0.Successor = resultsCollector1;
     214      bestQualityInitializer.Successor = analyzer1;
    198215      analyzer1.Successor = null;
    199       mainProcessor.Operator = moveGenerator;
     216      resultsCollector1.Successor = mainProcessor;
     217      mainProcessor.Operators.Add(moveGenerator);
    200218      mainProcessor.Successor = iterationsCounter;
    201219      moveGenerator.Successor = moveEvaluationProcessor;
    202220      moveEvaluationProcessor.Operator = moveEvaluator;
    203221      moveEvaluationProcessor.Successor = moveAnalyzer;
     222      moveEvaluator.Successor = evaluatedMovesCounter;
     223      evaluatedMovesCounter.Successor = null;
    204224      moveAnalyzer.Successor = bestSelector;
    205225      bestSelector.Successor = rightReducer;
    206226      rightReducer.Successor = moveMakingProcessor;
    207       moveMakingProcessor.Operator = qualityComparator;
     227      moveMakingProcessor.Operators.Add(qualityComparator);
    208228      moveMakingProcessor.Successor = subScopesRemover;
    209229      subScopesRemover.Successor = null;
     
    212232      improvesQualityBranch.FalseBranch = null;
    213233      improvesQualityBranch.Successor = null;
    214       moveMaker.Successor = null;
     234      moveMaker.Successor = bestQualityUpdater;
     235      bestQualityUpdater.Successor = null;
    215236      iterationsCounter.Successor = iterationsComparator;
    216       iterationsComparator.Successor = resultsCollector2;
    217       resultsCollector2.Successor = uniformSubScopesProcessor1;
    218       uniformSubScopesProcessor1.Operator = analyzer2;
    219       uniformSubScopesProcessor1.Successor = iterationsTermination;
     237      iterationsComparator.Successor = subScopesProcessor1;
     238      subScopesProcessor1.Operators.Add(analyzer2);
     239      subScopesProcessor1.Successor = resultsCollector2;
    220240      analyzer2.Successor = null;
     241      resultsCollector2.Successor = iterationsTermination;
    221242      iterationsTermination.TrueBranch = null;
    222243      iterationsTermination.FalseBranch = mainProcessor;
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/HeuristicLab.Algorithms.TabuSearch-3.3.csproj

    r3384 r3636  
    8686      <SubType>Code</SubType>
    8787    </Compile>
     88    <Compile Include="TabuNeighborhoodAnalyzer.cs" />
    8889    <Compile Include="TabuSelector.cs">
    8990      <SubType>Code</SubType>
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearch.cs

    r3616 r3636  
    3333using HeuristicLab.PluginInfrastructure;
    3434using HeuristicLab.Random;
     35using HeuristicLab.Analysis;
    3536
    3637namespace HeuristicLab.Algorithms.TabuSearch {
     
    8081      get { return (ValueParameter<IntValue>)Parameters["SampleSize"]; }
    8182    }
     83    private ValueParameter<MultiAnalyzer<IPopulationAnalyzer>> MoveAnalyzerParameter {
     84      get { return (ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>)Parameters["MoveAnalyzer"]; }
     85    }
     86    private ValueParameter<MultiAnalyzer<ISolutionAnalyzer>> AnalyzerParameter {
     87      get { return (ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>)Parameters["Analyzer"]; }
     88    }
    8289    #endregion
    8390
     
    119126      set { MaximumIterationsParameter.Value = value; }
    120127    }
     128    public MultiAnalyzer<IPopulationAnalyzer> MoveAnalyzer {
     129      get { return MoveAnalyzerParameter.Value; }
     130      set { MoveAnalyzerParameter.Value = value; }
     131    }
     132    public MultiAnalyzer<ISolutionAnalyzer> Analyzer {
     133      get { return AnalyzerParameter.Value; }
     134      set { AnalyzerParameter.Value = value; }
     135    }
    121136    private RandomCreator RandomCreator {
    122137      get { return (RandomCreator)OperatorGraph.InitialOperator; }
     
    128143      get { return (TabuSearchMainLoop)SolutionsCreator.Successor; }
    129144    }
     145    private PopulationBestAverageWorstQualityAnalyzer moveQualityAnalyzer;
     146    private TabuNeighborhoodAnalyzer tabuNeighborhoodAnalyzer;
    130147    #endregion
    131148
     
    142159      Parameters.Add(new ValueParameter<IntValue>("MaximumIterations", "The maximum number of generations which should be processed.", new IntValue(1000)));
    143160      Parameters.Add(new ValueParameter<IntValue>("SampleSize", "The neighborhood size for stochastic sampling move generators", new IntValue(100)));
    144 
     161      Parameters.Add(new ValueParameter<MultiAnalyzer<IPopulationAnalyzer>>("MoveAnalyzer", "The operator used to analyze the moves.", new MultiAnalyzer<IPopulationAnalyzer>()));
     162      Parameters.Add(new ValueParameter<MultiAnalyzer<ISolutionAnalyzer>>("Analyzer", "The operator used to analyze the solution.", new MultiAnalyzer<ISolutionAnalyzer>()));
     163     
    145164      RandomCreator randomCreator = new RandomCreator();
    146165      SolutionsCreator solutionsCreator = new SolutionsCreator();
     
    166185      tsMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
    167186      tsMainLoop.ResultsParameter.ActualName = "Results";
     187      tsMainLoop.MoveAnalyzerParameter.ActualName = MoveAnalyzerParameter.Name;
     188      tsMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
    168189
    169190      Initialize();
     
    199220      UpdateMoveGenerator();
    200221      UpdateMoveParameters();
     222      UpdateAnalyzers();
    201223      ParameterizeMoveGenerators();
    202224      ParameterizeMoveEvaluator();
     
    204226      ParameterizeTabuMaker();
    205227      ParameterizeTabuChecker();
     228      ParameterizeAnalyzers();
    206229      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    207230      base.OnProblemChanged();
     
    220243      ParameterizeTabuMaker();
    221244      ParameterizeTabuChecker();
     245      ParameterizeAnalyzers();
    222246      Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    223247      base.Problem_EvaluatorChanged(sender, e);
     
    237261      UpdateMoveGenerator();
    238262      UpdateMoveParameters();
     263      UpdateAnalyzers();
    239264      ParameterizeMainLoop();
    240265      ParameterizeMoveGenerators();
     
    243268      ParameterizeTabuMaker();
    244269      ParameterizeTabuChecker();
     270      ParameterizeAnalyzers();
    245271      base.Problem_OperatorsChanged(sender, e);
    246272    }
     
    261287      ParameterizeTabuMaker();
    262288      ParameterizeTabuChecker();
     289      ParameterizeAnalyzers();
    263290    }
    264291    private void MoveEvaluator_MoveQualityParameter_ActualNameChanged(object sender, EventArgs e) {
     
    268295      ParameterizeTabuMaker();
    269296      ParameterizeTabuChecker();
     297      ParameterizeAnalyzers();
    270298    }
    271299    private void TabuCheckerParameter_ValueChanged(object sender, EventArgs e) {
    272300      ParameterizeMainLoop();
     301      ParameterizeAnalyzers();
    273302    }
    274303    private void TabuChecker_MoveTabuParameter_ActualNameChanged(object sender, EventArgs e) {
    275304      ParameterizeMainLoop();
     305      ParameterizeAnalyzers();
    276306    }
    277307    private void SampleSizeParameter_NameChanged(object sender, EventArgs e) {
     
    283313    [StorableHook(HookType.AfterDeserialization)]
    284314    private void Initialize() {
     315      InitializeAnalyzers();
     316      UpdateAnalyzers();
    285317      if (Problem != null) {
    286318        Problem.Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
     
    293325      TabuCheckerParameter.ValueChanged += new EventHandler(TabuCheckerParameter_ValueChanged);
    294326      SampleSizeParameter.NameChanged += new EventHandler(SampleSizeParameter_NameChanged);
     327    }
     328    private void InitializeAnalyzers() {
     329      moveQualityAnalyzer = new PopulationBestAverageWorstQualityAnalyzer();
     330      tabuNeighborhoodAnalyzer = new TabuNeighborhoodAnalyzer();
     331      ParameterizeAnalyzers();
    295332    }
    296333    private void UpdateMoveGenerator() {
     
    349386      }
    350387    }
     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 (ISolutionAnalyzer analyzer in Problem.Operators.OfType<ISolutionAnalyzer>().OrderBy(x => x.Name))
     395          Analyzer.Operators.Add(analyzer);
     396      }
     397    }
    351398    private void ClearMoveParameters() {
    352399      MoveMakerParameter.ValidValues.Clear();
     
    405452      }
    406453    }
     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    }
    407467    #endregion
    408468  }
  • trunk/sources/HeuristicLab.Algorithms.TabuSearch/3.3/TabuSearchMainLoop.cs

    r3521 r3636  
    7777      get { return (ValueLookupParameter<IOperator>)Parameters["TabuMaker"]; }
    7878    }
    79     public ValueLookupParameter<IOperator> VisualizerParameter {
    80       get { return (ValueLookupParameter<IOperator>)Parameters["Visualizer"]; }
    81     }
    82     public LookupParameter<IItem> VisualizationParameter {
    83       get { return (LookupParameter<IItem>)Parameters["Visualization"]; }
     79    public ValueLookupParameter<IOperator> MoveAnalyzerParameter {
     80      get { return (ValueLookupParameter<IOperator>)Parameters["MoveAnalyzer"]; }
     81    }
     82    public ValueLookupParameter<IOperator> AnalyzerParameter {
     83      get { return (ValueLookupParameter<IOperator>)Parameters["Analyzer"]; }
    8484    }
    8585    public ValueLookupParameter<VariableCollection> ResultsParameter {
     
    112112      Parameters.Add(new ValueLookupParameter<IOperator>("TabuMaker", "The operator that declares a move tabu."));
    113113
    114       Parameters.Add(new ValueLookupParameter<IOperator>("Visualizer", "The operator used to visualize solutions."));
    115       Parameters.Add(new LookupParameter<IItem>("Visualization", "The item which represents the visualization of solutions."));
     114      Parameters.Add(new ValueLookupParameter<IOperator>("MoveAnalyzer", "The operator used to analyze the moves."));
     115      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to analyze the solution."));
    116116      Parameters.Add(new ValueLookupParameter<VariableCollection>("Results", "The variable collection where results should be stored."));
    117117      #endregion
    118118
    119119      #region Create operators
    120       TabuListCreator tabuListCreator = new TabuListCreator();
    121120      VariableCreator variableCreator = new VariableCreator();
    122       BestQualityMemorizer bestQualityMemorizer1 = new BestQualityMemorizer();
    123       BestQualityMemorizer bestQualityMemorizer2 = new BestQualityMemorizer();
    124       QualityDifferenceCalculator qualityDifferenceCalculator1 = new QualityDifferenceCalculator();
    125       Placeholder visualizer1 = new Placeholder();
    126       ResultsCollector resultsCollector = new ResultsCollector();
     121      SubScopesProcessor subScopesProcessor0 = new SubScopesProcessor();
     122      Assigner bestQualityInitializer = new Assigner();
     123      Placeholder analyzer1 = new Placeholder();
     124      ResultsCollector resultsCollector1 = new ResultsCollector();
    127125      SubScopesProcessor solutionProcessor = new SubScopesProcessor();
    128126      Placeholder moveGenerator = new Placeholder();
    129127      UniformSubScopesProcessor moveEvaluationProcessor = new UniformSubScopesProcessor();
    130128      Placeholder moveEvaluator = new Placeholder();
     129      IntCounter evaluatedMovesCounter = new IntCounter();
    131130      Placeholder tabuChecker = new Placeholder();
     131      Placeholder moveAnalyzer = new Placeholder();
    132132      SubScopesSorter moveQualitySorter = new SubScopesSorter();
    133       BestAverageWorstQualityCalculator bestAverageWorstMoveQualityCalculator = new BestAverageWorstQualityCalculator();
    134133      TabuSelector tabuSelector = new TabuSelector();
    135134      ConditionalBranch emptyNeighborhoodBranch1 = new ConditionalBranch();
     
    140139      SubScopesRemover subScopesRemover = new SubScopesRemover();
    141140      ConditionalBranch emptyNeighborhoodBranch2 = new ConditionalBranch();
     141      BestQualityMemorizer bestQualityUpdater = new BestQualityMemorizer();
    142142      IntCounter iterationsCounter = new IntCounter();
    143143      Comparator iterationsComparator = new Comparator();
    144       BestQualityMemorizer bestQualityMemorizer3 = new BestQualityMemorizer();
    145       BestQualityMemorizer bestQualityMemorizer4 = new BestQualityMemorizer();
    146       QualityDifferenceCalculator qualityDifferenceCalculator2 = new QualityDifferenceCalculator();
    147       Placeholder visualizer2 = new Placeholder();
    148       DataTableValuesCollector valuesCollector = new DataTableValuesCollector();
     144      SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor();
     145      Placeholder analyzer2 = new Placeholder();
     146      ResultsCollector resultsCollector2 = new ResultsCollector();
    149147      ConditionalBranch iterationsTermination = new ConditionalBranch();
    150148
    151149      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Iterations", new IntValue(0)));
    152       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Best Move Quality", new DoubleValue(0)));
    153       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Average Move Quality", new DoubleValue(0)));
    154       variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("Worst Move Quality", new DoubleValue(0)));
     150      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue(0)));
    155151      variableCreator.CollectedValues.Add(new ValueParameter<BoolValue>("EmptyNeighborhood", new BoolValue(false)));
    156       variableCreator.CollectedValues.Add(new ValueParameter<DataTable>("MoveQualities", new DataTable("Move Qualities", "Progress of the tabu search showing the best, average, and worst move found in each iteration.")));
    157 
    158       bestQualityMemorizer1.BestQualityParameter.ActualName = "BestQuality";
    159       bestQualityMemorizer1.MaximizationParameter.ActualName = MaximizationParameter.Name;
    160       bestQualityMemorizer1.QualityParameter.ActualName = QualityParameter.Name;
    161 
    162       bestQualityMemorizer2.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
    163       bestQualityMemorizer2.MaximizationParameter.ActualName = MaximizationParameter.Name;
    164       bestQualityMemorizer2.QualityParameter.ActualName = QualityParameter.Name;
    165 
    166       qualityDifferenceCalculator1.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
    167       qualityDifferenceCalculator1.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
    168       qualityDifferenceCalculator1.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
    169       qualityDifferenceCalculator1.SecondQualityParameter.ActualName = "BestQuality";
    170 
    171       visualizer1.Name = "Visualizer (placeholder)";
    172       visualizer1.OperatorParameter.ActualName = VisualizerParameter.Name;
     152      variableCreator.CollectedValues.Add(new ValueParameter<ItemList<IItem>>("TabuList", new ItemList<IItem>()));
     153      variableCreator.CollectedValues.Add(new ValueParameter<DoubleValue>("BestQuality", new DoubleValue(0)));
     154
     155      bestQualityInitializer.Name = "Initialize BestQuality";
     156      bestQualityInitializer.LeftSideParameter.ActualName = "BestQuality";
     157      bestQualityInitializer.RightSideParameter.ActualName = QualityParameter.Name;
     158
     159      analyzer1.Name = "Analyzer (placeholder)";
     160      analyzer1.OperatorParameter.ActualName = AnalyzerParameter.Name;
    173161     
    174       resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
    175       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
    176       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Move Quality"));
    177       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Move Quality"));
    178       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Worst Move Quality"));
    179       resultsCollector.CollectedValues.Add(new LookupParameter<DataTable>("MoveQualities"));
    180       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
    181       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Absolute Difference of Best Known Quality to Best Quality", null, "AbsoluteDifferenceBestKnownToBest"));
    182       resultsCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Relative Difference of Best Known Quality to Best Quality", null, "RelativeDifferenceBestKnownToBest"));
    183       resultsCollector.CollectedValues.Add(new LookupParameter<IItem>("Solution Visualization", null, VisualizationParameter.Name));
    184       resultsCollector.ResultsParameter.ActualName = "Results";
     162      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     163      resultsCollector1.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     164      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     165      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    185166
    186167      moveGenerator.Name = "MoveGenerator (placeholder)";
     
    190171      moveEvaluator.OperatorParameter.ActualName = MoveEvaluatorParameter.Name;
    191172
     173      evaluatedMovesCounter.Name = "EvaluatedMoves + 1";
     174      evaluatedMovesCounter.ValueParameter.ActualName = "EvaluatedMoves";
     175      evaluatedMovesCounter.Increment = new IntValue(1);
     176
    192177      tabuChecker.Name = "TabuChecker (placeholder)";
    193178      tabuChecker.OperatorParameter.ActualName = TabuCheckerParameter.Name;
    194179
     180      moveAnalyzer.Name = "MoveAnalyzer (placeholder)";
     181      moveAnalyzer.OperatorParameter.ActualName = MoveAnalyzerParameter.Name;
     182
    195183      moveQualitySorter.DescendingParameter.ActualName = MaximizationParameter.Name;
    196184      moveQualitySorter.ValueParameter.ActualName = MoveQualityParameter.Name;
    197 
    198       bestAverageWorstMoveQualityCalculator.AverageQualityParameter.ActualName = "Average Move Quality";
    199       bestAverageWorstMoveQualityCalculator.BestQualityParameter.ActualName = "Best Move Quality";
    200       bestAverageWorstMoveQualityCalculator.MaximizationParameter.ActualName = "Maximization";
    201       bestAverageWorstMoveQualityCalculator.QualityParameter.ActualName = MoveQualityParameter.Name;
    202       bestAverageWorstMoveQualityCalculator.WorstQualityParameter.ActualName = "Worst Move Quality";
    203185
    204186      tabuSelector.AspirationParameter.Value = new BoolValue(true);
     
    223205      subScopesRemover.RemoveAllSubScopes = true;
    224206
     207      bestQualityUpdater.Name = "Update BestQuality";
     208      bestQualityUpdater.MaximizationParameter.ActualName = MaximizationParameter.Name;
     209      bestQualityUpdater.QualityParameter.ActualName = QualityParameter.Name;
     210      bestQualityUpdater.BestQualityParameter.ActualName = "BestQuality";
     211
    225212      iterationsCounter.Name = "Iterations Counter";
    226213      iterationsCounter.Increment = new IntValue(1);
     
    233220      iterationsComparator.ResultParameter.ActualName = "Terminate";
    234221
    235       bestQualityMemorizer3.BestQualityParameter.ActualName = "BestQuality";
    236       bestQualityMemorizer3.MaximizationParameter.ActualName = MaximizationParameter.Name;
    237       bestQualityMemorizer3.QualityParameter.ActualName = QualityParameter.Name;
    238 
    239       bestQualityMemorizer4.BestQualityParameter.ActualName = BestKnownQualityParameter.Name;
    240       bestQualityMemorizer4.MaximizationParameter.ActualName = MaximizationParameter.Name;
    241       bestQualityMemorizer4.QualityParameter.ActualName = QualityParameter.Name;
    242 
    243       qualityDifferenceCalculator2.AbsoluteDifferenceParameter.ActualName = "AbsoluteDifferenceBestKnownToBest";
    244       qualityDifferenceCalculator2.FirstQualityParameter.ActualName = BestKnownQualityParameter.Name;
    245       qualityDifferenceCalculator2.RelativeDifferenceParameter.ActualName = "RelativeDifferenceBestKnownToBest";
    246       qualityDifferenceCalculator2.SecondQualityParameter.ActualName = "BestQuality";
    247 
    248       visualizer2.Name = "Visualizer (placeholder)";
    249       visualizer2.OperatorParameter.ActualName = VisualizerParameter.Name;
     222      analyzer2.Name = "Analyzer (placeholder)";
     223      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
    250224     
    251       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Move Quality"));
    252       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Average Move Quality"));
    253       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Worst Move Quality"));
    254       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
    255       valuesCollector.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Known Quality", null, BestKnownQualityParameter.Name));
    256       valuesCollector.DataTableParameter.ActualName = "MoveQualities";
     225      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Iterations"));
     226      resultsCollector2.CollectedValues.Add(new LookupParameter<DoubleValue>("Best Quality", null, "BestQuality"));
     227      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     228      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    257229
    258230      emptyNeighborhoodBranch2.Name = "Neighborhood empty?";
     
    264236
    265237      #region Create operator graph
    266       OperatorGraph.InitialOperator = tabuListCreator;
    267       tabuListCreator.Successor = variableCreator;
    268       variableCreator.Successor = bestQualityMemorizer1;
    269       bestQualityMemorizer1.Successor = bestQualityMemorizer2;
    270       bestQualityMemorizer2.Successor = qualityDifferenceCalculator1;
    271       qualityDifferenceCalculator1.Successor = visualizer1;
    272       visualizer1.Successor = resultsCollector;
    273       resultsCollector.Successor = solutionProcessor;
     238      OperatorGraph.InitialOperator = variableCreator;
     239      variableCreator.Successor = subScopesProcessor0;
     240      subScopesProcessor0.Operators.Add(bestQualityInitializer);
     241      subScopesProcessor0.Successor = resultsCollector1;
     242      resultsCollector1.Successor = solutionProcessor;
    274243      solutionProcessor.Operators.Add(moveGenerator);
    275244      solutionProcessor.Successor = iterationsCounter;
    276245      moveGenerator.Successor = moveEvaluationProcessor;
    277246      moveEvaluationProcessor.Operator = moveEvaluator;
    278       moveEvaluationProcessor.Successor = moveQualitySorter;
    279       moveEvaluator.Successor = tabuChecker;
     247      moveEvaluationProcessor.Successor = moveAnalyzer;
     248      moveEvaluator.Successor = evaluatedMovesCounter;
     249      evaluatedMovesCounter.Successor = tabuChecker;
    280250      tabuChecker.Successor = null;
    281       moveQualitySorter.Successor = bestAverageWorstMoveQualityCalculator;
    282       bestAverageWorstMoveQualityCalculator.Successor = tabuSelector;
     251      moveAnalyzer.Successor = moveQualitySorter;
     252      moveQualitySorter.Successor = tabuSelector;
    283253      tabuSelector.Successor = emptyNeighborhoodBranch1;
    284254      emptyNeighborhoodBranch1.FalseBranch = rightReducer;
     
    292262      subScopesRemover.Successor = null;
    293263      iterationsCounter.Successor = iterationsComparator;
    294       iterationsComparator.Successor = bestQualityMemorizer3;
    295       bestQualityMemorizer3.Successor = bestQualityMemorizer4;
    296       bestQualityMemorizer4.Successor = qualityDifferenceCalculator2;
    297       qualityDifferenceCalculator2.Successor = visualizer2;
    298       visualizer2.Successor = valuesCollector;
    299       valuesCollector.Successor = emptyNeighborhoodBranch2;
     264      iterationsComparator.Successor = subScopesProcessor1;
     265      subScopesProcessor1.Operators.Add(analyzer2);
     266      subScopesProcessor1.Successor = resultsCollector2;
     267      resultsCollector2.Successor = emptyNeighborhoodBranch2;
    300268      emptyNeighborhoodBranch2.TrueBranch = null;
    301269      emptyNeighborhoodBranch2.FalseBranch = iterationsTermination;
Note: See TracChangeset for help on using the changeset viewer.