Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6113


Ignore:
Timestamp:
05/03/11 18:43:22 (14 years ago)
Author:
mkommend
Message:

#1504: Corrected bug in symbolic simplifier view.

File:
1 edited

Legend:

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

    r6108 r6113  
    3434    private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> replacementNodes;
    3535    private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
     36    private bool updateInProgress = false;
    3637
    3738    public InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
     
    9091        nodeImpacts = CalculateImpactValues(Content.Model.SymbolicExpressionTree);
    9192
    92         // automatically fold all branches with impact = 1
    93         List<ISymbolicExpressionTreeNode> nodeList = Content.Model.SymbolicExpressionTree.Root.GetSubtree(0).IterateNodesPrefix().ToList();
    94         foreach (var parent in nodeList) {
    95           for (int subTreeIndex = 0; subTreeIndex < parent.SubtreesCount; subTreeIndex++) {
    96             var child = parent.GetSubtree(subTreeIndex);
    97             if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(0.0)) {
    98               SwitchNodeWithReplacementNode(parent, subTreeIndex);
     93        if (!updateInProgress) {
     94          // automatically fold all branches with impact = 1
     95          List<ISymbolicExpressionTreeNode> nodeList = Content.Model.SymbolicExpressionTree.Root.GetSubtree(0).IterateNodesPrefix().ToList();
     96          foreach (var parent in nodeList) {
     97            for (int subTreeIndex = 0; subTreeIndex < parent.SubtreesCount; subTreeIndex++) {
     98              var child = parent.GetSubtree(subTreeIndex);
     99              if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(0.0)) {
     100                SwitchNodeWithReplacementNode(parent, subTreeIndex);
     101              }
    99102            }
    100103          }
    101104        }
     105
    102106        // show only interesting part of solution
    103107        if (tree.Root.SubtreesCount > 1)
     
    138142              this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB
    139143
     144            updateInProgress = true;
    140145            UpdateModel(tree);
     146            updateInProgress = false;
    141147            return; // break all loops
    142148          }
Note: See TracChangeset for help on using the changeset viewer.