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.Knapsack/3.3/SimilarityCalculators/KnapsackSimilarityCalculator.cs

    r8303 r8304  
    4242    public static double CalculateSimilarity(BinaryVector left, BinaryVector right) {
    4343      if (left == null || right == null)
    44         throw new ArgumentException("Cannot calculate similarity because one of the provided solutions or both are null.");
     44        throw new ArgumentException("Cannot calculate diversity because one or both of the provided scopes is null.");
     45      if (left == right) return 1.0;
    4546
    4647      double similarity = 0.0;
     
    5051    }
    5152
    52     protected override double CalculateSimilarity(IScope left, IScope right) {
    53       BinaryVector sol1 = left.Variables[Target].Value as BinaryVector;
    54       BinaryVector sol2 = right.Variables[Target].Value as BinaryVector;
     53    public override double CalculateIndividualSimilarity(IScope left, IScope right) {
     54      var sol1 = left.Variables[Target].Value as BinaryVector;
     55      var sol2 = right.Variables[Target].Value as BinaryVector;
    5556
    5657      return CalculateSimilarity(sol1, sol2);
Note: See TracChangeset for help on using the changeset viewer.