Changeset 15217 for stable/HeuristicLab.Encodings.IntegerVectorEncoding
- Timestamp:
- 07/12/17 21:02:01 (8 years ago)
- Location:
- stable
- Files:
-
- 4 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
stable ¶
- Property svn:mergeinfo changed
/trunk/sources merged: 14412,14475-14476,14659-14660,14663,14912,15050,15067,15069,15079,15162,15166,15172-15173
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Encodings.IntegerVectorEncoding ¶
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding merged: 14659-14660,15067,15162
- Property svn:mergeinfo changed
-
TabularUnified stable/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj ¶
r12005 r15217 130 130 <Compile Include="Crossovers\RoundedUniformArithmeticCrossover.cs" /> 131 131 <Compile Include="IntegerVectorEncoding.cs" /> 132 <Compile Include="IntegerVectorEqualityComparer.cs" /> 132 133 <Compile Include="IntegerVectorOperator.cs" /> 133 134 <Compile Include="Interfaces\IBoundedIntegerVectorOperator.cs" /> … … 146 147 <Compile Include="Manipulators\RoundedNormalAllPositionsManipulator.cs" /> 147 148 <Compile Include="Manipulators\SelfAdaptiveRoundedNormalAllPositionsManipulator.cs" /> 149 <Compile Include="SimilarityCalculators\EuclideanSimilarityCalculator.cs" /> 150 <Compile Include="SimilarityCalculators\HammingSimilarityCalculator.cs" /> 148 151 <Compile Include="StrategyParameters\StdDevStrategyVectorCreator.cs" /> 149 152 <Compile Include="StrategyParameters\StdDevStrategyVectorCrossover.cs" /> -
TabularUnified stable/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorEqualityComparer.cs ¶
r14660 r15217 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.IntegerVectorEncoding { 27 [NonDiscoverableType] 25 28 public class IntegerVectorEqualityComparer : EqualityComparer<IntegerVector> { 26 29 public override bool Equals(IntegerVector x, IntegerVector y) { 27 if ( x == null && y == null) return true;30 if (ReferenceEquals(x, y)) return true; 28 31 if (x == null || y == null) return false; 29 32 if (x.Length != y.Length) return false; … … 34 37 35 38 public override int GetHashCode(IntegerVector obj) { 39 if (obj == null) throw new ArgumentNullException("obj", "IntegerVectorEqualityComparer: Cannot compute hash value of null."); 36 40 unchecked { 37 41 int hash = 17; -
TabularUnified stable/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/SimilarityCalculators/HammingSimilarityCalculator.cs ¶
r14659 r15217 45 45 public static double CalculateSimilarity(IntegerVector left, IntegerVector 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.