Changeset 5993 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs
- Timestamp:
- 04/08/11 21:41:53 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs
r5942 r5993 59 59 protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) { 60 60 Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>(); 61 foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) { 62 if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) { 63 replacementValues[node] = CalculateReplacementValue(node); 64 } 61 foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) { 62 replacementValues[node] = CalculateReplacementValue(node, tree); 65 63 } 66 64 return replacementValues; … … 90 88 foreach (ISymbolicExpressionTreeNode node in nodes) { 91 89 var parent = node.Parent; 92 constantNode.Value = CalculateReplacementValue(node );90 constantNode.Value = CalculateReplacementValue(node, tree); 93 91 ISymbolicExpressionTreeNode replacementNode = constantNode; 94 92 SwitchNode(parent, node, replacementNode); … … 111 109 } 112 110 113 private double CalculateReplacementValue(ISymbolicExpressionTreeNode node) { 111 private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) { 112 // remove old ADFs 113 while (tempTree.Root.SubtreesCount > 1) tempTree.Root.RemoveSubtree(1); 114 // clone ADFs of source tree 115 for (int i = 1; i < sourceTree.Root.SubtreesCount; i++) { 116 tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone()); 117 } 114 118 var start = tempTree.Root.GetSubtree(0); 115 119 while (start.SubtreesCount > 0) start.RemoveSubtree(0);
Note: See TracChangeset
for help on using the changeset viewer.