Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/12/17 21:02:01 (7 years ago)
Author:
abeham
Message:

#2666, #2706, #2730, #2736: merged revisions 14412, 14475, 14476, 14659, 14660, 14663, 14779, 14780, 14912, 15050, 15067, 15069, 15079, 15162, 15166, 15172, 15173 to stable

Location:
stable
Files:
4 edited
3 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Encodings.IntegerVectorEncoding

  • stable/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/HeuristicLab.Encodings.IntegerVectorEncoding-3.3.csproj

    r12005 r15217  
    130130    <Compile Include="Crossovers\RoundedUniformArithmeticCrossover.cs" />
    131131    <Compile Include="IntegerVectorEncoding.cs" />
     132    <Compile Include="IntegerVectorEqualityComparer.cs" />
    132133    <Compile Include="IntegerVectorOperator.cs" />
    133134    <Compile Include="Interfaces\IBoundedIntegerVectorOperator.cs" />
     
    146147    <Compile Include="Manipulators\RoundedNormalAllPositionsManipulator.cs" />
    147148    <Compile Include="Manipulators\SelfAdaptiveRoundedNormalAllPositionsManipulator.cs" />
     149    <Compile Include="SimilarityCalculators\EuclideanSimilarityCalculator.cs" />
     150    <Compile Include="SimilarityCalculators\HammingSimilarityCalculator.cs" />
    148151    <Compile Include="StrategyParameters\StdDevStrategyVectorCreator.cs" />
    149152    <Compile Include="StrategyParameters\StdDevStrategyVectorCrossover.cs" />
  • stable/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorEqualityComparer.cs

    r14660 r15217  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
     24using HeuristicLab.PluginInfrastructure;
    2325
    2426namespace HeuristicLab.Encodings.IntegerVectorEncoding {
     27  [NonDiscoverableType]
    2528  public class IntegerVectorEqualityComparer : EqualityComparer<IntegerVector> {
    2629    public override bool Equals(IntegerVector x, IntegerVector y) {
    27       if (x == null && y == null) return true;
     30      if (ReferenceEquals(x, y)) return true;
    2831      if (x == null || y == null) return false;
    2932      if (x.Length != y.Length) return false;
     
    3437
    3538    public override int GetHashCode(IntegerVector obj) {
     39      if (obj == null) throw new ArgumentNullException("obj", "IntegerVectorEqualityComparer: Cannot compute hash value of null.");
    3640      unchecked {
    3741        int hash = 17;
  • stable/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/SimilarityCalculators/HammingSimilarityCalculator.cs

    r14659 r15217  
    4545    public static double CalculateSimilarity(IntegerVector left, IntegerVector right) {
    4646      if (left == null || right == null)
    47         throw new ArgumentException("Cannot calculate similarity because one or both of the provided scopes is null.");
     47        throw new ArgumentException("Cannot calculate similarity because one or both of the provided solutions is null.");
    4848      if (left.Length != right.Length)
    4949        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;
    5153
    5254      double similarity = 0.0;
Note: See TracChangeset for help on using the changeset viewer.