Changeset 8319 for branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs
- Timestamp:
- 07/24/12 15:04:37 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs
r8304 r8319 32 32 /// An operator that performs similarity calculation between two test functions solutions. 33 33 /// </summary> 34 /// <remarks> 35 /// The operator calculates the similarity based on the euclidean distance of the two solutions in n-dimensional space. 36 /// </remarks> 34 37 [Item("SingleObjectiveTestFunctionSimilarityCalculator", "An operator that performs similarity calculation between two test functions solutions.")] 35 38 [StorableClass] 36 public sealed class SingleObjectiveTestFunctionSimilarityCalculator : Si milarityCalculator {39 public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 37 40 #region Properties 38 41 [Storable] … … 57 60 if (bounds == null) 58 61 throw new ArgumentException("Cannot calculate similarity because no bounds were provided."); 62 if (left.Length != right.Length) 63 throw new ArgumentException("Cannot calculate similarity because the provided solutions have different lengths."); 59 64 if (left == right) return 1.0; 60 65 … … 72 77 } 73 78 74 public override double Calculate IndividualSimilarity(IScope left, IScope right) {75 var sol1 = left .Variables[Target].Value as RealVector;76 var sol2 = right .Variables[Target].Value as RealVector;79 public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) { 80 var sol1 = leftSolution.Variables[SolutionVariableName].Value as RealVector; 81 var sol2 = rightSolution.Variables[SolutionVariableName].Value as RealVector; 77 82 78 83 return CalculateSimilarity(sol1, sol2, Bounds);
Note: See TracChangeset
for help on using the changeset viewer.