Changeset 3710 for trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers
- Timestamp:
- 05/07/10 21:10:46 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAvgMaxSymbolicExpressionTreeSizeAnalyzer.cs
r3683 r3710 33 33 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces; 34 34 using System; 35 using HeuristicLab.Optimization.Operators; 35 36 36 37 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Analyzers { … … 43 44 private const string SymbolicExpressionTreeParameterName = "SymbolicExpressionTree"; 44 45 private const string SymbolicExpressionTreeSizeParameterName = "SymbolicExpressionTreeSize"; 45 private const string SymbolicExpressionTreeSizesParameterName = "SymbolicExpressionTreeSizes"; 46 private const string SymbolicExpressionTreeSizesParameterName = "Symbolic expression tree size"; 47 private const string MinTreeSizeParameterName = "Min tree size"; 48 private const string AverageTreeSizeParameterName = "Average tree size"; 49 private const string MaxTreeSizeParameterName = "Max tree size"; 46 50 private const string ResultsParameterName = "Results"; 47 51 … … 59 63 get { return (ValueLookupParameter<VariableCollection>)Parameters[ResultsParameterName]; } 60 64 } 61 65 62 66 [Storable] 63 67 private MinAverageMaxValueAnalyzer valueAnalyzer; 64 68 [Storable] 65 private SymbolicExpressionTreeSizeCalculator sizeCalculator;69 private UniformSubScopesProcessor subScopesProcessor; 66 70 67 71 #endregion … … 73 77 Parameters.Add(new ValueLookupParameter<VariableCollection>(ResultsParameterName, "The results collection where the analysis values should be stored.")); 74 78 75 sizeCalculator = new SymbolicExpressionTreeSizeCalculator(); 79 subScopesProcessor = new UniformSubScopesProcessor(); 80 SymbolicExpressionTreeSizeCalculator sizeCalculator = new SymbolicExpressionTreeSizeCalculator(); 76 81 valueAnalyzer = new MinAverageMaxValueAnalyzer(); 82 83 subScopesProcessor.Depth.Value = SymbolicExpressionTreeParameter.Depth; 77 84 sizeCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name; 78 sizeCalculator.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth;79 85 sizeCalculator.SymbolicExpressionTreeSizeParameter.ActualName = SymbolicExpressionTreeSizeParameter.Name; 80 sizeCalculator.SymbolicExpressionTreeSizeParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth;81 86 valueAnalyzer.ValueParameter.ActualName = sizeCalculator.SymbolicExpressionTreeSizeParameter.Name; 82 87 valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth; 88 valueAnalyzer.AverageValueParameter.ActualName = AverageTreeSizeParameterName; 89 valueAnalyzer.CollectAverageValueInResultsParameter.Value = new BoolValue(false); 90 valueAnalyzer.MaxValueParameter.ActualName = MaxTreeSizeParameterName; 91 valueAnalyzer.CollectMaxValueInResultsParameter.Value = new BoolValue(false); 92 valueAnalyzer.MinValueParameter.ActualName = MinTreeSizeParameterName; 93 valueAnalyzer.CollectMinValueInResultsParameter.Value = new BoolValue(false); 83 94 valueAnalyzer.ValuesParameter.ActualName = SymbolicExpressionTreeSizesParameter.Name; 84 valueAnalyzer.ResultsParameter.ActualName = ResultsParameter.Name;85 valueAnalyzer.AverageValueParameter.ActualName = "Avg. Tree Size";86 valueAnalyzer.MaxValueParameter.ActualName = "Max Tree Size";87 valueAnalyzer.MinValueParameter.ActualName = "Min Tree Size";88 95 89 OperatorGraph.InitialOperator = sizeCalculator; 90 sizeCalculator.Successor = valueAnalyzer; 96 OperatorGraph.InitialOperator = subScopesProcessor; 97 subScopesProcessor.Operator = sizeCalculator; 98 sizeCalculator.Successor = null; 99 subScopesProcessor.Successor = valueAnalyzer; 91 100 valueAnalyzer.Successor = null; 92 101 … … 119 128 private void OnDepthParameterChanged() { 120 129 valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth; 121 sizeCalculator.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth; 122 sizeCalculator.SymbolicExpressionTreeSizeParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth; 130 subScopesProcessor.Depth.Value = SymbolicExpressionTreeParameter.Depth; 123 131 } 124 132 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/SymbolicExpressionTreeSizeCalculator.cs
r3683 r3710 42 42 43 43 #region parameter properties 44 public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {45 get { return ( ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }44 public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { 45 get { return (ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; } 46 46 } 47 public ScopeTreeLookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter {48 get { return ( ScopeTreeLookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; }47 public ILookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter { 48 get { return (ILookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; } 49 49 } 50 50 #endregion 51 51 52 52 #region properties 53 public ItemArray<SymbolicExpressionTree>SymbolicExpressionTree {53 public SymbolicExpressionTree SymbolicExpressionTree { 54 54 get { return SymbolicExpressionTreeParameter.ActualValue; } 55 55 } 56 public ItemArray<DoubleValue>SymbolicExpressionTreeSize {56 public DoubleValue SymbolicExpressionTreeSize { 57 57 get { return SymbolicExpressionTreeSizeParameter.ActualValue; } 58 58 set { SymbolicExpressionTreeSizeParameter.ActualValue = value; } … … 62 62 public SymbolicExpressionTreeSizeCalculator() 63 63 : base() { 64 Parameters.Add(new ScopeTreeLookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose size should be calculated."));65 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>(SymbolicExpressionTreeSizeParameterName, "The tree size of the symbolic expression tree."));64 Parameters.Add(new LookupParameter<SymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic expression tree whose size should be calculated.")); 65 Parameters.Add(new LookupParameter<DoubleValue>(SymbolicExpressionTreeSizeParameterName, "The tree size of the symbolic expression tree.")); 66 66 } 67 67 68 68 public override IOperation Apply() { 69 ItemArray<SymbolicExpressionTree> trees = SymbolicExpressionTree; 70 SymbolicExpressionTreeSize = new ItemArray<DoubleValue>(from tree in trees 71 select new DoubleValue(tree.Size)); 69 SymbolicExpressionTree tree = SymbolicExpressionTree; 70 SymbolicExpressionTreeSize = new DoubleValue(tree.Size); 72 71 return base.Apply(); 73 72 }
Note: See TracChangeset
for help on using the changeset viewer.