Changeset 12149


Ignore:
Timestamp:
03/06/15 13:07:20 (3 years ago)
Author:
pfleck
Message:

#2269 Removed AgingScheme type which inherited from EnumValue. Instead used EnumValue directly.

Location:
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AgingScheme.cs

    r12018 r12149  
    2020#endregion
    2121
    22 using HeuristicLab.Common;
    23 using HeuristicLab.Core;
    24 using HeuristicLab.Data;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 
    2722namespace HeuristicLab.Algorithms.ALPS {
    28   public enum AgingSchemes {
     23  public enum AgingScheme {
    2924    Linear,
    3025    Fibonacci,
     
    3227    Exponential
    3328  }
    34 
    35   [Item("AgingScheme", "Represents a certain type of an aging scheme.")]
    36   [StorableClass]
    37   public class AgingScheme : EnumValue<AgingSchemes> {
    38     [StorableConstructor]
    39     protected AgingScheme(bool deserializing) : base(deserializing) { }
    40     protected AgingScheme(AgingScheme original, Cloner cloner) : base(original, cloner) { }
    41 
    42     public AgingScheme() : base(AgingSchemes.Linear) { }
    43     public AgingScheme(AgingSchemes type) : base(type) { }
    44 
    45     public override IDeepCloneable Clone(Cloner cloner) {
    46       return new AgingScheme(this, cloner);
    47     }
    48   }
    4929}
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AgingSchemeCalculator.cs

    r12119 r12149  
    2727namespace HeuristicLab.Algorithms.ALPS {
    2828  public static class AgingSchemeCalculator {
    29     public static IntArray CalculateAgeLimits(AgingSchemes scheme, int ageGap, int numberOfLayers) {
     29    public static IntArray CalculateAgeLimits(AgingScheme scheme, int ageGap, int numberOfLayers) {
    3030      IEnumerable<int> schemeGenerator;
    3131      switch (scheme) {
    32         case AgingSchemes.Linear: schemeGenerator = LinearAgingScheme(); break;
    33         case AgingSchemes.Fibonacci: schemeGenerator = FibonacciAgingScheme(); break;
    34         case AgingSchemes.Polynomial: schemeGenerator = PolynomialAgingScheme(2); break;
    35         case AgingSchemes.Exponential: schemeGenerator = ExponentialAgingScheme(2); break;
     32        case AgingScheme.Linear: schemeGenerator = LinearAgingScheme(); break;
     33        case AgingScheme.Fibonacci: schemeGenerator = FibonacciAgingScheme(); break;
     34        case AgingScheme.Polynomial: schemeGenerator = PolynomialAgingScheme(2); break;
     35        case AgingScheme.Exponential: schemeGenerator = ExponentialAgingScheme(2); break;
    3636        default: throw new NotSupportedException("Aging Scheme " + scheme + " is not supported.");
    3737      }
  • branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Alps.cs

    r12138 r12149  
    6666      get { return (IValueParameter<IntValue>)Parameters["NumberOfLayers"]; }
    6767    }
    68     private IValueParameter<AgingScheme> AgingSchemeParameter {
    69       get { return (IValueParameter<AgingScheme>)Parameters["AgingScheme"]; }
     68    private IValueParameter<EnumValue<AgingScheme>> AgingSchemeParameter {
     69      get { return (IValueParameter<EnumValue<AgingScheme>>)Parameters["AgingScheme"]; }
    7070    }
    7171    private IValueParameter<IntValue> AgeGapParameter {
     
    105105      set { NumberOfLayersParameter.Value = value; }
    106106    }
    107     public AgingScheme AgingScheme {
     107    public EnumValue<AgingScheme> AgingScheme {
    108108      get { return AgingSchemeParameter.Value; }
    109109      set { AgingSchemeParameter.Value = value; }
     
    164164      Parameters.Add(new FixedValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer()));
    165165      Parameters.Add(new ValueParameter<IntValue>("NumberOfLayers", "The number of layers.", new IntValue(10)));
    166       Parameters.Add(new ValueParameter<AgingScheme>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new AgingScheme(AgingSchemes.Polynomial)));
     166      Parameters.Add(new ValueParameter<EnumValue<AgingScheme>>("AgingScheme", "The aging scheme for setting the age-limits for the layers.", new EnumValue<AgingScheme>(ALPS.AgingScheme.Polynomial)));
    167167      Parameters.Add(new ValueParameter<IntValue>("AgeGap", "The frequency of reseeding the lowest layer and scaling factor for the age-limits for the layers", new IntValue(20)));
    168168      Parameters.Add(new ValueParameter<IntArray>("AgeLimits", new IntArray(new int[0])) { Hidden = true });
Note: See TracChangeset for help on using the changeset viewer.