Changeset 7558 for trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPCoordinatesPathEvaluator.cs
- Timestamp:
- 03/06/12 01:43:06 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPCoordinatesPathEvaluator.cs
r7259 r7558 73 73 } 74 74 75 public static double Apply(TSPCoordinatesPathEvaluator evaluator, DoubleMatrix coordinates, Permutation tour) { 76 DoubleMatrix c = coordinates; 77 Permutation p = tour; 78 double length = 0; 79 for (int i = 0; i < p.Length - 1; i++) 80 length += evaluator.CalculateDistance(c[p[i], 0], c[p[i], 1], c[p[i + 1], 0], c[p[i + 1], 1]); 81 length += evaluator.CalculateDistance(c[p[p.Length - 1], 0], c[p[p.Length - 1], 1], c[p[0], 0], c[p[0], 1]); 82 return length; 83 } 84 75 85 public sealed override IOperation Apply() { 76 86 if (UseDistanceMatrixParameter.ActualValue.Value) {
Note: See TracChangeset
for help on using the changeset viewer.