Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12549


Ignore:
Timestamp:
06/30/15 12:41:43 (9 years ago)
Author:
pfleck
Message:

#2350 Moved updating of terminators to concrete ALPS implementation instead of abstract base class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS.SteadyState/3.3/AlpsSsGeneticAlgorithm.cs

    r12534 r12549  
    209209      }
    210210
     211      iterationsTerminator = new ComparisonTerminator<IntValue>("Iterations", ComparisonType.Less, new IntValue(1000)) { Name = "Iterations" };
     212
    211213      ParameterizeSelectors();
     214      UpdateTerminators();
     215
    212216      Initialize();
    213217    }
     
    222226      UpdateCrossovers();
    223227      UpdateMutators();
     228      UpdateTerminators();
    224229    }
    225230    protected override void Problem_SolutionCreatorChanged(object sender, EventArgs e) {
     
    238243      UpdateCrossovers();
    239244      UpdateMutators();
     245      UpdateTerminators();
    240246    }
    241247    protected override void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
     
    308314
    309315    #region Updates
    310     protected override void UpdateTerminators() {
     316
     317    private void UpdateTerminators() {
    311318      var newTerminators = new Dictionary<ITerminator, bool> {
    312319        {iterationsTerminator, !Terminators.Operators.Contains(iterationsTerminator) || Terminators.Operators.ItemChecked(iterationsTerminator)},
     320        {evaluationsTerminator, Terminators.Operators.Contains(evaluationsTerminator) && Terminators.Operators.ItemChecked(evaluationsTerminator)},
     321        {qualityTerminator, Terminators.Operators.Contains(qualityTerminator) && Terminators.Operators.ItemChecked(qualityTerminator) },
     322        {executionTimeTerminator, Terminators.Operators.Contains(executionTimeTerminator) && Terminators.Operators.ItemChecked(executionTimeTerminator)}
    313323      };
    314 
    315       base.UpdateTerminators();
     324      if (Problem != null) {
     325        foreach (var terminator in Problem.Operators.OfType<ITerminator>())
     326          newTerminators.Add(terminator, !Terminators.Operators.Contains(terminator) || Terminators.Operators.ItemChecked(terminator));
     327      }
     328
     329      Terminators.Operators.Clear();
    316330
    317331      foreach (var newTerminator in newTerminators)
    318         Terminators.Operators.Insert(0, newTerminator.Key, newTerminator.Value);
    319     }
    320     protected override void CreateTerminators() {
    321       iterationsTerminator = new ComparisonTerminator<IntValue>("Iterations", ComparisonType.Less, new IntValue(1000)) { Name = "Iterations" };
    322       base.CreateTerminators();
     332        Terminators.Operators.Add(newTerminator.Key, newTerminator.Value);
    323333    }
    324334    private void UpdateCrossovers() {
Note: See TracChangeset for help on using the changeset viewer.