Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/13 13:13:41 (11 years ago)
Author:
spimming
Message:

#1888:

  • Merged revisions from trunk
Location:
branches/OaaS
Files:
1 deleted
12 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/OaaS

  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

    • Property svn:mergeinfo set to (toggle deleted branches)
      /trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Viewsmergedeligible
      /branches/Algorithms.GradientDescent/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6917-7005
      /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views4656-4721
      /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5815-6180
      /branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Views4458-4459,​4462,​4464
      /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5060
      /branches/HeuristicLab.TreeSimplifier/HeuristicLab.Problems.DataAnalysis.Symbolic.Views8388-8942
      /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5138-5162
      /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Views7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6828
      /branches/RuntimeOptimizer/HeuristicLab.Problems.DataAnalysis.Symbolic.Views8943-9078
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.DataAnalysis.Symbolic.Views7787-8333
      /branches/SlaveShutdown/HeuristicLab.Problems.DataAnalysis.Symbolic.Views8944-8956
      /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5370-5682
      /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views6829-6865
      /branches/UnloadJobs/HeuristicLab.Problems.DataAnalysis.Symbolic.Views9168-9215
      /branches/VNS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5594-5752
      /branches/histogram/HeuristicLab.Problems.DataAnalysis.Symbolic.Views5959-6341
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4

    • Property svn:ignore
      •  

        old new  
         1*.user
         2Plugin.cs
        13bin
        24obj
        3 *.user
        4 HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin.cs
        5 *.vs10x
        6 Plugin.cs
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs

    r8110 r9363  
    4040    protected override void OnContentChanged() {
    4141      base.OnContentChanged();
     42      symbolicExpressionTreeView.Content = null;
    4243      if (Content != null)
    4344        symbolicExpressionTreeView.Content = Content.SymbolicExpressionTree;
    44       else
    45         symbolicExpressionTreeView.Content = null;
    4645    }
    4746  }
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r7675 r9363  
    9393  </PropertyGroup>
    9494  <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>
    9797      <Private>False</Private>
    9898    </Reference>
     
    114114  </ItemGroup>
    115115  <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>
    116122    <Compile Include="MathSymbolicDataAnalysisModelView.cs">
    117123      <SubType>UserControl</SubType>
     
    168174    <Compile Include="Symbols\VariableView.Designer.cs">
    169175      <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>
    170194    </Compile>
    171195    <None Include="HeuristicLab.snk" />
     
    313337  -->
    314338  <PropertyGroup>
    315     <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     339    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    316340set ProjectDir=$(ProjectDir)
    317341set SolutionDir=$(SolutionDir)
     
    320344call PreBuildEvent.cmd
    321345</PreBuildEvent>
     346    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     347export ProjectDir=$(ProjectDir)
     348export SolutionDir=$(SolutionDir)
     349
     350$SolutionDir/PreBuildEvent.sh
     351</PreBuildEvent>
    322352  </PropertyGroup>
    323353</Project>
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs

    r8053 r9363  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
     47      this.components = new System.ComponentModel.Container();
    4848      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    4949      this.splitContainer = new System.Windows.Forms.SplitContainer();
    5050      this.grpSimplify = new System.Windows.Forms.GroupBox();
     51      this.treeStatusValue = new System.Windows.Forms.Label();
    5152      this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
     53      this.btnOptimizeConstants = new System.Windows.Forms.Button();
    5254      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();
    5457      this.grpViewHost = new System.Windows.Forms.GroupBox();
    5558      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
     
    6265      this.SuspendLayout();
    6366      //
    64       // treeChart
    65       //
    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       //
    8067      // viewHost
    8168      //
     
    8976      this.viewHost.Name = "viewHost";
    9077      this.viewHost.ReadOnly = false;
    91       this.viewHost.Size = new System.Drawing.Size(335, 326);
     78      this.viewHost.Size = new System.Drawing.Size(336, 383);
    9279      this.viewHost.TabIndex = 0;
    9380      this.viewHost.ViewsLabelVisible = true;
     
    10794      //
    10895      this.splitContainer.Panel2.Controls.Add(this.grpViewHost);
    109       this.splitContainer.Size = new System.Drawing.Size(564, 348);
     96      this.splitContainer.Size = new System.Drawing.Size(565, 405);
    11097      this.splitContainer.SplitterDistance = 213;
    11198      this.splitContainer.TabIndex = 1;
     
    113100      // grpSimplify
    114101      //
     102      this.grpSimplify.AutoSize = true;
     103      this.grpSimplify.Controls.Add(this.treeStatusValue);
    115104      this.grpSimplify.Controls.Add(this.flowLayoutPanel);
     105      this.grpSimplify.Controls.Add(this.treeStatusLabel);
    116106      this.grpSimplify.Controls.Add(this.treeChart);
    117107      this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill;
    118108      this.grpSimplify.Location = new System.Drawing.Point(0, 0);
    119109      this.grpSimplify.Name = "grpSimplify";
    120       this.grpSimplify.Size = new System.Drawing.Size(213, 348);
     110      this.grpSimplify.Size = new System.Drawing.Size(213, 405);
    121111      this.grpSimplify.TabIndex = 1;
    122112      this.grpSimplify.TabStop = false;
    123113      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";
    124125      //
    125126      // flowLayoutPanel
     
    129130      this.flowLayoutPanel.Controls.Add(this.btnSimplify);
    130131      this.flowLayoutPanel.Controls.Add(this.btnOptimizeConstants);
    131       this.flowLayoutPanel.Location = new System.Drawing.Point(6, 313);
     132      this.flowLayoutPanel.Location = new System.Drawing.Point(6, 370);
    132133      this.flowLayoutPanel.Name = "flowLayoutPanel";
    133134      this.flowLayoutPanel.Size = new System.Drawing.Size(204, 29);
    134135      this.flowLayoutPanel.TabIndex = 2;
    135136      this.flowLayoutPanel.WrapContents = false;
    136       //
    137       // btnSimplify
    138       //
    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);
    146137      //
    147138      // btnOptimizeConstants
     
    157148      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
    158149      //
     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      //
    159188      // grpViewHost
    160189      //
     
    163192      this.grpViewHost.Location = new System.Drawing.Point(0, 0);
    164193      this.grpViewHost.Name = "grpViewHost";
    165       this.grpViewHost.Size = new System.Drawing.Size(347, 348);
     194      this.grpViewHost.Size = new System.Drawing.Size(348, 405);
    166195      this.grpViewHost.TabIndex = 1;
    167196      this.grpViewHost.TabStop = false;
     
    171200      //
    172201      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    173       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     202      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    174203      this.Controls.Add(this.splitContainer);
     204      this.DoubleBuffered = true;
    175205      this.Name = "InteractiveSymbolicDataAnalysisSolutionSimplifierView";
    176       this.Size = new System.Drawing.Size(564, 348);
     206      this.Size = new System.Drawing.Size(565, 405);
    177207      this.splitContainer.Panel1.ResumeLayout(false);
     208      this.splitContainer.Panel1.PerformLayout();
    178209      this.splitContainer.Panel2.ResumeLayout(false);
    179210      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    180211      this.splitContainer.ResumeLayout(false);
    181212      this.grpSimplify.ResumeLayout(false);
     213      this.grpSimplify.PerformLayout();
    182214      this.flowLayoutPanel.ResumeLayout(false);
    183215      this.grpViewHost.ResumeLayout(false);
     
    188220    #endregion
    189221
    190     private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;
     222    private InteractiveSymbolicExpressionTreeChart treeChart;
    191223    private System.Windows.Forms.SplitContainer splitContainer;
    192224    private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     
    196228    private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
    197229    protected System.Windows.Forms.Button btnOptimizeConstants;
     230    private System.Windows.Forms.Label treeStatusValue;
     231    private System.Windows.Forms.Label treeStatusLabel;
    198232  }
    199233}
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r7259 r9363  
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3333  public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView {
    34     private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> replacementNodes;
     34    private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes;
     35    private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes;
    3536    private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
    36     private bool updateInProgress = false;
     37    private enum TreeState { Valid, Invalid }
     38    private TreeState treeState;
    3739
    3840    public InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
    3941      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>();
    4245      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;
    43117    }
    44118
     
    50124    protected override void RegisterContentEvents() {
    51125      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;
    54128    }
    55129    protected override void DeregisterContentEvents() {
    56130      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();
    74137    }
    75138
    76139    protected override void OnContentChanged() {
    77140      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();
    113158    }
    114159
     
    117162    protected abstract void UpdateModel(ISymbolicExpressionTree tree);
    118163
    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();
    124167      constantTreeNode.Value = value;
    125168      return constantTreeNode;
     
    127170
    128171    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;
    130176      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);
    151190    }
    152191
     
    154193      ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex);
    155194      parent.RemoveSubtree(subTreeIndex);
    156       if (replacementNodes.ContainsKey(subTree)) {
    157         var replacementNode = replacementNodes[subTree];
     195      if (foldedNodes.ContainsKey(subTree)) {
     196        var replacementNode = foldedNodes[subTree];
    158197        parent.InsertSubtree(subTreeIndex, replacementNode);
    159198        // exchange key and value
    160         replacementNodes.Remove(subTree);
    161         replacementNodes.Add(replacementNode, subTree);
     199        foldedNodes.Remove(subTree);
     200        foldedNodes.Add(replacementNode, subTree);
    162201      }
    163202    }
     
    168207      double min = impacts.Min();
    169208      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
     209        VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
     210
    170211        if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
    171212          double impact = nodeImpacts[treeNode];
    172           VisualSymbolicExpressionTreeNode visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    173213
    174214          // impact = 0 if no change
     
    185225          }
    186226          visualTree.ToolTip += Environment.NewLine + "Node impact: " + impact;
    187           var constantReplacementNode = replacementNodes[treeNode] as ConstantTreeNode;
     227          var constantReplacementNode = foldedNodes[treeNode] as ConstantTreeNode;
    188228          if (constantReplacementNode != null) {
    189229            visualTree.ToolTip += Environment.NewLine + "Replacement value: " + constantReplacementNode.Value;
    190230          }
    191231        }
    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();
    207240    }
    208241
    209242    private void btnSimplify_Click(object sender, EventArgs e) {
    210       SymbolicDataAnalysisExpressionTreeSimplifier simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
     243      var simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
    211244      var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);
    212245      UpdateModel(simplifiedExpressionTree);
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame

    r7675 r9363  
    2626
    2727namespace 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$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginFile("displayModelFrame.html", PluginFileType.Data)]
    31   [PluginDependency("HeuristicLab.ALGLIB", "3.5")]
     31  [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
    3232  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3333  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties

    • Property svn:ignore
      --- 
      +++ 
      
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.cs.frame

    r7259 r9363  
    5353// by using the '*' as shown below:
    5454[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  
    124124        RegisterVariableNamesViewContentEvents();
    125125      } else {
    126         var existingEntries = variableNamesView.Content.ToList();
    127 
    128126        // temporarily deregister to prevent circular calling of events
    129127        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        }
    135132        RegisterVariableNamesViewContentEvents();
    136133
  • branches/OaaS/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs

    r8103 r9363  
    9292    protected override void SetEnabledStateOfControls() {
    9393      base.SetEnabledStateOfControls();
     94      enabledCheckBox.Enabled = Content != null && Content.VariableNames.Any() && !Locked && !ReadOnly;
    9495      weightInitializationMuTextBox.Enabled = Content != null;
    9596      weightInitializationMuTextBox.ReadOnly = ReadOnly;
     
    123124    private void UpdateContent() {
    124125      if (Content != null) {
     126        Content.Fixed = true;
    125127        DeregisterContentEvents();
    126128        Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value).ToList();
     
    180182        RegisterVariableNamesViewContentEvents();
    181183      } else {
    182         var existingEntries = variableNamesView.Content.ToList();
    183 
    184184        // temporarily deregister to prevent circular calling of events
    185185        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        }
    191190        RegisterVariableNamesViewContentEvents();
    192191
Note: See TracChangeset for help on using the changeset viewer.