Changeset 14659 for trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/SimilarityCalculators
- Timestamp:
- 02/10/17 21:42:31 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/SimilarityCalculators
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/SimilarityCalculators/HammingSimilarityCalculator.cs
r14646 r14659 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 6Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 namespace HeuristicLab.Encodings. BinaryVectorEncoding {29 [Item("Hamming Similarity Calculator for BinaryVector", "Calculates the solution similarity based on the Hamming distance between two binaryvectors.")]28 namespace HeuristicLab.Encodings.RealVectorEncoding { 29 [Item("Hamming Similarity Calculator for RealVector", "Calculates the solution similarity based on the Hamming distance between two real vectors.")] 30 30 [StorableClass] 31 31 public sealed class HammingSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { … … 43 43 } 44 44 45 public static double CalculateSimilarity( BinaryVector left, BinaryVector right) {45 public static double CalculateSimilarity(RealVector left, RealVector right) { 46 46 if (left == null || right == null) 47 47 throw new ArgumentException("Cannot calculate similarity because one or both of the provided scopes is null."); … … 58 58 59 59 public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) { 60 var left = leftSolution.Variables[SolutionVariableName].Value as BinaryVector;61 var right = rightSolution.Variables[SolutionVariableName].Value as BinaryVector;60 var left = leftSolution.Variables[SolutionVariableName].Value as RealVector; 61 var right = rightSolution.Variables[SolutionVariableName].Value as RealVector; 62 62 63 63 return CalculateSimilarity(left, right);
Note: See TracChangeset
for help on using the changeset viewer.