- Timestamp:
- 05/06/10 20:27:08 (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
r3681 r3683 62 62 [Storable] 63 63 private MinAverageMaxValueAnalyzer valueAnalyzer; 64 [Storable] 65 private SymbolicExpressionTreeSizeCalculator sizeCalculator; 64 66 65 67 #endregion … … 71 73 Parameters.Add(new ValueLookupParameter<VariableCollection>(ResultsParameterName, "The results collection where the analysis values should be stored.")); 72 74 73 UniformSubScopesProcessor subScopesProcessor = new UniformSubScopesProcessor(); 74 SymbolicExpressionTreeSizeCalculator sizeCalculator = new SymbolicExpressionTreeSizeCalculator(); 75 sizeCalculator = new SymbolicExpressionTreeSizeCalculator(); 75 76 valueAnalyzer = new MinAverageMaxValueAnalyzer(); 76 77 sizeCalculator.SymbolicExpressionTreeParameter.ActualName = SymbolicExpressionTreeParameter.Name; 78 sizeCalculator.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth; 77 79 sizeCalculator.SymbolicExpressionTreeSizeParameter.ActualName = SymbolicExpressionTreeSizeParameter.Name; 80 sizeCalculator.SymbolicExpressionTreeSizeParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth; 78 81 valueAnalyzer.ValueParameter.ActualName = sizeCalculator.SymbolicExpressionTreeSizeParameter.Name; 79 82 valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth; … … 84 87 valueAnalyzer.MinValueParameter.ActualName = "Min Tree Size"; 85 88 86 OperatorGraph.InitialOperator = subScopesProcessor; 87 subScopesProcessor.Operator = sizeCalculator; 88 subScopesProcessor.Successor = valueAnalyzer; 89 OperatorGraph.InitialOperator = sizeCalculator; 90 sizeCalculator.Successor = valueAnalyzer; 89 91 valueAnalyzer.Successor = null; 90 92 … … 98 100 private void Initialize() { 99 101 SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged); 102 SymbolicExpressionTreeSizeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeSizeParameter_DepthChanged); 100 103 } 101 104 … … 107 110 108 111 private void SymbolicExpressionTreeParameter_DepthChanged(object sender, EventArgs e) { 112 OnDepthParameterChanged(); 113 } 114 115 private void SymbolicExpressionTreeSizeParameter_DepthChanged(object sender, EventArgs e) { 116 OnDepthParameterChanged(); 117 } 118 119 private void OnDepthParameterChanged() { 109 120 valueAnalyzer.ValueParameter.Depth = SymbolicExpressionTreeParameter.Depth; 121 sizeCalculator.SymbolicExpressionTreeParameter.Depth = SymbolicExpressionTreeParameter.Depth; 122 sizeCalculator.SymbolicExpressionTreeSizeParameter.Depth = SymbolicExpressionTreeSizeParameter.Depth; 110 123 } 111 124 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/SymbolicExpressionTreeSizeCalculator.cs
r3651 r3683 42 42 43 43 #region parameter properties 44 public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {45 get { return ( ILookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }44 public ScopeTreeLookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { 45 get { return (ScopeTreeLookupParameter<SymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; } 46 46 } 47 public ILookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter {48 get { return ( ILookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; }47 public ScopeTreeLookupParameter<DoubleValue> SymbolicExpressionTreeSizeParameter { 48 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters[SymbolicExpressionTreeSizeParameterName]; } 49 49 } 50 50 #endregion 51 51 52 52 #region properties 53 public SymbolicExpressionTreeSymbolicExpressionTree {54 get { return SymbolicExpressionTreeParameter.ActualValue; }53 public ItemArray<SymbolicExpressionTree> SymbolicExpressionTree { 54 get { return SymbolicExpressionTreeParameter.ActualValue; } 55 55 } 56 public DoubleValueSymbolicExpressionTreeSize {57 get { return SymbolicExpressionTreeSizeParameter.ActualValue; }58 set { SymbolicExpressionTreeSizeParameter.ActualValue = value; }56 public ItemArray<DoubleValue> SymbolicExpressionTreeSize { 57 get { return SymbolicExpressionTreeSizeParameter.ActualValue; } 58 set { SymbolicExpressionTreeSizeParameter.ActualValue = value; } 59 59 } 60 60 #endregion … … 62 62 public SymbolicExpressionTreeSizeCalculator() 63 63 : base() { 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."));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.")); 66 66 } 67 67 68 68 public override IOperation Apply() { 69 SymbolicExpressionTreeSize = new DoubleValue(SymbolicExpressionTree.Size); 69 ItemArray<SymbolicExpressionTree> trees = SymbolicExpressionTree; 70 SymbolicExpressionTreeSize = new ItemArray<DoubleValue>(from tree in trees 71 select new DoubleValue(tree.Size)); 70 72 return base.Apply(); 71 73 }
Note: See TracChangeset
for help on using the changeset viewer.