Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/22/11 15:18:20 (13 years ago)
Author:
abeham
Message:

#1344

  • Adapted all algorithms to count evaluated solutions / moves and outside of the parallel region
  • Used the same pattern in every algorithm: Initialize and collect the variable in the Algorithm and increment it in the main loops and main operators
File:
1 edited

Legend:

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

    r4722 r5356  
    2727using HeuristicLab.Core;
    2828using HeuristicLab.Data;
     29using HeuristicLab.Operators;
    2930using HeuristicLab.Optimization;
    3031using HeuristicLab.Optimization.Operators;
     
    135136    }
    136137    private SimulatedAnnealingMainLoop MainLoop {
    137       get { return (SimulatedAnnealingMainLoop)SolutionsCreator.Successor; }
     138      get {
     139        return (SimulatedAnnealingMainLoop)(
     140          (ResultsCollector)(
     141            (VariableCreator)SolutionsCreator.Successor
     142          ).Successor
     143        ).Successor;
     144      }
    138145    }
    139146    [Storable]
     
    171178      RandomCreator randomCreator = new RandomCreator();
    172179      SolutionsCreator solutionsCreator = new SolutionsCreator();
     180      VariableCreator variableCreator = new VariableCreator();
     181      ResultsCollector resultsCollector = new ResultsCollector();
    173182      SimulatedAnnealingMainLoop mainLoop = new SimulatedAnnealingMainLoop();
    174183      OperatorGraph.InitialOperator = randomCreator;
     
    182191
    183192      solutionsCreator.NumberOfSolutions = new IntValue(1);
    184       solutionsCreator.Successor = mainLoop;
     193      solutionsCreator.Successor = variableCreator;
     194
     195      variableCreator.Name = "Initialize EvaluatedMoves";
     196      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedMoves", new IntValue()));
     197      variableCreator.Successor = resultsCollector;
     198
     199      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Moves", null, "EvaluatedMoves"));
     200      resultsCollector.ResultsParameter.ActualName = "Results";
     201      resultsCollector.Successor = mainLoop;
    185202
    186203      mainLoop.MoveGeneratorParameter.ActualName = MoveGeneratorParameter.Name;
     
    194211      mainLoop.ResultsParameter.ActualName = "Results";
    195212      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
     213      mainLoop.EvaluatedMovesParameter.ActualName = "EvaluatedMoves";
    196214
    197215      foreach (IDiscreteDoubleValueModifier op in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name))
Note: See TracChangeset for help on using the changeset viewer.