Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/22/11 15:18:20 (14 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.GeneticAlgorithm/3.3/GeneticAlgorithm.cs

    r5352 r5356  
    135135    }
    136136    private GeneticAlgorithmMainLoop GeneticAlgorithmMainLoop {
    137       get { return (GeneticAlgorithmMainLoop)((SubScopesCounter)SolutionsCreator.Successor).Successor; }
     137      get {
     138        return (GeneticAlgorithmMainLoop)(
     139          (ResultsCollector)(
     140            (SubScopesCounter)SolutionsCreator.Successor
     141          ).Successor
     142        ).Successor;
     143      }
    138144    }
    139145    [Storable]
     
    157163      SolutionsCreator solutionsCreator = new SolutionsCreator();
    158164      SubScopesCounter subScopesCounter = new SubScopesCounter();
    159       GeneticAlgorithmMainLoop geneticAlgorithmMainLoop = new GeneticAlgorithmMainLoop();
     165      ResultsCollector resultsCollector = new ResultsCollector();
     166      GeneticAlgorithmMainLoop mainLoop = new GeneticAlgorithmMainLoop();
    160167      OperatorGraph.InitialOperator = randomCreator;
    161168
     
    172179      subScopesCounter.Name = "Initialize EvaluatedSolutions";
    173180      subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
    174       subScopesCounter.Successor = geneticAlgorithmMainLoop;
    175 
    176       geneticAlgorithmMainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
    177       geneticAlgorithmMainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
    178       geneticAlgorithmMainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
    179       geneticAlgorithmMainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
    180       geneticAlgorithmMainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
    181       geneticAlgorithmMainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
    182       geneticAlgorithmMainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
    183       geneticAlgorithmMainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
    184       geneticAlgorithmMainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
    185       geneticAlgorithmMainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
    186       geneticAlgorithmMainLoop.ResultsParameter.ActualName = "Results";
     181      subScopesCounter.Successor = resultsCollector;
     182
     183      resultsCollector.CollectedValues.Add(new LookupParameter<IntValue>("Evaluated Solutions", null, "EvaluatedSolutions"));
     184      resultsCollector.ResultsParameter.ActualName = "Results";
     185      resultsCollector.Successor = mainLoop;
     186
     187      mainLoop.SelectorParameter.ActualName = SelectorParameter.Name;
     188      mainLoop.CrossoverParameter.ActualName = CrossoverParameter.Name;
     189      mainLoop.ElitesParameter.ActualName = ElitesParameter.Name;
     190      mainLoop.MaximumGenerationsParameter.ActualName = MaximumGenerationsParameter.Name;
     191      mainLoop.MutatorParameter.ActualName = MutatorParameter.Name;
     192      mainLoop.MutationProbabilityParameter.ActualName = MutationProbabilityParameter.Name;
     193      mainLoop.RandomParameter.ActualName = RandomCreator.RandomParameter.ActualName;
     194      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
     195      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
     196      mainLoop.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name;
     197      mainLoop.ResultsParameter.ActualName = "Results";
    187198
    188199      foreach (ISelector selector in ApplicationManager.Manager.GetInstances<ISelector>().Where(x => !(x is IMultiObjectiveSelector)).OrderBy(x => x.Name))
Note: See TracChangeset for help on using the changeset viewer.