Free cookie consent management tool by TermsFeed Policy Generator

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

#2306 made comparers and initializers consistent

Location:
branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/IInteractionInitializer.cs

    r12566 r12582  
    2424
    2525namespace HeuristicLab.Problems.NK {
    26   public interface IInteractionInitializer : INamedItem {
     26  public interface IInteractionInitializer : IItem {
    2727    BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random);
    2828  }
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/IncreasingBlockSizeInteractionsInitializer.cs

    r12566 r12582  
    2929
    3030namespace HeuristicLab.Problems.NK {
    31 
    3231  [Item("IncreasingBlockSizeInteractionsInitializer", "Randomly assignes interactions across all bits but makes sure that different numbers of ineractions are applied to different bits.")]
    3332  [StorableClass]
    34   public class IncreasingBlockSizeInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
    35 
     33  public sealed class IncreasingBlockSizeInteractionsInitializer : Item, IInteractionInitializer {
    3634    [StorableConstructor]
    37     protected IncreasingBlockSizeInteractionsInitializer(bool serializing) : base(serializing) { }
    38     protected IncreasingBlockSizeInteractionsInitializer(IncreasingBlockSizeInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
    39     public IncreasingBlockSizeInteractionsInitializer() {
    40     }
    41 
    42 
     35    private IncreasingBlockSizeInteractionsInitializer(bool serializing) : base(serializing) { }
     36    private IncreasingBlockSizeInteractionsInitializer(IncreasingBlockSizeInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
     37    public IncreasingBlockSizeInteractionsInitializer() { }
    4338    public override IDeepCloneable Clone(Cloner cloner) {
    4439      return new IncreasingBlockSizeInteractionsInitializer(this, cloner);
    4540    }
    4641
    47     #region IInteractionInitializer Members
    4842    public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) {
    4943      Dictionary<int, int> bitInteractionCounts = new Dictionary<int, int>();
     
    7771      return m;
    7872    }
    79     #endregion
    8073  }
    8174}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/LimitedRandomInteractionsInitializer.cs

    r12569 r12582  
    2929
    3030namespace HeuristicLab.Problems.NK {
    31 
    3231  [Item("LimitedRandomInteractionsInitializer", "Randomly assignes interactions across bits in the vicinity of each other respecting the maximum distances if possible.")]
    3332  [StorableClass]
    34   public class LimitedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
    35 
     33  public sealed class LimitedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
    3634    private class Bounds {
    3735      public readonly int Min;
     
    5351    }
    5452
     53    [StorableConstructor]
     54    private LimitedRandomInteractionsInitializer(bool serializing) : base(serializing) { }
     55    private LimitedRandomInteractionsInitializer(LimitedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
     56    public LimitedRandomInteractionsInitializer() {
     57      Parameters.Add(new ValueParameter<IntValue>("MaximumDistance", "Maximum distance of interactions in bits or 0 for unlimited"));
     58      Parameters.Add(new ValueParameter<DoubleValue>("MaximumDistanceRatio", "Maximum distance of interactions as ratio of the total length or 0 for unlimited"));
     59    }
     60
     61    public override IDeepCloneable Clone(Cloner cloner) {
     62      return new LimitedRandomInteractionsInitializer(this, cloner);
     63    }
     64
    5565    private int MaximumDistance(int length, int nInteractions) {
    5666      int maxBitDist = MaximumDistanceParameter.Value.Value;
     
    6474    }
    6575
    66     [StorableConstructor]
    67     protected LimitedRandomInteractionsInitializer(bool serializing) : base(serializing) { }
    68     protected LimitedRandomInteractionsInitializer(LimitedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
    69     public LimitedRandomInteractionsInitializer() {
    70       Parameters.Add(new ValueParameter<IntValue>("MaximumDistance", "Maximum distance of interactions in bits or 0 for unlimited"));
    71       Parameters.Add(new ValueParameter<DoubleValue>("MaximumDistanceRatio", "Maximum distance of interactions as ratio of the total length or 0 for unlimited"));
    72     }
    73 
    74     public override IDeepCloneable Clone(Cloner cloner) {
    75       return new LimitedRandomInteractionsInitializer(this, cloner);
    76     }
    77 
    78     #region IInteractionInitializer Members
    7976    public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) {
    8077      BoolMatrix m = new BoolMatrix(length, nComponents);
     
    9794      return m;
    9895    }
    99     #endregion
    10096  }
    10197}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/RandomInteractionsInitializer.cs

    r12566 r12582  
    2727
    2828namespace HeuristicLab.Problems.NK {
    29 
    3029  [Item("RandomInteractionsInitializer", "Randomly assignes interactions across all bits")]
    3130  [StorableClass]
    32   public class RandomInteractionsInitializer : NamedItem, IInteractionInitializer {
    33 
    34     public override bool CanChangeName { get { return false; } }
    35     public override bool CanChangeDescription { get { return false; } }
    36 
    37 
     31  public sealed class RandomInteractionsInitializer : Item, IInteractionInitializer {
    3832    [StorableConstructor]
    39     protected RandomInteractionsInitializer(bool serializing) : base(serializing) { }
    40     protected RandomInteractionsInitializer(RandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
    41     public RandomInteractionsInitializer() {
    42       name = ItemName;
    43       description = ItemDescription;
    44     }
     33    private RandomInteractionsInitializer(bool serializing) : base(serializing) { }
     34    private RandomInteractionsInitializer(RandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
     35    public RandomInteractionsInitializer() { }
    4536    public override IDeepCloneable Clone(Cloner cloner) {
    4637      return new RandomInteractionsInitializer(this, cloner);
    4738    }
    4839
    49     #region IInteractionInitializer Members
    5040    public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) {
    5141      BoolMatrix m = new BoolMatrix(length, nComponents);
     
    6555      return m;
    6656    }
    67     #endregion
    6857  }
    6958}
  • branches/FitnessLandscapeAnalysis/HeuristicLab.Problems.NK/InteractionInitializers/SortedRandomInteractionsInitializer.cs

    r12569 r12582  
    3030
    3131namespace HeuristicLab.Problems.NK {
    32 
    3332  [Item("SortedRandomInteractionsInitializer", "Randomly assigns interactions across all bits and sorts components according to bit affinity.")]
    3433  [StorableClass]
    35   public class SortedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
     34  public sealed class SortedRandomInteractionsInitializer : ParameterizedNamedItem, IInteractionInitializer {
    3635    public IConstrainedValueParameter<IBinaryVectorComparer> ComparerParameter {
    3736      get { return (IConstrainedValueParameter<IBinaryVectorComparer>)Parameters["Comparer"]; }
     
    4241
    4342    [StorableConstructor]
    44     protected SortedRandomInteractionsInitializer(bool serializing) : base(serializing) { }
    45     protected SortedRandomInteractionsInitializer(SortedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
     43    private SortedRandomInteractionsInitializer(bool serializing) : base(serializing) { }
     44    private SortedRandomInteractionsInitializer(SortedRandomInteractionsInitializer original, Cloner cloner) : base(original, cloner) { }
    4645    public SortedRandomInteractionsInitializer() {
    4746      Parameters.Add(new ConstrainedValueParameter<IBinaryVectorComparer>("Comparer", "Comparison for sorting of component functions."));
     
    5958    }
    6059
    61     #region IInteractionInitializer Members
    6260    public BoolMatrix InitializeInterations(int length, int nComponents, int nInteractions, IRandom random) {
    6361      BinaryVector[] components = Enumerable.Range(0, nComponents).Select(i => new BinaryVector(length)).ToArray();
     
    8381      return m;
    8482    }
    85     #endregion
    8683  }
    8784}
Note: See TracChangeset for help on using the changeset viewer.