- Timestamp:
- 12/18/19 16:11:21 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.GraphColoring/3.3/GraphColoringProblem.cs
r17320 r17382 129 129 } 130 130 131 public override doubleEvaluate(LinearLinkage lle, IRandom random, CancellationToken cancellationToken) {131 public override ISingleObjectiveEvaluationResult Evaluate(LinearLinkage lle, IRandom random, CancellationToken cancellationToken) { 132 132 var adjList = adjacencyListParameter.Value; 133 133 var llee = lle.ToEndLinks(); // LLE-e encoding uses the highest indexed member as group number 134 135 double quality = double.NaN; 134 136 135 137 switch (FitnessFunction) { … … 142 144 var mag = Math.Pow(10, -(int)Math.Ceiling(Math.Log10(llee.Length))); 143 145 // the value is e.g. 4.03 for 4 conflicts with 3 colors (and less than 100 nodes) 144 return conflicts + colors * mag; 146 quality = conflicts + colors * mag; 147 break; 145 148 } 146 149 case FitnessFunction.Penalized: { … … 157 160 if (color1 == color2) colors[color1].ConflictCount++; 158 161 } 159 return 2 * colors.Sum(x => x.Value.ColorCount * x.Value.ConflictCount) - colors.Sum(x => x.Value.ColorCount * x.Value.ColorCount); 162 quality = 2 * colors.Sum(x => x.Value.ColorCount * x.Value.ConflictCount) - colors.Sum(x => x.Value.ColorCount * x.Value.ColorCount); 163 break; 160 164 } 161 165 default: throw new InvalidOperationException(string.Format("Unknown fitness function {0}.", FitnessFunction)); 162 166 } 167 168 return new SingleObjectiveEvaluationResult(quality); 163 169 } 164 170
Note: See TracChangeset
for help on using the changeset viewer.