Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/12 09:01:31 (12 years ago)
Author:
mkommend
Message:

#1871: Added quality checks in all SingleObjectiveSelectors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Selection/3.3/GeneralizedRankSelector.cs

    r7259 r7995  
    6363      double pressure = PressureParameter.ActualValue.Value;
    6464
    65       var ordered = qualities.Select((x, index) => new KeyValuePair<int, double>(index, x.Value)).OrderBy(x => x.Value).ToList();
     65      var ordered = qualities.Where(x => IsValidQuality(x.Value)).Select((x, index) => new KeyValuePair<int, double>(index, x.Value)).OrderBy(x => x.Value).ToList();
    6666      if (maximization) ordered.Reverse();
     67
     68      //check if list with indexes is as long as the original scope list
     69      //otherwise invalid quality values were filtered
     70      if (ordered.Count != scopes.Count) {
     71        throw new ArgumentException("The scopes contain invalid quality values (either infinity or double.NaN) on which the selector cannot operate.");
     72      }
    6773
    6874      int m = scopes.Count;
Note: See TracChangeset for help on using the changeset viewer.