Changeset 18146 for branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs
- Timestamp:
- 12/16/21 14:23:48 (3 years ago)
- Location:
- branches/3136_Structural_GP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3136_Structural_GP
- Property svn:mergeinfo changed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs
r17180 r18146 115 115 if (linearScalingCalculator.ErrorState != OnlineCalculatorError.None) return; 116 116 117 ConstantTreeNode alphaTreeNode = null;118 ConstantTreeNode betaTreeNode = null;117 NumberTreeNode alphaTreeNode = null; 118 NumberTreeNode betaTreeNode = null; 119 119 // check if model has a structure that can be re-used for scaling 120 120 var startNode = SymbolicExpressionTree.Root.GetSubtree(0); 121 121 var addNode = startNode.GetSubtree(0); 122 122 if (addNode.Symbol is Addition && addNode.SubtreeCount == 2) { 123 alphaTreeNode = ( ConstantTreeNode)addNode.Subtrees.LastOrDefault(n => n is ConstantTreeNode);123 alphaTreeNode = (NumberTreeNode)addNode.Subtrees.LastOrDefault(n => n is NumberTreeNode); 124 124 var mulNode = addNode.Subtrees.FirstOrDefault(n => n.Symbol is Multiplication); 125 125 if (mulNode != null) { 126 betaTreeNode = ( ConstantTreeNode)mulNode.Subtrees.LastOrDefault(n => n is ConstantTreeNode);126 betaTreeNode = (NumberTreeNode)mulNode.Subtrees.LastOrDefault(n => n is NumberTreeNode); 127 127 } 128 128 } … … 146 146 var addition = new Addition(); 147 147 var node = addition.CreateTreeNode(); 148 var alpha Const = MakeConstant(alpha);148 var alphaNode = MakeNumber(alpha); 149 149 node.AddSubtree(treeNode); 150 node.AddSubtree(alpha Const);150 node.AddSubtree(alphaNode); 151 151 return node; 152 152 } … … 157 157 return treeNode; 158 158 } else { 159 var multiplic iation = new Multiplication();160 var node = multiplic iation.CreateTreeNode();161 var beta Const = MakeConstant(beta);159 var multiplication = new Multiplication(); 160 var node = multiplication.CreateTreeNode(); 161 var betaNode = MakeNumber(beta); 162 162 node.AddSubtree(treeNode); 163 node.AddSubtree(beta Const);163 node.AddSubtree(betaNode); 164 164 return node; 165 165 } 166 166 } 167 167 168 private static ISymbolicExpressionTreeNode Make Constant(double c) {169 var node = ( ConstantTreeNode)(new Constant()).CreateTreeNode();168 private static ISymbolicExpressionTreeNode MakeNumber(double c) { 169 var node = (NumberTreeNode)(new Number()).CreateTreeNode(); 170 170 node.Value = c; 171 171 return node;
Note: See TracChangeset
for help on using the changeset viewer.