Ignore:
Timestamp:
04/14/15 14:22:41 (7 years ago)
Author:
pfleck
Message:

#2027 Made a genetic ComparisonTerminationCriterion instead of the MaximumIterationsTerminationCriterion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/TerminationCriteria/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/OffspringSelectionGeneticAlgorithm.cs

    r12304 r12310  
    326326      ParameterizeComparisonFactorModifiers();
    327327
    328       var maximumGenerationsTerminationCriteria = new MaximumIterationsTerminationCriterion();
    329       maximumGenerationsTerminationCriteria.IterationsParameter.ActualName = "Generations";
    330       maximumGenerationsTerminationCriteria.MaximumIterationsParameter.ActualName = "MaximumGenerations";
    331       TerminationCriteriaParameter.Value.Operators.Add(maximumGenerationsTerminationCriteria);
    332 
    333328      qualityAnalyzer = new BestAverageWorstQualityAnalyzer();
    334329      selectionPressureAnalyzer = new ValueAnalyzer();
     
    336331      ParameterizeAnalyzers();
    337332      UpdateAnalyzers();
     333      AddTerminationCriteria();
    338334
    339335      Initialize();
     
    517513      Analyzer.Operators.Add(successfulOffspringAnalyzer, successfulOffspringAnalyzer.EnabledByDefault);
    518514    }
     515    private void AddTerminationCriteria() {
     516      TerminationCriteriaParameter.Value.Operators.Add(
     517        new ComparisonTerminationCriterion<IntValue>("Generations", "MaximumGenerations", ComparisonType.GreaterOrEqual) { Name = "Maximum Generations" });
     518      TerminationCriteriaParameter.Value.Operators.Add(
     519        new ComparisonTerminationCriterion<IntValue>("EvaluatedSolutions", "EvaluatedSolutionsGenerations", ComparisonType.GreaterOrEqual) { Name = "Maximum Evaluations" });
     520      TerminationCriteriaParameter.Value.Operators.Add(
     521        new ComparisonTerminationCriterion<DoubleValue>("SelectionPressure", "MaximumSelectionPressure", ComparisonType.GreaterOrEqual) { Name = "Maximum Selection Pressure" });
     522    }
    519523    private OffspringSelectionGeneticAlgorithmMainLoop FindMainLoop(IOperator start) {
    520524      IOperator mainLoop = start;
Note: See TracChangeset for help on using the changeset viewer.