Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9443 for trunk/sources


Ignore:
Timestamp:
05/06/13 09:59:20 (12 years ago)
Author:
abeham
Message:

#2039: Changed similarity check in relative directed to use the same code as in relative undirected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/SimilarityCalculators/TSPSimilarityCalculator.cs

    r9413 r9443  
    7373
    7474    private static double CalculateRelativeDirected(Permutation left, Permutation right) {
    75       int[] edges = new int[right.Length];
    76       for (int i = 0; i < right.Length; i++)
    77         edges[right[i]] = right[(i + 1) % right.Length];
     75      int[] edgesR = CalculateEdgesVector(right);
     76      int[] edgesL = CalculateEdgesVector(left);
    7877
    7978      double similarity = 0.0;
    80       for (int i = 0; i < left.Length; i++)
    81         if (left[(i + 1) % left.Length] == edges[left[i]]) similarity++;
     79      for (int i = 0; i < left.Length; i++) {
     80        if (edgesL[i] == edgesR[i]) similarity++;
     81      }
    8282
    8383      return similarity / left.Length;
Note: See TracChangeset for help on using the changeset viewer.