Changeset 12149
- Timestamp:
- 03/06/15 13:07:20 (10 years ago)
- 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 20 20 #endregion 21 21 22 using HeuristicLab.Common;23 using HeuristicLab.Core;24 using HeuristicLab.Data;25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;26 27 22 namespace HeuristicLab.Algorithms.ALPS { 28 public enum AgingScheme s{23 public enum AgingScheme { 29 24 Linear, 30 25 Fibonacci, … … 32 27 Exponential 33 28 } 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 }49 29 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/AgingSchemeCalculator.cs
r12119 r12149 27 27 namespace HeuristicLab.Algorithms.ALPS { 28 28 public static class AgingSchemeCalculator { 29 public static IntArray CalculateAgeLimits(AgingScheme sscheme, int ageGap, int numberOfLayers) {29 public static IntArray CalculateAgeLimits(AgingScheme scheme, int ageGap, int numberOfLayers) { 30 30 IEnumerable<int> schemeGenerator; 31 31 switch (scheme) { 32 case AgingScheme s.Linear: schemeGenerator = LinearAgingScheme(); break;33 case AgingScheme s.Fibonacci: schemeGenerator = FibonacciAgingScheme(); break;34 case AgingScheme s.Polynomial: schemeGenerator = PolynomialAgingScheme(2); break;35 case AgingScheme s.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; 36 36 default: throw new NotSupportedException("Aging Scheme " + scheme + " is not supported."); 37 37 } -
branches/ALPS/HeuristicLab.Algorithms.ALPS/3.3/Alps.cs
r12138 r12149 66 66 get { return (IValueParameter<IntValue>)Parameters["NumberOfLayers"]; } 67 67 } 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"]; } 70 70 } 71 71 private IValueParameter<IntValue> AgeGapParameter { … … 105 105 set { NumberOfLayersParameter.Value = value; } 106 106 } 107 public AgingSchemeAgingScheme {107 public EnumValue<AgingScheme> AgingScheme { 108 108 get { return AgingSchemeParameter.Value; } 109 109 set { AgingSchemeParameter.Value = value; } … … 164 164 Parameters.Add(new FixedValueParameter<MultiAnalyzer>("LayerAnalyzer", "The operator used to analyze each layer.", new MultiAnalyzer())); 165 165 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))); 167 167 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))); 168 168 Parameters.Add(new ValueParameter<IntArray>("AgeLimits", new IntArray(new int[0])) { Hidden = true });
Note: See TracChangeset
for help on using the changeset viewer.