- Timestamp:
- 04/16/13 13:13:41 (11 years ago)
- Location:
- branches/OaaS
- Files:
-
- 1 deleted
- 12 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged eligible /branches/Algorithms.GradientDescent/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5516-5520 /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 6917-7005 /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5815-6180 /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 4458-4459,4462,4464 /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5060 /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 8388-8942 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 6828 /branches/RuntimeOptimizer/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 7787-8333 /branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 8944-8956 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5370-5682 /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 6829-6865 /branches/UnloadJobs/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 9168-9215 /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5594-5752 /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Views 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4
- Property svn:ignore
-
old new 1 *.user 2 Plugin.cs 1 3 bin 2 4 obj 3 *.user4 HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin.cs5 *.vs10x6 Plugin.cs
-
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs
r8110 r9363 40 40 protected override void OnContentChanged() { 41 41 base.OnContentChanged(); 42 symbolicExpressionTreeView.Content = null; 42 43 if (Content != null) 43 44 symbolicExpressionTreeView.Content = Content.SymbolicExpressionTree; 44 else45 symbolicExpressionTreeView.Content = null;46 45 } 47 46 } -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r7675 r9363 93 93 </PropertyGroup> 94 94 <ItemGroup> 95 <Reference Include="ALGLIB-3. 5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">96 <HintPath>..\..\bin\ALGLIB-3. 5.0.dll</HintPath>95 <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 96 <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath> 97 97 <Private>False</Private> 98 98 </Reference> … … 114 114 </ItemGroup> 115 115 <ItemGroup> 116 <Compile Include="InteractiveSymbolicExpressionTreeChart.cs"> 117 <SubType>UserControl</SubType> 118 </Compile> 119 <Compile Include="InteractiveSymbolicExpressionTreeChart.Designer.cs"> 120 <DependentUpon>InteractiveSymbolicExpressionTreeChart.cs</DependentUpon> 121 </Compile> 116 122 <Compile Include="MathSymbolicDataAnalysisModelView.cs"> 117 123 <SubType>UserControl</SubType> … … 168 174 <Compile Include="Symbols\VariableView.Designer.cs"> 169 175 <DependentUpon>VariableView.cs</DependentUpon> 176 </Compile> 177 <Compile Include="TreeEditDialogs\SymbolicExpressionTreeConstantNodeEditDialog.cs"> 178 <SubType>Form</SubType> 179 </Compile> 180 <Compile Include="TreeEditDialogs\SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs"> 181 <DependentUpon>SymbolicExpressionTreeConstantNodeEditDialog.cs</DependentUpon> 182 </Compile> 183 <Compile Include="TreeEditDialogs\SymbolicExpressionTreeVariableNodeEditDialog.cs"> 184 <SubType>Form</SubType> 185 </Compile> 186 <Compile Include="TreeEditDialogs\SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs"> 187 <DependentUpon>SymbolicExpressionTreeVariableNodeEditDialog.cs</DependentUpon> 188 </Compile> 189 <Compile Include="TreeEditDialogs\SymbolicExpressionTreeNodeInsertDialog.cs"> 190 <SubType>Form</SubType> 191 </Compile> 192 <Compile Include="TreeEditDialogs\SymbolicExpressionTreeNodeInsertDialog.Designer.cs"> 193 <DependentUpon>SymbolicExpressionTreeNodeInsertDialog.cs</DependentUpon> 170 194 </Compile> 171 195 <None Include="HeuristicLab.snk" /> … … 313 337 --> 314 338 <PropertyGroup> 315 <PreBuildEvent >set Path=%25Path%25;$(ProjectDir);$(SolutionDir)339 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 316 340 set ProjectDir=$(ProjectDir) 317 341 set SolutionDir=$(SolutionDir) … … 320 344 call PreBuildEvent.cmd 321 345 </PreBuildEvent> 346 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 347 export ProjectDir=$(ProjectDir) 348 export SolutionDir=$(SolutionDir) 349 350 $SolutionDir/PreBuildEvent.sh 351 </PreBuildEvent> 322 352 </PropertyGroup> 323 353 </Project> -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs
r8053 r9363 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 this. treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();47 this.components = new System.ComponentModel.Container(); 48 48 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 49 49 this.splitContainer = new System.Windows.Forms.SplitContainer(); 50 50 this.grpSimplify = new System.Windows.Forms.GroupBox(); 51 this.treeStatusValue = new System.Windows.Forms.Label(); 51 52 this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); 53 this.btnOptimizeConstants = new System.Windows.Forms.Button(); 52 54 this.btnSimplify = new System.Windows.Forms.Button(); 53 this.btnOptimizeConstants = new System.Windows.Forms.Button(); 55 this.treeStatusLabel = new System.Windows.Forms.Label(); 56 this.treeChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart(); 54 57 this.grpViewHost = new System.Windows.Forms.GroupBox(); 55 58 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); … … 62 65 this.SuspendLayout(); 63 66 // 64 // treeChart65 //66 this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)67 | System.Windows.Forms.AnchorStyles.Left)68 | System.Windows.Forms.AnchorStyles.Right)));69 this.treeChart.BackgroundColor = System.Drawing.Color.White;70 this.treeChart.LineColor = System.Drawing.Color.Black;71 this.treeChart.Location = new System.Drawing.Point(6, 16);72 this.treeChart.Name = "treeChart";73 this.treeChart.Size = new System.Drawing.Size(201, 291);74 this.treeChart.Spacing = 5;75 this.treeChart.TabIndex = 0;76 this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);77 this.treeChart.Tree = null;78 this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);79 //80 67 // viewHost 81 68 // … … 89 76 this.viewHost.Name = "viewHost"; 90 77 this.viewHost.ReadOnly = false; 91 this.viewHost.Size = new System.Drawing.Size(33 5, 326);78 this.viewHost.Size = new System.Drawing.Size(336, 383); 92 79 this.viewHost.TabIndex = 0; 93 80 this.viewHost.ViewsLabelVisible = true; … … 107 94 // 108 95 this.splitContainer.Panel2.Controls.Add(this.grpViewHost); 109 this.splitContainer.Size = new System.Drawing.Size(56 4, 348);96 this.splitContainer.Size = new System.Drawing.Size(565, 405); 110 97 this.splitContainer.SplitterDistance = 213; 111 98 this.splitContainer.TabIndex = 1; … … 113 100 // grpSimplify 114 101 // 102 this.grpSimplify.AutoSize = true; 103 this.grpSimplify.Controls.Add(this.treeStatusValue); 115 104 this.grpSimplify.Controls.Add(this.flowLayoutPanel); 105 this.grpSimplify.Controls.Add(this.treeStatusLabel); 116 106 this.grpSimplify.Controls.Add(this.treeChart); 117 107 this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill; 118 108 this.grpSimplify.Location = new System.Drawing.Point(0, 0); 119 109 this.grpSimplify.Name = "grpSimplify"; 120 this.grpSimplify.Size = new System.Drawing.Size(213, 348);110 this.grpSimplify.Size = new System.Drawing.Size(213, 405); 121 111 this.grpSimplify.TabIndex = 1; 122 112 this.grpSimplify.TabStop = false; 123 113 this.grpSimplify.Text = "Simplify"; 114 // 115 // treeStatusValue 116 // 117 this.treeStatusValue.AutoSize = true; 118 this.treeStatusValue.BackColor = System.Drawing.Color.Transparent; 119 this.treeStatusValue.ForeColor = System.Drawing.Color.Green; 120 this.treeStatusValue.Location = new System.Drawing.Point(72, 16); 121 this.treeStatusValue.Name = "treeStatusValue"; 122 this.treeStatusValue.Size = new System.Drawing.Size(30, 13); 123 this.treeStatusValue.TabIndex = 3; 124 this.treeStatusValue.Text = "Valid"; 124 125 // 125 126 // flowLayoutPanel … … 129 130 this.flowLayoutPanel.Controls.Add(this.btnSimplify); 130 131 this.flowLayoutPanel.Controls.Add(this.btnOptimizeConstants); 131 this.flowLayoutPanel.Location = new System.Drawing.Point(6, 3 13);132 this.flowLayoutPanel.Location = new System.Drawing.Point(6, 370); 132 133 this.flowLayoutPanel.Name = "flowLayoutPanel"; 133 134 this.flowLayoutPanel.Size = new System.Drawing.Size(204, 29); 134 135 this.flowLayoutPanel.TabIndex = 2; 135 136 this.flowLayoutPanel.WrapContents = false; 136 //137 // btnSimplify138 //139 this.btnSimplify.Location = new System.Drawing.Point(3, 3);140 this.btnSimplify.Name = "btnSimplify";141 this.btnSimplify.Size = new System.Drawing.Size(95, 23);142 this.btnSimplify.TabIndex = 1;143 this.btnSimplify.Text = "Simplify";144 this.btnSimplify.UseVisualStyleBackColor = true;145 this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);146 137 // 147 138 // btnOptimizeConstants … … 157 148 this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click); 158 149 // 150 // btnSimplify 151 // 152 this.btnSimplify.Location = new System.Drawing.Point(3, 3); 153 this.btnSimplify.Name = "btnSimplify"; 154 this.btnSimplify.Size = new System.Drawing.Size(95, 23); 155 this.btnSimplify.TabIndex = 1; 156 this.btnSimplify.Text = "Simplify"; 157 this.btnSimplify.UseVisualStyleBackColor = true; 158 this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click); 159 // 160 // treeStatusLabel 161 // 162 this.treeStatusLabel.AutoSize = true; 163 this.treeStatusLabel.BackColor = System.Drawing.Color.Transparent; 164 this.treeStatusLabel.Location = new System.Drawing.Point(6, 16); 165 this.treeStatusLabel.Name = "treeStatusLabel"; 166 this.treeStatusLabel.Size = new System.Drawing.Size(68, 13); 167 this.treeStatusLabel.TabIndex = 2; 168 this.treeStatusLabel.Text = "Tree Status: "; 169 // 170 // treeChart 171 // 172 this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 173 | System.Windows.Forms.AnchorStyles.Left) 174 | System.Windows.Forms.AnchorStyles.Right))); 175 this.treeChart.BackgroundColor = System.Drawing.Color.White; 176 this.treeChart.LineColor = System.Drawing.Color.Black; 177 this.treeChart.Location = new System.Drawing.Point(6, 32); 178 this.treeChart.ModifyTree = null; 179 this.treeChart.Name = "treeChart"; 180 this.treeChart.Size = new System.Drawing.Size(201, 332); 181 this.treeChart.Spacing = 5; 182 this.treeChart.SuspendRepaint = false; 183 this.treeChart.TabIndex = 0; 184 this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F); 185 this.treeChart.Tree = null; 186 this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked); 187 // 159 188 // grpViewHost 160 189 // … … 163 192 this.grpViewHost.Location = new System.Drawing.Point(0, 0); 164 193 this.grpViewHost.Name = "grpViewHost"; 165 this.grpViewHost.Size = new System.Drawing.Size(34 7, 348);194 this.grpViewHost.Size = new System.Drawing.Size(348, 405); 166 195 this.grpViewHost.TabIndex = 1; 167 196 this.grpViewHost.TabStop = false; … … 171 200 // 172 201 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 173 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode. Inherit;202 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 174 203 this.Controls.Add(this.splitContainer); 204 this.DoubleBuffered = true; 175 205 this.Name = "InteractiveSymbolicDataAnalysisSolutionSimplifierView"; 176 this.Size = new System.Drawing.Size(56 4, 348);206 this.Size = new System.Drawing.Size(565, 405); 177 207 this.splitContainer.Panel1.ResumeLayout(false); 208 this.splitContainer.Panel1.PerformLayout(); 178 209 this.splitContainer.Panel2.ResumeLayout(false); 179 210 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 180 211 this.splitContainer.ResumeLayout(false); 181 212 this.grpSimplify.ResumeLayout(false); 213 this.grpSimplify.PerformLayout(); 182 214 this.flowLayoutPanel.ResumeLayout(false); 183 215 this.grpViewHost.ResumeLayout(false); … … 188 220 #endregion 189 221 190 private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;222 private InteractiveSymbolicExpressionTreeChart treeChart; 191 223 private System.Windows.Forms.SplitContainer splitContainer; 192 224 private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost; … … 196 228 private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel; 197 229 protected System.Windows.Forms.Button btnOptimizeConstants; 230 private System.Windows.Forms.Label treeStatusValue; 231 private System.Windows.Forms.Label treeStatusLabel; 198 232 } 199 233 } -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r7259 r9363 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 33 33 public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView { 34 private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> replacementNodes; 34 private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes; 35 private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes; 35 36 private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts; 36 private bool updateInProgress = false; 37 private enum TreeState { Valid, Invalid } 38 private TreeState treeState; 37 39 38 40 public InteractiveSymbolicDataAnalysisSolutionSimplifierView() { 39 41 InitializeComponent(); 40 this.replacementNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 41 this.nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>(); 42 foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 43 changedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 44 nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>(); 42 45 this.Caption = "Interactive Solution Simplifier"; 46 47 // initialize the tree modifier that will be used to perform edit operations over the tree 48 treeChart.ModifyTree = Modify; 49 } 50 51 /// <summary> 52 /// Remove, Replace or Insert subtrees 53 /// </summary> 54 /// <param name="tree">The symbolic expression tree</param> 55 /// <param name="node">The insertion point (ie, the parent node who will receive a new child)</param> 56 /// <param name="oldChild">The subtree to be replaced</param> 57 /// <param name="newChild">The replacement subtree</param> 58 /// <param name="removeSubtree">Flag used to indicate if whole subtrees should be removed (default behavior), or just the subtree root</param> 59 private void Modify(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode node, ISymbolicExpressionTreeNode oldChild, ISymbolicExpressionTreeNode newChild, bool removeSubtree = true) { 60 if (oldChild == null && newChild == null) throw new ArgumentException(); 61 if (oldChild == null) { // insertion operation 62 node.AddSubtree(newChild); 63 newChild.Parent = node; 64 } else if (newChild == null) { // removal operation 65 node.RemoveSubtree(node.IndexOfSubtree(oldChild)); 66 changedNodes.Remove(oldChild); 67 foldedNodes.Remove(oldChild); 68 if (removeSubtree) { 69 foreach (var subtree in oldChild.IterateNodesPrefix()) { 70 changedNodes.Remove(subtree); 71 foldedNodes.Remove(subtree); 72 } 73 } else { 74 for (int i = oldChild.SubtreeCount - 1; i >= 0; --i) { 75 var subtree = oldChild.GetSubtree(i); 76 oldChild.RemoveSubtree(i); 77 node.AddSubtree(subtree); 78 } 79 } 80 } else { // replacement operation 81 var replacementIndex = node.IndexOfSubtree(oldChild); 82 node.RemoveSubtree(replacementIndex); 83 node.InsertSubtree(replacementIndex, newChild); 84 newChild.Parent = node; 85 if (changedNodes.ContainsKey(oldChild)) { 86 changedNodes.Add(newChild, changedNodes[oldChild]); // so that on double click the original node is restored 87 changedNodes.Remove(oldChild); 88 } else { 89 changedNodes.Add(newChild, oldChild); 90 } 91 } 92 if (IsValid(tree)) { 93 treeState = TreeState.Valid; 94 UpdateModel(Content.Model.SymbolicExpressionTree); 95 } else { 96 treeState = TreeState.Invalid; 97 } 98 } 99 100 private bool IsValid(ISymbolicExpressionTree tree) { 101 treeChart.Tree = tree; 102 treeChart.Repaint(); 103 bool valid = !tree.IterateNodesPostfix().Any(node => node.SubtreeCount < node.Symbol.MinimumArity || node.SubtreeCount > node.Symbol.MaximumArity); 104 if (valid) { 105 btnOptimizeConstants.Enabled = true; 106 btnSimplify.Enabled = true; 107 treeStatusValue.Text = "Valid"; 108 treeStatusValue.ForeColor = Color.Green; 109 } else { 110 btnOptimizeConstants.Enabled = false; 111 btnSimplify.Enabled = false; 112 treeStatusValue.Text = "Invalid"; 113 treeStatusValue.ForeColor = Color.Red; 114 } 115 this.Refresh(); 116 return valid; 43 117 } 44 118 … … 50 124 protected override void RegisterContentEvents() { 51 125 base.RegisterContentEvents(); 52 Content.ModelChanged += new EventHandler(Content_ModelChanged);53 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged);126 Content.ModelChanged += Content_Changed; 127 Content.ProblemDataChanged += Content_Changed; 54 128 } 55 129 protected override void DeregisterContentEvents() { 56 130 base.DeregisterContentEvents(); 57 Content.ModelChanged -= new EventHandler(Content_ModelChanged); 58 Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged); 59 } 60 61 private void Content_ModelChanged(object sender, EventArgs e) { 62 OnModelChanged(); 63 } 64 private void Content_ProblemDataChanged(object sender, EventArgs e) { 65 OnProblemDataChanged(); 66 } 67 68 protected virtual void OnModelChanged() { 69 this.CalculateReplacementNodesAndNodeImpacts(); 70 } 71 72 protected virtual void OnProblemDataChanged() { 73 this.CalculateReplacementNodesAndNodeImpacts(); 131 Content.ModelChanged -= Content_Changed; 132 Content.ProblemDataChanged -= Content_Changed; 133 } 134 135 private void Content_Changed(object sender, EventArgs e) { 136 UpdateView(); 74 137 } 75 138 76 139 protected override void OnContentChanged() { 77 140 base.OnContentChanged(); 78 this.CalculateReplacementNodesAndNodeImpacts(); 79 this.viewHost.Content = this.Content; 80 } 81 82 private void CalculateReplacementNodesAndNodeImpacts() { 83 if (Content != null && Content.Model != null && Content.ProblemData != null) { 84 var tree = Content.Model.SymbolicExpressionTree; 85 var replacementValues = CalculateReplacementValues(tree); 86 foreach (var pair in replacementValues) { 87 if (!(pair.Key is ConstantTreeNode)) { 88 replacementNodes[pair.Key] = MakeConstantTreeNode(pair.Value); 89 } 90 } 91 nodeImpacts = CalculateImpactValues(Content.Model.SymbolicExpressionTree); 92 93 if (!updateInProgress) { 94 // automatically fold all branches with impact = 1 95 List<ISymbolicExpressionTreeNode> nodeList = Content.Model.SymbolicExpressionTree.Root.GetSubtree(0).IterateNodesPrefix().ToList(); 96 foreach (var parent in nodeList) { 97 for (int subTreeIndex = 0; subTreeIndex < parent.SubtreeCount; subTreeIndex++) { 98 var child = parent.GetSubtree(subTreeIndex); 99 if (!(child.Symbol is Constant) && nodeImpacts[child].IsAlmost(0.0)) { 100 SwitchNodeWithReplacementNode(parent, subTreeIndex); 101 } 102 } 103 } 104 } 105 106 // show only interesting part of solution 107 if (tree.Root.SubtreeCount > 1) 108 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs 109 else 110 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB 111 this.PaintNodeImpacts(); 112 } 141 foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>(); 142 UpdateView(); 143 viewHost.Content = this.Content; 144 } 145 146 private void UpdateView() { 147 if (Content == null || Content.Model == null || Content.ProblemData == null) return; 148 var tree = Content.Model.SymbolicExpressionTree; 149 treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); 150 151 var replacementValues = CalculateReplacementValues(tree); 152 foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) { 153 foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value); 154 } 155 156 nodeImpacts = CalculateImpactValues(tree); 157 PaintNodeImpacts(); 113 158 } 114 159 … … 117 162 protected abstract void UpdateModel(ISymbolicExpressionTree tree); 118 163 119 private ConstantTreeNode MakeConstantTreeNode(double value) { 120 Constant constant = new Constant(); 121 constant.MinValue = value - 1; 122 constant.MaxValue = value + 1; 123 ConstantTreeNode constantTreeNode = (ConstantTreeNode)constant.CreateTreeNode(); 164 private static ConstantTreeNode MakeConstantTreeNode(double value) { 165 var constant = new Constant { MinValue = value - 1, MaxValue = value + 1 }; 166 var constantTreeNode = (ConstantTreeNode)constant.CreateTreeNode(); 124 167 constantTreeNode.Value = value; 125 168 return constantTreeNode; … … 127 170 128 171 private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) { 129 VisualSymbolicExpressionTreeNode visualTreeNode = (VisualSymbolicExpressionTreeNode)sender; 172 if (treeState == TreeState.Invalid) return; 173 var visualNode = (VisualSymbolicExpressionTreeNode)sender; 174 var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.SymbolicExpressionTreeNode; 175 if (symbExprTreeNode == null) return; 130 176 var tree = Content.Model.SymbolicExpressionTree; 131 foreach (SymbolicExpressionTreeNode treeNode in tree.IterateNodesPostfix()) { 132 for (int i = 0; i < treeNode.SubtreeCount; i++) { 133 ISymbolicExpressionTreeNode subTree = treeNode.GetSubtree(i); 134 // only allow to replace nodes for which a replacement value is known (replacement value for ADF nodes are not available) 135 if (subTree == visualTreeNode.SymbolicExpressionTreeNode && replacementNodes.ContainsKey(subTree)) { 136 SwitchNodeWithReplacementNode(treeNode, i); 137 138 // show only interesting part of solution 139 if (tree.Root.SubtreeCount > 1) 140 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root); // RPB + ADFs 141 else 142 this.treeChart.Tree = new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0)); // 1st child of RPB 143 144 updateInProgress = true; 145 UpdateModel(tree); 146 updateInProgress = false; 147 return; // break all loops 148 } 149 } 150 } 177 var parent = symbExprTreeNode.Parent; 178 int indexOfSubtree = parent.IndexOfSubtree(symbExprTreeNode); 179 if (changedNodes.ContainsKey(symbExprTreeNode)) { 180 // undo node change 181 parent.RemoveSubtree(indexOfSubtree); 182 var originalNode = changedNodes[symbExprTreeNode]; 183 parent.InsertSubtree(indexOfSubtree, originalNode); 184 changedNodes.Remove(symbExprTreeNode); 185 } else if (foldedNodes.ContainsKey(symbExprTreeNode)) { 186 // undo node folding 187 SwitchNodeWithReplacementNode(parent, indexOfSubtree); 188 } 189 UpdateModel(tree); 151 190 } 152 191 … … 154 193 ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex); 155 194 parent.RemoveSubtree(subTreeIndex); 156 if ( replacementNodes.ContainsKey(subTree)) {157 var replacementNode = replacementNodes[subTree];195 if (foldedNodes.ContainsKey(subTree)) { 196 var replacementNode = foldedNodes[subTree]; 158 197 parent.InsertSubtree(subTreeIndex, replacementNode); 159 198 // exchange key and value 160 replacementNodes.Remove(subTree);161 replacementNodes.Add(replacementNode, subTree);199 foldedNodes.Remove(subTree); 200 foldedNodes.Add(replacementNode, subTree); 162 201 } 163 202 } … … 168 207 double min = impacts.Min(); 169 208 foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) { 209 VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode); 210 170 211 if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) { 171 212 double impact = nodeImpacts[treeNode]; 172 VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);173 213 174 214 // impact = 0 if no change … … 185 225 } 186 226 visualTree.ToolTip += Environment.NewLine + "Node impact: " + impact; 187 var constantReplacementNode = replacementNodes[treeNode] as ConstantTreeNode;227 var constantReplacementNode = foldedNodes[treeNode] as ConstantTreeNode; 188 228 if (constantReplacementNode != null) { 189 229 visualTree.ToolTip += Environment.NewLine + "Replacement value: " + constantReplacementNode.Value; 190 230 } 191 231 } 192 } 193 this.PaintCollapsedNodes(); 194 this.treeChart.Repaint(); 195 } 196 197 private void PaintCollapsedNodes() { 198 foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) { 199 if (treeNode is ConstantTreeNode && replacementNodes.ContainsKey(treeNode)) 200 this.treeChart.GetVisualSymbolicExpressionTreeNode(treeNode).LineColor = Color.DarkOrange; 201 else { 202 VisualSymbolicExpressionTreeNode visNode = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode); 203 if (visNode != null) 204 visNode.LineColor = Color.Black; 205 } 206 } 232 if (visualTree != null) 233 if (changedNodes.ContainsKey(treeNode)) { 234 visualTree.LineColor = Color.DodgerBlue; 235 } else if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) { 236 visualTree.LineColor = Color.DarkOrange; 237 } 238 } 239 treeChart.RepaintNodes(); 207 240 } 208 241 209 242 private void btnSimplify_Click(object sender, EventArgs e) { 210 SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();243 var simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier(); 211 244 var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree); 212 245 UpdateModel(simplifiedExpressionTree); -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame
r7675 r9363 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4. 2.$WCREV$")]28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4.3.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginFile("displayModelFrame.html", PluginFileType.Data)] 31 [PluginDependency("HeuristicLab.ALGLIB", "3. 5")]31 [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")] 32 32 [PluginDependency("HeuristicLab.Collections", "3.3")] 33 33 [PluginDependency("HeuristicLab.Common", "3.3")] -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties
- Property svn:ignore
--- +++
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.cs.frame
r7259 r9363 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.4.0.0")] 55 [assembly: AssemblyFileVersion("3.4. 2.$WCREV$")]55 [assembly: AssemblyFileVersion("3.4.3.$WCREV$")] -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs
r8103 r9363 124 124 RegisterVariableNamesViewContentEvents(); 125 125 } else { 126 var existingEntries = variableNamesView.Content.ToList();127 128 126 // temporarily deregister to prevent circular calling of events 129 127 DeregisterVariableNamesViewContentEvents(); 130 // add additional entries 131 foreach (var variableName in Content.VariableNames.Except(existingEntries.Select(x => x.Value))) 132 variableNamesView.Content.Add(new StringValue(variableName), true); 133 foreach (var oldEntry in existingEntries.Where(x => !Content.VariableNames.Contains(x.Value))) 134 variableNamesView.Content.Remove(oldEntry); 128 variableNamesView.Content.Clear(); 129 foreach (var variableName in Content.AllVariableNames) { 130 variableNamesView.Content.Add(new StringValue(variableName), Content.VariableNames.Contains(variableName)); 131 } 135 132 RegisterVariableNamesViewContentEvents(); 136 133 -
branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs
r8103 r9363 92 92 protected override void SetEnabledStateOfControls() { 93 93 base.SetEnabledStateOfControls(); 94 enabledCheckBox.Enabled = Content != null && Content.VariableNames.Any() && !Locked && !ReadOnly; 94 95 weightInitializationMuTextBox.Enabled = Content != null; 95 96 weightInitializationMuTextBox.ReadOnly = ReadOnly; … … 123 124 private void UpdateContent() { 124 125 if (Content != null) { 126 Content.Fixed = true; 125 127 DeregisterContentEvents(); 126 128 Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value).ToList(); … … 180 182 RegisterVariableNamesViewContentEvents(); 181 183 } else { 182 var existingEntries = variableNamesView.Content.ToList();183 184 184 // temporarily deregister to prevent circular calling of events 185 185 DeregisterVariableNamesViewContentEvents(); 186 // add additional entries 187 foreach (var variableName in Content.VariableNames.Except(existingEntries.Select(x => x.Value))) 188 variableNamesView.Content.Add(new StringValue(variableName), true); 189 foreach (var oldEntry in existingEntries.Where(x => !Content.VariableNames.Contains(x.Value))) 190 variableNamesView.Content.Remove(oldEntry); 186 variableNamesView.Content.Clear(); 187 foreach (var variableName in Content.AllVariableNames) { 188 variableNamesView.Content.Add(new StringValue(variableName), Content.VariableNames.Contains(variableName)); 189 } 191 190 RegisterVariableNamesViewContentEvents(); 192 191
Note: See TracChangeset
for help on using the changeset viewer.