- Timestamp:
- 06/13/12 09:01:31 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Selection/3.3/LinearRankSelector.cs
r7259 r7995 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 54 55 55 56 // create a list for each scope that contains the scope's index in the original scope list and its lots 56 var temp = qualities. Select((x, index) => new { index, x.Value });57 var temp = qualities.Where(x => IsValidQuality(x.Value)).Select((x, index) => new { index, x.Value }); 57 58 if (maximization) 58 59 temp = temp.OrderBy(x => x.Value); … … 60 61 temp = temp.OrderByDescending(x => x.Value); 61 62 var list = temp.Select((x, index) => new { x.index, lots = index + 1 }).ToList(); 63 64 //check if list with indexes is as long as the original scope list 65 //otherwise invalid quality values were filtered 66 if (list.Count != scopes.Count) { 67 throw new ArgumentException("The scopes contain invalid quality values (either infinity or double.NaN) on which the selector cannot operate."); 68 } 62 69 63 70 int lotSum = list.Count * (list.Count + 1) / 2;
Note: See TracChangeset
for help on using the changeset viewer.