Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/07/15 13:52:48 (10 years ago)
Author:
abeham
Message:

#2174:

  • Added ISingleObjectiveOperator and IMultiObjectiveOperator interfaces
    • Added interface to all operators that would fall in either of these categories (excluding MainLoop operators)
  • Added some checks in BasicProblem on whether the MultiEncoding is being used
    • A new event handler is added that reacts on encodings being removed or added to the MultiEncoding
  • Added code to remove the non-fit operators in (Single|Multi)ObjectiveBasicProblem
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/BasicProblems/BasicProblem.cs

    r11949 r11970  
    8686    private void RegisterEvents() {
    8787      EncodingParameter.ValueChanged += (o, e) => OnEncodingChanged();
     88      var multiEncoding = Encoding as MultiEncoding;
     89      if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged;
    8890    }
    8991
    9092    protected virtual void OnEncodingChanged() {
    91       if (oldEncoding != null) AdaptEncodingOperators(oldEncoding, Encoding);
     93      if (oldEncoding != null) {
     94        AdaptEncodingOperators(oldEncoding, Encoding);
     95        var oldMultiEncoding = oldEncoding as MultiEncoding;
     96        if (oldMultiEncoding != null)
     97          oldMultiEncoding.EncodingsChanged -= MultiEncodingOnEncodingsChanged;
     98      }
    9299      oldEncoding = Encoding;
    93100
     
    104111      //TODO register solution creator changed event, change access modifier to private
    105112      //((IValueParameter)solutionCreatorParam).ValueChanged += SolutionCreatorParameter_ValueChanged;     
     113
     114      var multiEncoding = Encoding as MultiEncoding;
     115      if (multiEncoding != null) multiEncoding.EncodingsChanged += MultiEncodingOnEncodingsChanged;
    106116
    107117      OnOperatorsChanged();
     
    141151    }
    142152
     153    protected virtual void MultiEncodingOnEncodingsChanged(object sender, EventArgs e) {
     154      OnOperatorsChanged();
     155    }
    143156  }
    144157}
Note: See TracChangeset for help on using the changeset viewer.