Changeset 15067 for trunk/sources/HeuristicLab.Encodings.RealVectorEncoding
- Timestamp:
- 06/26/17 23:13:15 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/HeuristicLab.Encodings.RealVectorEncoding-3.3.csproj ¶
r14660 r15067 183 183 <Compile Include="ReflectiveBoundsChecker.cs" /> 184 184 <Compile Include="ShakingOperators\RealVectorShakingOperator.cs" /> 185 <Compile Include="SimilarityCalculators\EuclideanSimilarityCalculator.cs" /> 185 186 <Compile Include="SimilarityCalculators\HammingSimilarityCalculator.cs" /> 186 187 <Compile Include="StrategyParameters\StdDevStrategyVectorCreator.cs" /> -
TabularUnified trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/RealVectorEqualityComparer.cs ¶
r14659 r15067 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using HeuristicLab.PluginInfrastructure; 23 25 24 26 namespace HeuristicLab.Encodings.RealVectorEncoding { 27 [NonDiscoverableType] 25 28 public class RealVectorEqualityComparer : EqualityComparer<RealVector> { 26 29 public override bool Equals(RealVector x, RealVector y) { 27 30 if (x == null && y == null) return true; 28 31 if (x == null || y == null) return false; 32 if (ReferenceEquals(x, y)) return true; 29 33 if (x.Length != y.Length) return false; 30 34 for (var i = 0; i < x.Length; i++) … … 34 38 35 39 public override int GetHashCode(RealVector obj) { 40 if (obj == null) throw new ArgumentNullException("obj", "RealVectorEqualityComparer: Cannot compute hash value of null."); 36 41 unchecked { 37 42 int hash = 17; -
TabularUnified trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/SimilarityCalculators/HammingSimilarityCalculator.cs ¶
r14659 r15067 45 45 public static double CalculateSimilarity(RealVector left, RealVector right) { 46 46 if (left == null || right == null) 47 throw new ArgumentException("Cannot calculate similarity because one or both of the provided s copes is null.");47 throw new ArgumentException("Cannot calculate similarity because one or both of the provided solutions is null."); 48 48 if (left.Length != right.Length) 49 49 throw new ArgumentException("Cannot calculate similarity because the provided solutions have different lengths."); 50 if (left == right) return 1.0; 50 if (left.Length == 0) 51 throw new ArgumentException("Cannot calculate similarity because solutions are of length 0."); 52 if (ReferenceEquals(left, right)) return 1.0; 51 53 52 54 double similarity = 0.0;
Note: See TracChangeset
for help on using the changeset viewer.