Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/07/15 13:52:48 (9 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/MultiObjectiveBasicProblem.cs

    r11949 r11970  
    6363    }
    6464
     65    protected override void OnOperatorsChanged() {
     66      base.OnOperatorsChanged();
     67      if (Encoding != null) {
     68        PruneSingleObjectiveOperators(Encoding);
     69        var multiEncoding = Encoding as MultiEncoding;
     70        if (multiEncoding != null) {
     71          foreach (var encoding in multiEncoding.Encodings.ToList()) {
     72            PruneSingleObjectiveOperators(encoding);
     73          }
     74        }
     75      }
     76    }
     77
     78    private void PruneSingleObjectiveOperators(IEncoding encoding) {
     79      if (encoding != null && encoding.Operators.Any(x => x is ISingleObjectiveOperator && !(x is IMultiObjectiveOperator)))
     80        encoding.Operators = encoding.Operators.Where(x => !(x is ISingleObjectiveOperator) || x is IMultiObjectiveOperator).ToList();
     81    }
     82
    6583    protected override void OnEvaluatorChanged() {
    6684      base.OnEvaluatorChanged();
Note: See TracChangeset for help on using the changeset viewer.