Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/15 14:54:28 (10 years ago)
Author:
ascheibe
Message:

#2306 made comparers and initializers consistent

Location:
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/AverageBitBinaryVectorComparer.cs

    r12566 r12582  
    2727
    2828namespace HeuristicLab.Problems.NK {
    29 
    3029  [Item("Average Bit Binary Vector Comparer", "Compares two binary vectors by their average positive bit location")]
    3130  [StorableClass]
    32   public sealed class AverageBitBinaryVectorComparer : BinaryVectorComparer {
    33 
     31  public sealed class AverageBitBinaryVectorComparer : Item, IBinaryVectorComparer {
    3432    [StorableConstructor]
    3533    private AverageBitBinaryVectorComparer(bool deserializing) : base(deserializing) { }
    3634    private AverageBitBinaryVectorComparer(AverageBitBinaryVectorComparer original, Cloner cloner)
    37       : base(original, cloner) {
    38     }
     35      : base(original, cloner) { }
    3936    public AverageBitBinaryVectorComparer() { }
    4037    public override IDeepCloneable Clone(Cloner cloner) {
     
    4239    }
    4340
    44     public static double AverageBit(BinaryVector x) {
     41    private static double AverageBit(BinaryVector x) {
    4542      return x.Select((b, i) => new { b, i }).Where(v => v.b).Average(v => v.i);
    4643    }
    4744
    48     public override int Compare(BinaryVector x, BinaryVector y) {
     45    public int Compare(BinaryVector x, BinaryVector y) {
    4946      return (AverageBit(x) - AverageBit(y)).CompareTo(0);
    5047    }
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/IBinaryVectorComparer.cs

    r12569 r12582  
    2525
    2626namespace HeuristicLab.Problems.NK {
    27   public interface IBinaryVectorComparer : INamedItem, IComparer<BinaryVector> { }
     27  public interface IBinaryVectorComparer : IItem, IComparer<BinaryVector> { }
    2828}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/LexicographicBinaryVectorComparer.cs

    r12566 r12582  
    2727
    2828namespace HeuristicLab.Problems.NK {
    29 
    3029  [Item("Lexicographic Binary Vector Comparer", "Compares two binary vectors lexicographically")]
    3130  [StorableClass]
    32   public sealed class LexicographicBinaryVectorComparer : BinaryVectorComparer {
    33 
     31  public sealed class LexicographicBinaryVectorComparer : Item, IBinaryVectorComparer {
    3432    [StorableConstructor]
    3533    private LexicographicBinaryVectorComparer(bool deserializing) : base(deserializing) { }
    3634    private LexicographicBinaryVectorComparer(LexicographicBinaryVectorComparer original, Cloner cloner)
    37       : base(original, cloner) {
    38     }
     35      : base(original, cloner) { }
    3936    public LexicographicBinaryVectorComparer() { }
    4037    public override IDeepCloneable Clone(Cloner cloner) {
     
    4239    }
    4340
    44     public override int Compare(BinaryVector x, BinaryVector y) {
     41    public int Compare(BinaryVector x, BinaryVector y) {
    4542      for (int i = 0; i < Math.Min(x.Length, y.Length); i++) {
    4643        if (!x[i] && y[i])
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/BinaryVectorComparers/MedianBitBinaryVectorComparer.cs

    r12566 r12582  
    2727
    2828namespace HeuristicLab.Problems.NK {
    29 
    3029  [Item("Median Bit Binary Vector Comparer", "Compares two binary vectors by the median positive bit location")]
    3130  [StorableClass]
    32   public sealed class MedianBitBinaryVectorComparer : BinaryVectorComparer {
    33 
     31  public sealed class MedianBitBinaryVectorComparer : Item, IBinaryVectorComparer {
    3432    [StorableConstructor]
    3533    private MedianBitBinaryVectorComparer(bool deserializing) : base(deserializing) { }
    3634    private MedianBitBinaryVectorComparer(MedianBitBinaryVectorComparer original, Cloner cloner)
    37       : base(original, cloner) {
    38     }
     35      : base(original, cloner) { }
    3936    public MedianBitBinaryVectorComparer() { }
    4037    public override IDeepCloneable Clone(Cloner cloner) {
     
    4239    }
    4340
    44     public static int MedianBit(BinaryVector x) {
     41    private static int MedianBit(BinaryVector x) {
    4542      var activeIndices = x.Select((b, i) => new { b, i }).Where(v => v.b).ToList();
    4643      if (activeIndices.Count > 0)
     
    4946        return 0;
    5047    }
    51     public override int Compare(BinaryVector x, BinaryVector y) {
     48
     49    public int Compare(BinaryVector x, BinaryVector y) {
    5250      return MedianBit(x) - MedianBit(y);
    5351    }
Note: See TracChangeset for help on using the changeset viewer.