Changeset 12313 for branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators
- Timestamp:
- 04/14/15 15:17:23 (10 years ago)
- Location:
- branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs
r12012 r12313 36 36 ISymbolicExpressionTreeSizeConstraintOperator, 37 37 ISymbolicExpressionTreeGrammarBasedOperator { 38 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";39 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";40 41 #region Parameter Properties42 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {43 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }44 }45 46 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {47 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }48 }49 #endregion50 #region Properties51 public IntValue MaximumSymbolicExpressionTreeDepth {52 get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; }53 }54 55 public IntValue MaximumSymbolicExpressionTreeLength {56 get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }57 }58 59 #endregion60 38 61 39 [StorableConstructor] … … 63 41 protected FullTreeCreator(FullTreeCreator original, Cloner cloner) : base(original, cloner) { } 64 42 65 public FullTreeCreator() 66 : base() { 67 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, 68 "The maximal length (number of nodes) of the symbolic expression tree (this parameter is ignored).")); 69 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, 70 "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); 71 } 43 public FullTreeCreator() : base() { } 72 44 73 45 public override IDeepCloneable Clone(Cloner cloner) { … … 77 49 78 50 protected override ISymbolicExpressionTree Create(IRandom random) { 79 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value); 51 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, 52 MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value, MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value); 80 53 } 81 54 -
branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs
r12012 r12313 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Core; 26 using HeuristicLab.Data;27 using HeuristicLab.Parameters;28 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 27 using HeuristicLab.PluginInfrastructure; … … 33 31 [StorableClass] 34 32 [Item("GrowTreeCreator", "An operator that creates new symbolic expression trees using the 'Grow' method")] 35 public class GrowTreeCreator : SymbolicExpressionTreeCreator, 36 ISymbolicExpressionTreeSizeConstraintOperator, 37 ISymbolicExpressionTreeGrammarBasedOperator { 38 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 39 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 40 41 #region Parameter Properties 42 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter { 43 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; } 44 } 45 46 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter { 47 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; } 48 } 49 50 #endregion 51 #region Properties 52 public IntValue MaximumSymbolicExpressionTreeDepth { 53 get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; } 54 } 55 56 public IntValue MaximumSymbolicExpressionTreeLength { 57 get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; } 58 } 59 #endregion 60 33 public class GrowTreeCreator : SymbolicExpressionTreeCreator { 61 34 [StorableConstructor] 62 35 protected GrowTreeCreator(bool deserializing) : base(deserializing) { } 63 36 protected GrowTreeCreator(GrowTreeCreator original, Cloner cloner) : base(original, cloner) { } 64 37 65 public GrowTreeCreator() 66 : base() { 67 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, 68 "The maximal length (number of nodes) of the symbolic expression tree (this parameter is ignored).")); 69 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, 70 "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); 71 } 38 public GrowTreeCreator() : base() { } 72 39 73 40 public override IDeepCloneable Clone(Cloner cloner) { … … 78 45 protected override ISymbolicExpressionTree Create(IRandom random) { 79 46 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, 80 MaximumSymbolicExpressionTreeLength .Value, MaximumSymbolicExpressionTreeDepth.Value);47 MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value, MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value); 81 48 } 82 49 -
branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs
r12012 r12313 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Data;28 using HeuristicLab.Parameters;29 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 28 using HeuristicLab.PluginInfrastructure; … … 37 35 ISymbolicExpressionTreeSizeConstraintOperator, ISymbolicExpressionTreeGrammarBasedOperator { 38 36 private const int MAX_TRIES = 100; 39 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";40 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth";41 #region Parameter Properties42 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {43 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }44 }45 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter {46 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; }47 }48 #endregion49 #region Properties50 public IntValue MaximumSymbolicExpressionTreeLength {51 get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; }52 }53 public IntValue MaximumSymbolicExpressionTreeDepth {54 get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; }55 }56 #endregion57 37 58 38 [StorableConstructor] … … 61 41 public ProbabilisticTreeCreator() 62 42 : base() { 63 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree.")); 64 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); 43 65 44 } 66 45 … … 71 50 72 51 protected override ISymbolicExpressionTree Create(IRandom random) { 73 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value); 52 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, 53 MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value, MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value); 74 54 } 75 55 -
branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/RampedHalfAndHalfTreeCreator.cs
r12012 r12313 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 using HeuristicLab.Parameters;26 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 25 using HeuristicLab.PluginInfrastructure; … … 31 29 [StorableClass] 32 30 [Item("RampedHalfAndHalfTreeCreator", "An operator that creates new symbolic expression trees in an alternate way: half the trees are created usign the 'Grow' method while the other half are created using the 'Full' method")] 33 public class RampedHalfAndHalfTreeCreator : SymbolicExpressionTreeCreator, 34 ISymbolicExpressionTreeSizeConstraintOperator, 35 ISymbolicExpressionTreeGrammarBasedOperator { 36 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 37 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 38 39 #region Parameter Properties 40 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter { 41 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; } 42 } 43 44 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter { 45 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; } 46 } 47 48 #endregion 49 #region Properties 50 public IntValue MaximumSymbolicExpressionTreeDepth { 51 get { return MaximumSymbolicExpressionTreeDepthParameter.ActualValue; } 52 } 53 54 public IntValue MaximumSymbolicExpressionTreeLength { 55 get { return MaximumSymbolicExpressionTreeLengthParameter.ActualValue; } 56 } 57 #endregion 58 31 public class RampedHalfAndHalfTreeCreator : SymbolicExpressionTreeCreator { 59 32 [StorableConstructor] 60 33 protected RampedHalfAndHalfTreeCreator(bool deserializing) : base(deserializing) { } 61 34 protected RampedHalfAndHalfTreeCreator(RampedHalfAndHalfTreeCreator original, Cloner cloner) : base(original, cloner) { } 62 35 63 public RampedHalfAndHalfTreeCreator() 64 : base() { 65 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, 66 "The maximal length (number of nodes) of the symbolic expression tree (this parameter is ignored).")); 67 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, 68 "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); 69 } 36 public RampedHalfAndHalfTreeCreator() : base() { } 70 37 71 38 public override IDeepCloneable Clone(Cloner cloner) { … … 74 41 75 42 protected override ISymbolicExpressionTree Create(IRandom random) { 76 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, MaximumSymbolicExpressionTreeLength.Value, MaximumSymbolicExpressionTreeDepth.Value); 43 return Create(random, ClonedSymbolicExpressionTreeGrammarParameter.ActualValue, 44 MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value, MaximumSymbolicExpressionTreeDepthParameter.ActualValue.Value); 77 45 } 78 46 -
branches/SymbolicExpressionTreeEncoding/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/SymbolicExpressionTreeCreator.cs
r12012 r12313 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Parameters; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 32 33 [StorableClass] 33 34 public abstract class SymbolicExpressionTreeCreator : SymbolicExpressionTreeOperator, ISymbolicExpressionTreeCreator { 35 private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength"; 36 private const string MaximumSymbolicExpressionTreeDepthParameterName = "MaximumSymbolicExpressionTreeDepth"; 37 34 38 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 35 39 private const string SymbolicExpressionTreeGrammarParameterName = "SymbolicExpressionTreeGrammar"; … … 37 41 38 42 #region Parameter Properties 43 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter { 44 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; } 45 } 46 public IValueLookupParameter<IntValue> MaximumSymbolicExpressionTreeDepthParameter { 47 get { return (IValueLookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeDepthParameterName]; } 48 } 49 39 50 public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter { 40 51 get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; } … … 55 66 protected SymbolicExpressionTreeCreator() 56 67 : base() { 68 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "The maximal length (number of nodes) of the symbolic expression tree.")); 69 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumSymbolicExpressionTreeDepthParameterName, "The maximal depth of the symbolic expression tree (a tree with one node has depth = 0).")); 70 57 71 Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree that should be created.")); 58 72 Parameters.Add(new ValueLookupParameter<ISymbolicExpressionGrammar>(SymbolicExpressionTreeGrammarParameterName,
Note: See TracChangeset
for help on using the changeset viewer.