Changeset 8304 for branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.Knapsack/3.3/SimilarityCalculators/KnapsackSimilarityCalculator.cs
- Timestamp:
- 07/19/12 13:19:12 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.Knapsack/3.3/SimilarityCalculators/KnapsackSimilarityCalculator.cs
r8303 r8304 42 42 public static double CalculateSimilarity(BinaryVector left, BinaryVector right) { 43 43 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; 45 46 46 47 double similarity = 0.0; … … 50 51 } 51 52 52 p rotected 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; 55 56 56 57 return CalculateSimilarity(sol1, sol2);
Note: See TracChangeset
for help on using the changeset viewer.