Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5351 for trunk


Ignore:
Timestamp:
01/21/11 22:49:02 (14 years ago)
Author:
abeham
Message:

#1344

  • Added EvaluatedSolutions as result to the Island GA
  • Moved island analyzer out of the islands processing branch (should that becoming parallelized the analysis operator will be executed sequentially for each island)
  • Related ticket #1333
Location:
trunk/sources
Files:
1 added
3 edited

Legend:

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

    r4722 r5351  
    187187    }
    188188    private IslandGeneticAlgorithmMainLoop MainLoop {
    189       get { return (IslandGeneticAlgorithmMainLoop)IslandProcessor.Successor; }
     189      get { return (IslandGeneticAlgorithmMainLoop)((UniformSubScopesProcessor)((VariableCreator)IslandProcessor.Successor).Successor).Successor; }
    190190    }
    191191    [Storable]
     
    235235      UniformSubScopesProcessor ussp1 = new UniformSubScopesProcessor();
    236236      SolutionsCreator solutionsCreator = new SolutionsCreator();
     237      VariableCreator variableCreator = new VariableCreator();
     238      UniformSubScopesProcessor ussp2 = new UniformSubScopesProcessor();
     239      SubScopesCounter subScopesCounter = new SubScopesCounter();
    237240      IslandGeneticAlgorithmMainLoop mainLoop = new IslandGeneticAlgorithmMainLoop();
    238241      OperatorGraph.InitialOperator = randomCreator;
     
    249252
    250253      ussp1.Operator = solutionsCreator;
    251       ussp1.Successor = mainLoop;
     254      ussp1.Successor = variableCreator;
    252255
    253256      solutionsCreator.NumberOfSolutionsParameter.ActualName = PopulationSizeParameter.Name;
    254257      solutionsCreator.Successor = null;
     258
     259      variableCreator.Name = "Initialize EvaluatedSolutions";
     260      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("EvaluatedSolutions", new IntValue()));
     261      variableCreator.Successor = ussp2;
     262
     263      ussp2.Operator = subScopesCounter;
     264      ussp2.Successor = mainLoop;
     265
     266      subScopesCounter.Name = "Count EvaluatedSolutions";
     267      subScopesCounter.ValueParameter.ActualName = "EvaluatedSolutions";
     268      subScopesCounter.Successor = null;
    255269
    256270      mainLoop.EmigrantsSelectorParameter.ActualName = EmigrantsSelectorParameter.Name;
     
    270284      mainLoop.AnalyzerParameter.ActualName = AnalyzerParameter.Name;
    271285      mainLoop.IslandAnalyzerParameter.ActualName = IslandAnalyzerParameter.Name;
     286      mainLoop.EvaluatedSolutionsParameter.ActualName = "EvaluatedSolutions";
    272287      mainLoop.Successor = null;
    273288
  • trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/IslandGeneticAlgorithmMainLoop.cs

    r5208 r5351  
    100100    public ValueLookupParameter<IOperator> IslandAnalyzerParameter {
    101101      get { return (ValueLookupParameter<IOperator>)Parameters["IslandAnalyzer"]; }
     102    }
     103    public LookupParameter<IntValue> EvaluatedSolutionsParameter {
     104      get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; }
    102105    }
    103106    #endregion
     
    135138      Parameters.Add(new ValueLookupParameter<IOperator>("Analyzer", "The operator used to the analyze the islands."));
    136139      Parameters.Add(new ValueLookupParameter<IOperator>("IslandAnalyzer", "The operator used to analyze each island."));
     140      Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of times a solution has been evaluated."));
    137141      #endregion
    138142
     
    144148      Placeholder analyzer1 = new Placeholder();
    145149      ResultsCollector resultsCollector1 = new ResultsCollector();
    146       ResultsCollector resultsCollector2 = new ResultsCollector();
    147150      UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor();
    148151      Placeholder selector = new Placeholder();
     
    160163      RightReducer rightReducer = new RightReducer();
    161164      MergingReducer mergingReducer = new MergingReducer();
     165      IntCounter generationsCounter = new IntCounter();
     166      UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
     167      SubScopesCounter subScopesCounter = new SubScopesCounter();
    162168      Placeholder islandAnalyzer2 = new Placeholder();
    163       IntCounter generationsCounter = new IntCounter();
    164169      IntCounter generationsSinceLastMigrationCounter = new IntCounter();
    165170      Comparator migrationComparator = new Comparator();
     
    167172      Assigner resetGenerationsSinceLastMigrationAssigner = new Assigner();
    168173      IntCounter migrationsCounter = new IntCounter();
    169       UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor();
     174      UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor();
    170175      Placeholder emigrantsSelector = new Placeholder();
    171176      Placeholder migrator = new Placeholder();
    172       UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor();
     177      UniformSubScopesProcessor uniformSubScopesProcessor6 = new UniformSubScopesProcessor();
    173178      Placeholder immigrationReplacer = new Placeholder();
    174179      Comparator generationsComparator = new Comparator();
    175180      Placeholder analyzer2 = new Placeholder();
    176       ResultsCollector resultsCollector3 = new ResultsCollector();
     181      ResultsCollector resultsCollector2 = new ResultsCollector();
    177182      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
    178183
     
    191196      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
    192197      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     198      resultsCollector1.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("IslandResults", "Result set for each island", "Results"));
     199      resultsCollector1.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions"));
    193200      resultsCollector1.ResultsParameter.ActualName = ResultsParameter.Name;
    194 
    195       resultsCollector2.Name = "Reference Island Results";
    196       resultsCollector2.CopyValue = new BoolValue(false);
    197       resultsCollector2.CollectedValues.Add(new ScopeTreeLookupParameter<ResultCollection>("IslandResults", "Result set for each island", "Results"));
    198       resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    199201
    200202      selector.Name = "Selector (placeholder)";
     
    223225      bestSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name;
    224226      bestSelector.QualityParameter.ActualName = QualityParameter.Name;
     227
     228      subScopesCounter.Name = "Increment EvaluatedSolutions";
     229      subScopesCounter.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;
    225230
    226231      islandAnalyzer2.Name = "Island Analyzer (placeholder)";
     
    270275      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
    271276
    272       resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
    273       resultsCollector3.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
    274       resultsCollector3.ResultsParameter.ActualName = ResultsParameter.Name;
     277      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Migrations"));
     278      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("Generations"));
     279      resultsCollector2.CollectedValues.Add(new LookupParameter<IntValue>("EvaluatedSolutions"));
     280      resultsCollector2.ResultsParameter.ActualName = ResultsParameter.Name;
    275281
    276282      generationsTerminationCondition.Name = "Terminate?";
     
    286292      islandAnalyzer1.Successor = null;
    287293      analyzer1.Successor = resultsCollector1;
    288       resultsCollector1.Successor = resultsCollector2;
    289       resultsCollector2.Successor = uniformSubScopesProcessor1;
     294      resultsCollector1.Successor = uniformSubScopesProcessor1;
    290295      uniformSubScopesProcessor1.Operator = selector;
    291296      uniformSubScopesProcessor1.Successor = generationsCounter;
     
    304309      subScopesRemover.Successor = null;
    305310      uniformSubScopesProcessor3.Operator = evaluator;
    306       uniformSubScopesProcessor3.Successor = null;
     311      uniformSubScopesProcessor3.Successor = subScopesCounter;
    307312      evaluator.Successor = null;
     313      subScopesCounter.Successor = null;
    308314      subScopesProcessor2.Operators.Add(bestSelector);
    309315      subScopesProcessor2.Operators.Add(new EmptyOperator());
     
    311317      bestSelector.Successor = rightReducer;
    312318      rightReducer.Successor = null;
    313       mergingReducer.Successor = islandAnalyzer2;
     319      mergingReducer.Successor = null;
     320      generationsCounter.Successor = uniformSubScopesProcessor4;
     321      uniformSubScopesProcessor4.Operator = islandAnalyzer2;
     322      uniformSubScopesProcessor4.Successor = generationsSinceLastMigrationCounter;
    314323      islandAnalyzer2.Successor = null;
    315       generationsCounter.Successor = generationsSinceLastMigrationCounter;
    316324      generationsSinceLastMigrationCounter.Successor = migrationComparator;
    317325      migrationComparator.Successor = migrationBranch;
     
    320328      migrationBranch.Successor = generationsComparator;
    321329      resetGenerationsSinceLastMigrationAssigner.Successor = migrationsCounter;
    322       migrationsCounter.Successor = uniformSubScopesProcessor4;
    323       uniformSubScopesProcessor4.Operator = emigrantsSelector;
    324       uniformSubScopesProcessor4.Successor = migrator;
    325       migrator.Successor = uniformSubScopesProcessor5;
    326       uniformSubScopesProcessor5.Operator = immigrationReplacer;
    327       uniformSubScopesProcessor5.Successor = null;
     330      migrationsCounter.Successor = uniformSubScopesProcessor5;
     331      uniformSubScopesProcessor5.Operator = emigrantsSelector;
     332      uniformSubScopesProcessor5.Successor = migrator;
     333      migrator.Successor = uniformSubScopesProcessor6;
     334      uniformSubScopesProcessor6.Operator = immigrationReplacer;
     335      uniformSubScopesProcessor6.Successor = null;
    328336      generationsComparator.Successor = analyzer2;
    329       analyzer2.Successor = resultsCollector3;
    330       resultsCollector3.Successor = generationsTerminationCondition;
     337      analyzer2.Successor = resultsCollector2;
     338      resultsCollector2.Successor = generationsTerminationCondition;
    331339      generationsTerminationCondition.TrueBranch = null;
    332340      generationsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
  • trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r5163 r5351  
    124124      <SubType>Code</SubType>
    125125    </Compile>
     126    <Compile Include="SubScopesCounter.cs" />
    126127    <Compile Include="SubScopesCreator.cs" />
    127128    <Compile Include="SubScopesMixer.cs" />
Note: See TracChangeset for help on using the changeset viewer.