- Timestamp:
- 07/12/17 21:02:01 (7 years ago)
- Location:
- stable
- Files:
-
- 3 edited
- 1 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.PermutationEncoding
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.PermutationEncoding merged: 14659-14660,15067,15162
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Encodings.PermutationEncoding/3.3/SimilarityCalculators/HammingSimilarityCalculator.cs
r14659 r15217 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Optimization.Operators; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 27 28 namespace HeuristicLab.Encodings.PermutationEncoding { 28 29 [Item("Hamming Similarity Calculator for Permutation", "An operator that performs similarity calculation between two permutation-encoded solutions.")] 30 [StorableClass] 29 31 public sealed class HammingSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator { 30 32 protected override bool IsCommutative { get { return true; } } 31 33 34 [StorableConstructor] 32 35 private HammingSimilarityCalculator(bool deserializing) : base(deserializing) { } 33 36 private HammingSimilarityCalculator(HammingSimilarityCalculator original, Cloner cloner) : base(original, cloner) { } … … 40 43 public static double CalculateSimilarity(Permutation left, Permutation right) { 41 44 if (left == null || right == null) 42 throw new ArgumentException("Cannot calculate similarity because one o f the provided solutions or both arenull.");45 throw new ArgumentException("Cannot calculate similarity because one or both of the provided solutions is null."); 43 46 if (left.PermutationType != right.PermutationType) 44 throw new ArgumentException("Cannot calculate similarity because the provided solutions have different types.");47 throw new ArgumentException("Cannot calculate similarity because the provided solutions have different permutation types."); 45 48 if (left.Length != right.Length) 46 49 throw new ArgumentException("Cannot calculate similarity because the provided solutions have different lengths."); 47 if (object.ReferenceEquals(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; 48 53 49 54 switch (left.PermutationType) {
Note: See TracChangeset
for help on using the changeset viewer.