Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15400


Ignore:
Timestamp:
10/04/17 13:55:43 (7 years ago)
Author:
pfleck
Message:

#1666:

  • Reverted r15371 for HeuristicLab.MainForm and HeuristicLab.MainForm.WindowsForms (all changes concerning the progress)
  • Changed the signature of OptimizeConstants in the simplifiers to "tree in - tree out" (thanks to bburlacu)
Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms

    • Property svn:mergeinfo deleted
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/Controls/ProgressView.cs

    r15371 r15400  
    154154        if (content != null) {
    155155          double progressValue = content.ProgressValue;
    156           if (progressValue < 0.0 || progressValue > 1.0) {
     156          if (progressValue <= 0.0 || progressValue > 1.0) {
    157157            progressBar.Style = ProgressBarStyle.Marquee;
    158158          } else {
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs

    r15371 r15400  
    230230    }
    231231
    232     public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class, IContent {
     232    public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class,IContent {
    233233      if (content == null) throw new ArgumentNullException("Content cannot be null.");
    234234      if (!reuseExistingView) return ShowContent(content);
     
    353353    /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content.
    354354    /// </summary>
    355     public IProgress AddOperationProgressToContent(IContent content, string progressMessage, double progressValue = -1, bool addToObjectGraphObjects = true) {
     355    public IProgress AddOperationProgressToContent(IContent content, string progressMessage, bool addToObjectGraphObjects = true) {
    356356      if (InvokeRequired) {
    357         IProgress result = (IProgress)Invoke((Func<IContent, string, double, bool, IProgress>)AddOperationProgressToContent, content, progressMessage, progressValue, addToObjectGraphObjects);
     357        IProgress result = (IProgress)Invoke((Func<IContent, string, bool, IProgress>)AddOperationProgressToContent, content, progressMessage, addToObjectGraphObjects);
    358358        return result;
    359359      }
     
    371371        contentViews = contentViews.Where(v => v.Content == content);
    372372
    373       var progress = new Progress();
    374       progress.Start(progressMessage, progressValue);
     373      var progress = new Progress(progressMessage, ProgressState.Started);
    375374      foreach (var contentView in contentViews) {
    376375        progressViews.Add(new ProgressView(contentView, progress));
     
    385384    /// </summary>
    386385    public IProgress AddOperationProgressToView(Control control, string progressMessage) {
    387       var progress = new Progress();
    388       progress.Start(progressMessage);
     386      var progress = new Progress(progressMessage, ProgressState.Started);
    389387      AddOperationProgressToView(control, progress);
    390388      return progress;
  • trunk/sources/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs

    r15371 r15400  
    6464    /// </summary>
    6565    void Start();
     66
    6667    void Start(string status);
    67     void Start(string status, double progressValue);
    6868
    6969    /// <summary>
  • trunk/sources/HeuristicLab.MainForm/3.3/Progress.cs

    r15371 r15400  
    7272      canBeCanceled = false;
    7373    }
     74    public Progress(string status)
     75      : this() {
     76      this.status = status;
     77    }
     78    public Progress(string status, ProgressState state)
     79      : this() {
     80      this.status = status;
     81      this.progressState = state;
     82    }
    7483
    7584    public void Cancel() {
     
    8493
    8594    public void Start() {
    86       Start(string.Empty);
     95      ProgressValue = 0.0;
     96      ProgressState = ProgressState.Started;
    8797    }
     98
    8899    public void Start(string status) {
    89       Start(status, -1.0);
    90     }
    91     public void Start(string status, double progressValue) {
    92       ProgressState = ProgressState.Started;
    93       Status = status ?? string.Empty;
    94       ProgressValue = progressValue;
     100      Start();
     101      Status = status;
    95102    }
    96103
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs

    r15390 r15400  
    4444    }
    4545
    46     protected override ISymbolicExpressionTree OptimizeConstants(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IProgress progress) {
     46    protected override ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) {
    4747      const int constOptIterations = 50;
    48       var regressionModel = (ISymbolicDataAnalysisModel)model.Clone();
    49       var regressionProblemData = (IRegressionProblemData)problemData;
    50       SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(regressionModel.Interpreter, regressionModel.SymbolicExpressionTree, regressionProblemData, regressionProblemData.TrainingIndices,
    51         applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: regressionModel.LowerEstimationLimit, upperEstimationLimit: regressionModel.UpperEstimationLimit,
     48      var regressionProblemData = Content.ProblemData;
     49      var model = Content.Model;
     50      SymbolicRegressionConstantOptimizationEvaluator.OptimizeConstants(model.Interpreter, tree, regressionProblemData, regressionProblemData.TrainingIndices,
     51        applyLinearScaling: true, maxIterations: constOptIterations, updateVariableWeights: true, lowerEstimationLimit: model.LowerEstimationLimit, upperEstimationLimit: model.UpperEstimationLimit,
    5252        iterationCallback: (args, func, obj) => {
    5353          double newProgressValue = progress.ProgressValue + 1.0 / (constOptIterations + 2); // (maxIterations + 2) iterations are reported
    5454          progress.ProgressValue = Math.Min(newProgressValue, 1.0);
    5555        });
    56       return regressionModel.SymbolicExpressionTree;
     56      return tree;
    5757    }
    5858  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r15371 r15400  
    183183      treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
    184184
    185       progress.Start("Calculate Impact and Replacement Values ...", 0);
     185      progress.Start("Calculate Impact and Replacement Values ...");
    186186      var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
    187187      await Task.Delay(500); // wait for progressbar to finish animation
     
    209209    protected abstract void UpdateModel(ISymbolicExpressionTree tree);
    210210
    211     protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IProgress progress) {
    212       return model.SymbolicExpressionTree;
     211    protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) {
     212      return tree;
    213213    }
    214214
     
    298298
    299299    private async void btnOptimizeConstants_Click(object sender, EventArgs e) {
    300       progress.Start("Optimizing Constants ...", 0);
    301       var newTree = await Task.Run(() => OptimizeConstants(Content.Model, Content.ProblemData, progress));
     300      progress.Start("Optimizing Constants ...");
     301      var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
     302      var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
    302303      await Task.Delay(500); // wait for progressbar to finish animation
    303304      UpdateModel(newTree); // UpdateModel calls Progress.Finish (via Content_Changed)
  • trunk/sources/HeuristicLab.Tracing/3.3/app.config

    r11623 r15400  
    55      <listeners>
    66        <add name="HeuristicLabListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="HeuristicLab.log"/>
    7         <remove name="Default"/>
     7        <!--<remove name="Default"/>-->
    88      </listeners>
    99    </trace>
Note: See TracChangeset for help on using the changeset viewer.