Changeset 15400
- Timestamp:
- 10/04/17 13:55:43 (7 years ago)
- 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 154 154 if (content != null) { 155 155 double progressValue = content.ProgressValue; 156 if (progressValue < 0.0 || progressValue > 1.0) {156 if (progressValue <= 0.0 || progressValue > 1.0) { 157 157 progressBar.Style = ProgressBarStyle.Marquee; 158 158 } else { -
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/MainForm.cs
r15371 r15400 230 230 } 231 231 232 public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class, 232 public IContentView ShowContent<T>(T content, bool reuseExistingView, IEqualityComparer<T> comparer = null) where T : class,IContent { 233 233 if (content == null) throw new ArgumentNullException("Content cannot be null."); 234 234 if (!reuseExistingView) return ShowContent(content); … … 353 353 /// Adds a <see cref="ProgressView"/> to the <see cref="ContentView"/>s showing the specified content. 354 354 /// </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) { 356 356 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); 358 358 return result; 359 359 } … … 371 371 contentViews = contentViews.Where(v => v.Content == content); 372 372 373 var progress = new Progress(); 374 progress.Start(progressMessage, progressValue); 373 var progress = new Progress(progressMessage, ProgressState.Started); 375 374 foreach (var contentView in contentViews) { 376 375 progressViews.Add(new ProgressView(contentView, progress)); … … 385 384 /// </summary> 386 385 public IProgress AddOperationProgressToView(Control control, string progressMessage) { 387 var progress = new Progress(); 388 progress.Start(progressMessage); 386 var progress = new Progress(progressMessage, ProgressState.Started); 389 387 AddOperationProgressToView(control, progress); 390 388 return progress; -
trunk/sources/HeuristicLab.MainForm/3.3/Interfaces/IProgress.cs
r15371 r15400 64 64 /// </summary> 65 65 void Start(); 66 66 67 void Start(string status); 67 void Start(string status, double progressValue);68 68 69 69 /// <summary> -
trunk/sources/HeuristicLab.MainForm/3.3/Progress.cs
r15371 r15400 72 72 canBeCanceled = false; 73 73 } 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 } 74 83 75 84 public void Cancel() { … … 84 93 85 94 public void Start() { 86 Start(string.Empty); 95 ProgressValue = 0.0; 96 ProgressState = ProgressState.Started; 87 97 } 98 88 99 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; 95 102 } 96 103 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/InteractiveSymbolicRegressionSolutionSimplifierView.cs
r15390 r15400 44 44 } 45 45 46 protected override ISymbolicExpressionTree OptimizeConstants(ISymbolic DataAnalysisModel model, IDataAnalysisProblemData problemData, IProgress progress) {46 protected override ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) { 47 47 const int constOptIterations = 50; 48 var regression Model = (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, 52 52 iterationCallback: (args, func, obj) => { 53 53 double newProgressValue = progress.ProgressValue + 1.0 / (constOptIterations + 2); // (maxIterations + 2) iterations are reported 54 54 progress.ProgressValue = Math.Min(newProgressValue, 1.0); 55 55 }); 56 return regressionModel.SymbolicExpressionTree;56 return tree; 57 57 } 58 58 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r15371 r15400 183 183 treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); 184 184 185 progress.Start("Calculate Impact and Replacement Values ..." , 0);185 progress.Start("Calculate Impact and Replacement Values ..."); 186 186 var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree)); 187 187 await Task.Delay(500); // wait for progressbar to finish animation … … 209 209 protected abstract void UpdateModel(ISymbolicExpressionTree tree); 210 210 211 protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolic DataAnalysisModel model, IDataAnalysisProblemData problemData, IProgress progress) {212 return model.SymbolicExpressionTree;211 protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) { 212 return tree; 213 213 } 214 214 … … 298 298 299 299 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)); 302 303 await Task.Delay(500); // wait for progressbar to finish animation 303 304 UpdateModel(newTree); // UpdateModel calls Progress.Finish (via Content_Changed) -
trunk/sources/HeuristicLab.Tracing/3.3/app.config
r11623 r15400 5 5 <listeners> 6 6 <add name="HeuristicLabListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="HeuristicLab.log"/> 7 < remove name="Default"/>7 <!--<remove name="Default"/>--> 8 8 </listeners> 9 9 </trace>
Note: See TracChangeset
for help on using the changeset viewer.