Changeset 16845 for branches/2971_named_intervals
- Timestamp:
- 04/19/19 12:59:43 (6 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r16823 r16845 35 35 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 36 36 public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView { 37 private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes;38 private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes;39 private IDictionary<ISymbolicExpressionTreeNode, Interval> intervals;40 private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;37 private readonly Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 38 private readonly Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 39 private readonly Dictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>(); 40 private readonly Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>(); 41 41 42 42 private readonly ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator; … … 50 50 protected InteractiveSymbolicDataAnalysisSolutionSimplifierView(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator) { 51 51 InitializeComponent(); 52 foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();53 changedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();54 nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();55 52 this.Caption = "Interactive Solution Simplifier"; 56 53 this.impactCalculator = impactCalculator; … … 173 170 protected override void OnContentChanged() { 174 171 base.OnContentChanged(); 175 foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 172 foldedNodes.Clear(); 173 changedNodes.Clear(); 174 nodeIntervals.Clear(); 175 nodeImpacts.Clear(); 176 176 UpdateView(); 177 177 viewHost.Content = this.Content; … … 195 195 progress.CanBeStopped = true; 196 196 cancellationTokenSource = new CancellationTokenSource(); 197 var interpreter = new IntervalInterpreter();198 197 199 198 var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree)); 200 var variableRanges = (Content.ProblemData as RegressionProblemData).VariableRangesParameter.Value.VariableIntervals; 201 202 var resultIntervals = interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals); 199 203 200 try { 204 201 await Task.Delay(500, cancellationTokenSource.Token); // wait for progressbar to finish animation … … 208 205 foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value); 209 206 } 210 nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1); 207 208 foreach (var kvp in impactAndReplacementValues) { 209 nodeImpacts[kvp.Key] = kvp.Value.Item1; 210 } 211 212 var regressionProblemData = Content.ProblemData as IRegressionProblemData; 213 if (regressionProblemData != null) { 214 var interpreter = new IntervalInterpreter(); 215 var variableRanges = regressionProblemData.VariableRanges.VariableIntervals; 216 IDictionary<ISymbolicExpressionTreeNode, Interval> intervals; 217 interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals); 218 foreach (var kvp in intervals) { 219 nodeIntervals[kvp.Key] = kvp.Value; 220 } 221 } 222 223 211 224 progress.Finish(); 212 225 progress.CanBeStopped = false; … … 303 316 } 304 317 if (visualTree != null) { 305 if ( intervals.ContainsKey(treeNode))306 visualTree.ToolTip += String.Format($"{Environment.NewLine}Intervals: [{ intervals[treeNode].LowerBound:G5} ... {intervals[treeNode].UpperBound:G5}]");318 if (nodeIntervals.ContainsKey(treeNode)) 319 visualTree.ToolTip += String.Format($"{Environment.NewLine}Intervals: [{nodeIntervals[treeNode].LowerBound:G5} ... {nodeIntervals[treeNode].UpperBound:G5}]"); 307 320 if (changedNodes.ContainsKey(treeNode)) { 308 321 visualTree.LineColor = Color.DodgerBlue; -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs
r16841 r16845 30 30 NamedIntervals VariableRanges { get; set; } 31 31 ParsedConstraint IntervalConstraints { get; set; } 32 32 33 IEnumerable<double> TargetVariableValues { get; } 33 34 IEnumerable<double> TargetVariableTrainingValues { get; }
Note: See TracChangeset
for help on using the changeset viewer.