Changeset 8322 for branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TravelingSalesman/3.3/SimilarityCalculators
- Timestamp:
- 07/25/12 10:14:58 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TravelingSalesman/3.3/SimilarityCalculators/TSPSimilarityCalculator.cs
r8319 r8322 67 67 private static double CalculateAbsolute(Permutation left, Permutation right) { 68 68 double similarity = 0.0; 69 for (int i = 0; i < left.Length && left[i] == right[i]; similarity = ++i) ; 69 for (int i = 0; i < left.Length; i++) 70 if (left[i] == right[i]) similarity++; 71 70 72 return similarity / left.Length; 71 73 } 72 74 73 75 private static double CalculateRelativeDirected(Permutation left, Permutation right) { 74 throw new NotImplementedException(); 76 int[] edges = new int[right.Length]; 77 for (int i = 0; i < right.Length; i++) 78 edges[right[i]] = right[(i + 1) % right.Length]; 79 80 double similarity = 0.0; 81 for (int i = 0; i < left.Length; i++) 82 if (left[(i + 1) % left.Length] == edges[left[i]]) similarity++; 83 84 return similarity / left.Length; 75 85 } 76 86
Note: See TracChangeset
for help on using the changeset viewer.