Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/02/10 17:20:06 (14 years ago)
Author:
abeham
Message:

#1030

  • Added maximum evaluated solutions termination criterion to OSGAs
Location:
trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3
Files:
6 edited

Legend:

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

    r3816 r3891  
    127127      get { return (ValueParameter<MultiAnalyzer>)Parameters["IslandAnalyzer"]; }
    128128    }
     129    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
     130      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     131    }
    129132    #endregion
    130133
     
    221224      get { return IslandAnalyzerParameter.Value; }
    222225      set { IslandAnalyzerParameter.Value = value; }
     226    }
     227    public IntValue MaximumEvaluatedSolutions {
     228      get { return MaximumEvaluatedSolutionsParameter.Value; }
     229      set { MaximumEvaluatedSolutionsParameter.Value = value; }
    223230    }
    224231    private RandomCreator RandomCreator {
     
    272279      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the islands.", new MultiAnalyzer()));
    273280      Parameters.Add(new ValueParameter<MultiAnalyzer>("IslandAnalyzer", "The operator used to analyze each island.", new MultiAnalyzer()));
    274      
     281      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
     282
    275283      RandomCreator randomCreator = new RandomCreator();
    276284      SubScopesCreator populationCreator = new SubScopesCreator();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithmMainLoop.cs

    r3750 r3891  
    203203      Comparator generationsComparator = new Comparator();
    204204      Comparator terminatedIslandsComparator = new Comparator();
     205      Comparator maxEvaluatedSolutionsComparator = new Comparator();
    205206      Placeholder comparisonFactorModifier = new Placeholder();
    206207      Placeholder analyzer2 = new Placeholder();
     
    208209      ConditionalBranch generationsTerminationCondition = new ConditionalBranch();
    209210      ConditionalBranch terminatedIslandsCondition = new ConditionalBranch();
     211      ConditionalBranch evaluatedSolutionsTerminationCondition = new ConditionalBranch();
    210212
    211213      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Migrations", new IntValue(0)));
     
    348350      terminatedIslandsComparator.ResultParameter.ActualName = "TerminateTerminatedIslands";
    349351
     352      maxEvaluatedSolutionsComparator.Name = "EvaluatedSolutions >= MaximumEvaluatedSolutions ?";
     353      maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     354      maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = "EvaluatedSolutions";
     355      maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
     356      maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";
     357
    350358      comparisonFactorModifier.Name = "Update Comparison Factor (Placeholder)";
    351359      comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
     
    363371      terminatedIslandsCondition.Name = "Terminate (TerminatedIslands) ?";
    364372      terminatedIslandsCondition.ConditionParameter.ActualName = "TerminateTerminatedIslands";
     373
     374      evaluatedSolutionsTerminationCondition.Name = "Terminate (EvaluatedSolutions) ?";
     375      evaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
    365376      #endregion
    366377
     
    409420      immigrationReplacer.Successor = null;
    410421      generationsComparator.Successor = terminatedIslandsComparator;
    411       terminatedIslandsComparator.Successor = comparisonFactorModifier;
     422      terminatedIslandsComparator.Successor = maxEvaluatedSolutionsComparator;
     423      maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
    412424      comparisonFactorModifier.Successor = analyzer2;
    413425      analyzer2.Successor = resultsCollector3;
     
    417429      generationsTerminationCondition.Successor = null;
    418430      terminatedIslandsCondition.TrueBranch = null;
    419       terminatedIslandsCondition.FalseBranch = uniformSubScopesProcessor1;
     431      terminatedIslandsCondition.FalseBranch = evaluatedSolutionsTerminationCondition;
    420432      terminatedIslandsCondition.Successor = null;
     433      evaluatedSolutionsTerminationCondition.TrueBranch = null;
     434      evaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
     435      evaluatedSolutionsTerminationCondition.Successor = null;
    421436      #endregion
    422437    }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r3816 r3891  
    104104      get { return (ValueParameter<MultiAnalyzer>)Parameters["Analyzer"]; }
    105105    }
     106    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
     107      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     108    }
    106109    #endregion
    107110
     
    174177      get { return AnalyzerParameter.Value; }
    175178      set { AnalyzerParameter.Value = value; }
     179    }
     180    public IntValue MaximumEvaluatedSolutions {
     181      get { return MaximumEvaluatedSolutionsParameter.Value; }
     182      set { MaximumEvaluatedSolutionsParameter.Value = value; }
    176183    }
    177184    private RandomCreator RandomCreator {
     
    211218      Parameters.Add(new ValueLookupParameter<IntValue>("SelectedParents", "How much parents should be selected each time the offspring selection step is performed until the population is filled. This parameter should be about the same or twice the size of PopulationSize for smaller problems, and less for large problems.", new IntValue(200)));
    212219      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze each generation.", new MultiAnalyzer()));
    213      
     220      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
     221
    214222      RandomCreator randomCreator = new RandomCreator();
    215223      SolutionsCreator solutionsCreator = new SolutionsCreator();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithmMainLoop.cs

    r3750 r3891  
    133133      Comparator maxGenerationsComparator = new Comparator();
    134134      Comparator maxSelectionPressureComparator = new Comparator();
     135      Comparator maxEvaluatedSolutionsComparator = new Comparator();
    135136      Placeholder comparisonFactorModifier = new Placeholder();
    136137      Placeholder analyzer2 = new Placeholder();
     
    138139      ConditionalBranch conditionalBranch1 = new ConditionalBranch();
    139140      ConditionalBranch conditionalBranch2 = new ConditionalBranch();
     141      ConditionalBranch conditionalBranch3 = new ConditionalBranch();
    140142
    141143      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Generations", new IntValue(0))); // Class OffspringSelectionGeneticAlgorithm expects this to be called Generations
     
    192194      maxSelectionPressureComparator.RightSideParameter.ActualName = MaximumSelectionPressureParameter.Name;
    193195
     196      maxEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     197      maxEvaluatedSolutionsComparator.LeftSideParameter.ActualName = "EvaluatedSolutions";
     198      maxEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
     199      maxEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";
     200
    194201      comparisonFactorModifier.Name = "Update ComparisonFactor (placeholder)";
    195202      comparisonFactorModifier.OperatorParameter.ActualName = ComparisonFactorModifierParameter.Name;
     
    207214      conditionalBranch2.Name = "MaximumGenerations reached?";
    208215      conditionalBranch2.ConditionParameter.ActualName = "TerminateMaximumGenerations";
     216
     217      conditionalBranch3.Name = "MaximumEvaluatedSolutions reached?";
     218      conditionalBranch3.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
    209219      #endregion
    210220
     
    219229      generationsCounter.Successor = maxGenerationsComparator;
    220230      maxGenerationsComparator.Successor = maxSelectionPressureComparator;
    221       maxSelectionPressureComparator.Successor = comparisonFactorModifier;
     231      maxSelectionPressureComparator.Successor = maxEvaluatedSolutionsComparator;
     232      maxEvaluatedSolutionsComparator.Successor = comparisonFactorModifier;
    222233      comparisonFactorModifier.Successor = analyzer2;
    223234      analyzer2.Successor = resultsCollector3;
     
    226237      conditionalBranch1.TrueBranch = null;
    227238      conditionalBranch1.Successor = null;
    228       conditionalBranch2.FalseBranch = mainOperator;
     239      conditionalBranch2.FalseBranch = conditionalBranch3;
    229240      conditionalBranch2.TrueBranch = null;
    230241      conditionalBranch2.Successor = null;
     242      conditionalBranch3.FalseBranch = mainOperator;
     243      conditionalBranch3.TrueBranch = null;
     244      conditionalBranch3.Successor = null;
    231245      #endregion
    232246    }
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASA.cs

    r3816 r3891  
    116116      get { return (ValueParameter<MultiAnalyzer>)Parameters["VillageAnalyzer"]; }
    117117    }
     118    private ValueParameter<IntValue> MaximumEvaluatedSolutionsParameter {
     119      get { return (ValueParameter<IntValue>)Parameters["MaximumEvaluatedSolutions"]; }
     120    }
    118121    #endregion
    119122
     
    198201      get { return VillageAnalyzerParameter.Value; }
    199202      set { VillageAnalyzerParameter.Value = value; }
     203    }
     204    public IntValue MaximumEvaluatedSolutions {
     205      get { return MaximumEvaluatedSolutionsParameter.Value; }
     206      set { MaximumEvaluatedSolutionsParameter.Value = value; }
    200207    }
    201208    private RandomCreator RandomCreator {
     
    245252      Parameters.Add(new ValueParameter<MultiAnalyzer>("Analyzer", "The operator used to analyze the villages.", new MultiAnalyzer()));
    246253      Parameters.Add(new ValueParameter<MultiAnalyzer>("VillageAnalyzer", "The operator used to analyze each village.", new MultiAnalyzer()));
    247      
     254      Parameters.Add(new ValueParameter<IntValue>("MaximumEvaluatedSolutions", "The maximum number of evaluated solutions (approximately).", new IntValue(int.MaxValue)));
     255
    248256      RandomCreator randomCreator = new RandomCreator();
    249257      SubScopesCreator populationCreator = new SubScopesCreator();
  • trunk/sources/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/SASEGASAMainLoop.cs

    r3750 r3891  
    185185      Assigner finalMaxSelPressAssigner = new Assigner();
    186186      Comparator maximumGenerationsComparator = new Comparator();
     187      Comparator maximumEvaluatedSolutionsComparator = new Comparator();
    187188      Placeholder analyzer2 = new Placeholder();
    188189      ResultsCollector resultsCollector3 = new ResultsCollector();
    189190      ConditionalBranch terminationCondition = new ConditionalBranch();
    190191      ConditionalBranch maximumGenerationsTerminationCondition = new ConditionalBranch();
     192      ConditionalBranch maximumEvaluatedSolutionsTerminationCondition = new ConditionalBranch();
    191193
    192194      variableCreator.CollectedValues.Add(new ValueParameter<IntValue>("Reunifications", new IntValue(0)));
     
    356358      maximumGenerationsComparator.ResultParameter.ActualName = "TerminateMaximumGenerations";
    357359
     360      maximumEvaluatedSolutionsComparator.Name = "EvaluatedSolutions >= MaximumEvaluatedSolutions";
     361      maximumEvaluatedSolutionsComparator.Comparison = new Comparison(ComparisonType.GreaterOrEqual);
     362      maximumEvaluatedSolutionsComparator.LeftSideParameter.ActualName = "EvaluatedSolutions";
     363      maximumEvaluatedSolutionsComparator.ResultParameter.ActualName = "TerminateEvaluatedSolutions";
     364      maximumEvaluatedSolutionsComparator.RightSideParameter.ActualName = "MaximumEvaluatedSolutions";
     365
    358366      analyzer2.Name = "Analyzer (placeholder)";
    359367      analyzer2.OperatorParameter.ActualName = AnalyzerParameter.Name;
     
    365373      terminationCondition.ConditionParameter.ActualName = "TerminateSASEGASA";
    366374      maximumGenerationsTerminationCondition.ConditionParameter.ActualName = "TerminateMaximumGenerations";
     375      maximumEvaluatedSolutionsTerminationCondition.ConditionParameter.ActualName = "TerminateEvaluatedSolutions";
    367376      #endregion
    368377
     
    422431      villageCountConditionalBranch.Successor = null;
    423432      finalMaxSelPressAssigner.Successor = null;
    424       maximumGenerationsComparator.Successor = analyzer2;
     433      maximumGenerationsComparator.Successor = maximumEvaluatedSolutionsComparator;
     434      maximumEvaluatedSolutionsComparator.Successor = analyzer2;
    425435      analyzer2.Successor = resultsCollector3;
    426436      resultsCollector3.Successor = terminationCondition;
     
    429439      terminationCondition.Successor = null;
    430440      maximumGenerationsTerminationCondition.TrueBranch = null;
    431       maximumGenerationsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
     441      maximumGenerationsTerminationCondition.FalseBranch = maximumEvaluatedSolutionsTerminationCondition;
    432442      maximumGenerationsTerminationCondition.Successor = null;
     443      maximumEvaluatedSolutionsTerminationCondition.TrueBranch = null;
     444      maximumEvaluatedSolutionsTerminationCondition.FalseBranch = uniformSubScopesProcessor1;
     445      maximumEvaluatedSolutionsTerminationCondition.Successor = null;
    433446      #endregion
    434447    }
Note: See TracChangeset for help on using the changeset viewer.