Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/28/20 10:56:16 (5 years ago)
Author:
mkommend
Message:

#2521: Merged trunk changes from 15684-HEAD into the branch.

Location:
branches/2521_ProblemRefactoring
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring

  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs

    r17226 r17457  
    5757      this.grpViewHost = new System.Windows.Forms.GroupBox();
    5858      this.treeChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart();
     59      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5960      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    6061      this.splitContainer.Panel1.SuspendLayout();
     
    148149      this.btnSimplify.Text = "Simplify";
    149150      this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     151      this.toolTip.SetToolTip(this.btnSimplify, "Simplifies the model structure based on mathematical simplification rules.");
    150152      this.btnSimplify.UseVisualStyleBackColor = true;
    151153      this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);
     
    162164      this.btnOptimizeConstants.Text = "Optimize";
    163165      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     166      this.toolTip.SetToolTip(this.btnOptimizeConstants, "Optimizes the numerical constants of the model. \r\nIf the algorithm converges, opt" +
     167        "imization is stopped.");
    164168      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
    165169      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
     
    226230    protected System.Windows.Forms.Button btnOptimizeConstants;
    227231    private System.Windows.Forms.Label treeStatusValue;
     232    private System.Windows.Forms.ToolTip toolTip;
    228233  }
    229234}
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r17226 r17457  
    168168    private void Content_Changed(object sender, EventArgs e) {
    169169      UpdateView();
     170      SetEnabledStateOfControls();
    170171    }
    171172
     
    192193
    193194      progress.Start("Calculate Impact and Replacement Values ...");
     195      cancellationTokenSource = new CancellationTokenSource();
    194196      progress.CanBeStopped = true;
    195       cancellationTokenSource = new CancellationTokenSource();
    196       var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
    197197      try {
    198         await Task.Delay(500, cancellationTokenSource.Token); // wait for progressbar to finish animation
    199       } catch (OperationCanceledException) { }
    200       var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
    201       foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
    202         foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
    203       }
    204       nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
    205       progress.Finish();
     198        var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
     199        try {
     200          await Task.Delay(300, cancellationTokenSource.Token); // wait for progressbar to finish animation
     201        } catch (OperationCanceledException) { }
     202
     203        var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
     204        foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
     205          foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
     206        }
     207
     208        nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
     209      } finally {
     210        progress.Finish();
     211      }
     212
    206213      progress.CanBeStopped = false;
    207214      PaintNodeImpacts();
     
    313320    private async void btnOptimizeConstants_Click(object sender, EventArgs e) {
    314321      progress.Start("Optimizing Constants ...");
    315       var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
    316       var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
    317       await Task.Delay(500); // wait for progressbar to finish animation
    318       UpdateModel(newTree); // UpdateModel calls Progress.Finish (via Content_Changed)
     322      cancellationTokenSource = new CancellationTokenSource();
     323      progress.CanBeStopped = true;
     324      try {
     325        var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
     326
     327        var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
     328        try {
     329          await Task.Delay(300, cancellationTokenSource.Token); // wait for progressbar to finish animation
     330        } catch (OperationCanceledException) { }
     331        UpdateModel(newTree); // triggers progress.Finish after calculating the node impacts when model is changed
     332      } catch {
     333        progress.Finish();
     334      }
    319335    }
    320336  }
Note: See TracChangeset for help on using the changeset viewer.