Changeset 15356


Ignore:
Timestamp:
09/08/17 10:41:30 (2 years ago)
Author:
pfleck
Message:

#1666 Added a delay for hiding the progress bar to avoid closing the progress during animation.

Location:
branches/SimplifierViewsProgress
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs

    r15353 r15356  
    5151        applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: regressionModelModel.LowerEstimationLimit, upperEstimationLimit: regressionModelModel.UpperEstimationLimit,
    5252        iterationCallback: (args, func, obj) => {
    53           // (maxIterations + 2) iterations are reported; Math.Min neccecary because of floating-point inaccuracies
    54           progress.ProgressValue = Math.Min(progress.ProgressValue + 1.0 / (constOptIterations + 2), 1);
     53          double newProgressValue = progress.ProgressValue + 1.0 / (constOptIterations + 2); // (maxIterations + 2) iterations are reported
     54          progress.ProgressValue = Math.Min(newProgressValue, 1.0);
    5555        });
    5656      return model.SymbolicExpressionTree;
  • branches/SimplifierViewsProgress/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r15353 r15356  
    185185      progress.Start("Calculate Impact and Replacement Values ...", 0);
    186186      var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
     187      await Task.Delay(500); // wait for progressbar to finish animation
    187188      var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
    188189      foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
     
    199200        double impactValue, replacementValue, newQualityForImpactsCalculation;
    200201        impactCalculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);
    201         progress.ProgressValue += 1.0 / (tree.Length - 2);
     202        double newProgressValue = progress.ProgressValue + 1.0 / (tree.Length - 2);
     203        progress.ProgressValue = Math.Min(newProgressValue, 1);
    202204        impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue));
    203205      }
     
    298300      progress.Start("Optimizing Constants ...", 0);
    299301      var newTree = await Task.Run(() => OptimizeConstants(Content.Model, Content.ProblemData, progress));
     302      await Task.Delay(500); // wait for progressbar to finish animation
    300303      UpdateModel(newTree); // UpdateModel calls Progress.Finish (via Content_Changed)
    301304    }
Note: See TracChangeset for help on using the changeset viewer.