Changeset 17500 for stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 17276,17426,17430,17488
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 17430
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r17499 r17500 193 193 194 194 progress.Start("Calculate Impact and Replacement Values ..."); 195 cancellationTokenSource = new CancellationTokenSource(); 195 196 progress.CanBeStopped = true; 196 cancellationTokenSource = new CancellationTokenSource();197 var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));198 197 try { 199 await Task.Delay(500, cancellationTokenSource.Token); // wait for progressbar to finish animation 200 } catch (OperationCanceledException) { } 201 var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2); 202 foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) { 203 foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value); 204 } 205 nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1); 206 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 207 213 progress.CanBeStopped = false; 208 214 PaintNodeImpacts(); … … 314 320 private async void btnOptimizeConstants_Click(object sender, EventArgs e) { 315 321 progress.Start("Optimizing Constants ..."); 322 cancellationTokenSource = new CancellationTokenSource(); 323 progress.CanBeStopped = true; 316 324 try { 317 325 var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone(); 326 318 327 var newTree = await Task.Run(() => OptimizeConstants(tree, progress)); 319 await Task.Delay(500); // wait for progressbar to finish animation 320 UpdateModel(newTree); 321 } finally { 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 { 322 333 progress.Finish(); 323 334 }
Note: See TracChangeset
for help on using the changeset viewer.