Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/19/12 13:19:12 (12 years ago)
Author:
jkarder
Message:

#1331: added support for similarity calculation between multiple individuals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TravelingSalesman/3.3/SimilarityCalculators/TSPSimilarityCalculator.cs

    r8303 r8304  
    4343      if (left == null || right == null)
    4444        throw new ArgumentException("Cannot calculate similarity because one of the provided solutions or both are null.");
     45      if (left == right) return 1.0;
    4546
    4647      int[,] edges = new int[right.Length, 2];
     
    6061    }
    6162
    62     protected override double CalculateSimilarity(IScope left, IScope right) {
    63       Permutation sol1 = left.Variables[Target].Value as Permutation;
    64       Permutation sol2 = right.Variables[Target].Value as Permutation;
     63    public override double CalculateIndividualSimilarity(IScope left, IScope right) {
     64      var sol1 = left.Variables[Target].Value as Permutation;
     65      var sol2 = right.Variables[Target].Value as Permutation;
    6566
    6667      return CalculateSimilarity(sol1, sol2);
Note: See TracChangeset for help on using the changeset viewer.