Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/08/11 21:41:53 (14 years ago)
Author:
gkronber
Message:

#1418 fixed issues in interactive simplifier views for regression and classification solutions regarding automatic folding of nodes without impact on the solution quality and problems with ADFs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs

    r5942 r5993  
    6060    protected override Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree) {
    6161      Dictionary<ISymbolicExpressionTreeNode, double> replacementValues = new Dictionary<ISymbolicExpressionTreeNode, double>();
    62       foreach (ISymbolicExpressionTreeNode node in tree.IterateNodesPrefix()) {
    63         if (!(node.Symbol is ProgramRootSymbol || node.Symbol is StartSymbol)) {
    64           replacementValues[node] = CalculateReplacementValue(node);
    65         }
     62      foreach (ISymbolicExpressionTreeNode node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
     63        replacementValues[node] = CalculateReplacementValue(node, tree);
    6664      }
    6765      return replacementValues;
     
    8482      foreach (ISymbolicExpressionTreeNode node in nodes) {
    8583        var parent = node.Parent;
    86         constantNode.Value = CalculateReplacementValue(node);
     84        constantNode.Value = CalculateReplacementValue(node, tree);
    8785        ISymbolicExpressionTreeNode replacementNode = constantNode;
    8886        SwitchNode(parent, node, replacementNode);
     
    10098    }
    10199
    102     private double CalculateReplacementValue(ISymbolicExpressionTreeNode node) {
     100    private double CalculateReplacementValue(ISymbolicExpressionTreeNode node, ISymbolicExpressionTree sourceTree) {
     101      // remove old ADFs
     102      while (tempTree.Root.SubtreesCount > 1) tempTree.Root.RemoveSubtree(1);
     103      // clone ADFs of source tree
     104      for (int i = 1; i < sourceTree.Root.SubtreesCount; i++) {
     105        tempTree.Root.AddSubtree((ISymbolicExpressionTreeNode)sourceTree.Root.GetSubtree(i).Clone());
     106      }
    103107      var start = tempTree.Root.GetSubtree(0);
    104108      while (start.SubtreesCount > 0) start.RemoveSubtree(0);
Note: See TracChangeset for help on using the changeset viewer.