Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12320


Ignore:
Timestamp:
04/16/15 12:32:26 (9 years ago)
Author:
arapeanu
Message:

#2288: Added sliders functionality, dialog box for setting the number of repetitions for each batch + modified node importance weighting

Location:
branches/HeuristicLab.VariableInteractionNetworks
Files:
2 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/HeuristicLab.VariableInteractionNetworks.Views-3.3.csproj

    r12263 r12320  
    147147    <None Include="Plugin.cs.frame" />
    148148  </ItemGroup>
    149   <ItemGroup>
    150     <EmbeddedResource Include="VariableInteractionNetworkView.resx">
    151       <DependentUpon>VariableInteractionNetworkView.cs</DependentUpon>
    152     </EmbeddedResource>
    153   </ItemGroup>
    154149  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    155150  <PropertyGroup>
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.Designer.cs

    r12263 r12320  
    1 namespace HeuristicLab.VariableInteractionNetworks.Views
     1using System.Linq;
     2
     3namespace HeuristicLab.VariableInteractionNetworks.Views
    24{
    35    partial class VariableInteractionNetworkView
     
    2123        }
    2224
     25
    2326        #region Component Designer generated code
    2427
     
    2932        private void InitializeComponent()
    3033        {
     34            this.components = new System.ComponentModel.Container();
    3135            this.groupBox1 = new System.Windows.Forms.GroupBox();
    3236            this.viewHost1 = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     
    3438            this.groupBox2 = new System.Windows.Forms.GroupBox();
    3539            this.viewHost3 = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     40            this.groupBox4 = new System.Windows.Forms.GroupBox();
     41            this.textBox4 = new System.Windows.Forms.TextBox();
     42            this.textBox3 = new System.Windows.Forms.TextBox();
     43            this.selectTargetVariable = new System.Windows.Forms.Label();
     44            this.targetVariablesCombo = new System.Windows.Forms.ComboBox();
     45            this.selectedThreshold2 = new System.Windows.Forms.Label();
     46            this.targetThreshold = new System.Windows.Forms.TextBox();
     47            this.trackBar2 = new System.Windows.Forms.TrackBar();
     48            this.groupBox3 = new System.Windows.Forms.GroupBox();
     49            this.textBox2 = new System.Windows.Forms.TextBox();
     50            this.textBox1 = new System.Windows.Forms.TextBox();
     51            this.selectedThreshold1 = new System.Windows.Forms.Label();
     52            this.genThreshold = new System.Windows.Forms.TextBox();
     53            this.trackBar1 = new System.Windows.Forms.TrackBar();
     54            this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
     55            this.errorProvider2 = new System.Windows.Forms.ErrorProvider(this.components);
    3656            this.groupBox1.SuspendLayout();
    3757            this.groupBox2.SuspendLayout();
     58            this.groupBox4.SuspendLayout();
     59            ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
     60            this.groupBox3.SuspendLayout();
     61            ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
     62            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     63            ((System.ComponentModel.ISupportInitialize)(this.errorProvider2)).BeginInit();
    3864            this.SuspendLayout();
    3965            //
     
    4268            this.groupBox1.Controls.Add(this.viewHost1);
    4369            this.groupBox1.Controls.Add(this.viewHost2);
    44             this.groupBox1.Location = new System.Drawing.Point(0, 3);
     70            this.groupBox1.Location = new System.Drawing.Point(6, 3);
    4571            this.groupBox1.Name = "groupBox1";
    46             this.groupBox1.Size = new System.Drawing.Size(635, 228);
     72            this.groupBox1.Size = new System.Drawing.Size(641, 276);
    4773            this.groupBox1.TabIndex = 0;
    4874            this.groupBox1.TabStop = false;
     
    7096            this.viewHost2.Name = "viewHost2";
    7197            this.viewHost2.ReadOnly = false;
    72             this.viewHost2.Size = new System.Drawing.Size(210, 259);
     98            this.viewHost2.Size = new System.Drawing.Size(218, 247);
    7399            this.viewHost2.TabIndex = 0;
    74100            this.viewHost2.ViewsLabelVisible = true;
     
    77103            // groupBox2
    78104            //
     105            this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     106            | System.Windows.Forms.AnchorStyles.Left)));
    79107            this.groupBox2.Controls.Add(this.viewHost3);
    80             this.groupBox2.Location = new System.Drawing.Point(6, 268);
     108            this.groupBox2.Controls.Add(this.groupBox4);
     109            this.groupBox2.Controls.Add(this.groupBox3);
     110            this.groupBox2.Location = new System.Drawing.Point(6, 285);
    81111            this.groupBox2.Name = "groupBox2";
    82             this.groupBox2.Size = new System.Drawing.Size(629, 258);
     112            this.groupBox2.Size = new System.Drawing.Size(641, 283);
    83113            this.groupBox2.TabIndex = 1;
    84114            this.groupBox2.TabStop = false;
    85             this.groupBox2.Text = "Updated Adjacency Matrix (for target variable x1 and threshold 0.2)";
     115            this.groupBox2.Text = "Updated Adjacency Matrix";
    86116            //
    87117            // viewHost3
     
    93123            this.viewHost3.Name = "viewHost3";
    94124            this.viewHost3.ReadOnly = false;
    95             this.viewHost3.Size = new System.Drawing.Size(367, 239);
     125            this.viewHost3.Size = new System.Drawing.Size(354, 239);
    96126            this.viewHost3.TabIndex = 0;
    97127            this.viewHost3.ViewsLabelVisible = true;
    98128            this.viewHost3.ViewType = null;
     129            //
     130            // groupBox4
     131            //
     132            this.groupBox4.Controls.Add(this.textBox4);
     133            this.groupBox4.Controls.Add(this.textBox3);
     134            this.groupBox4.Controls.Add(this.selectTargetVariable);
     135            this.groupBox4.Controls.Add(this.targetVariablesCombo);
     136            this.groupBox4.Controls.Add(this.selectedThreshold2);
     137            this.groupBox4.Controls.Add(this.targetThreshold);
     138            this.groupBox4.Controls.Add(this.trackBar2);
     139            this.groupBox4.Location = new System.Drawing.Point(365, 148);
     140            this.groupBox4.Name = "groupBox4";
     141            this.groupBox4.Size = new System.Drawing.Size(255, 123);
     142            this.groupBox4.TabIndex = 13;
     143            this.groupBox4.TabStop = false;
     144            this.groupBox4.Text = "Apply Edge Weights Threshold for a Chosen Target Variable";
     145            //
     146            // textBox4
     147            //
     148            this.textBox4.BackColor = System.Drawing.SystemColors.Control;
     149            this.textBox4.Location = new System.Drawing.Point(217, 60);
     150            this.textBox4.Name = "textBox4";
     151            this.textBox4.ReadOnly = true;
     152            this.textBox4.Size = new System.Drawing.Size(32, 20);
     153            this.textBox4.TabIndex = 14;
     154            //
     155            // textBox3
     156            //
     157            this.textBox3.BackColor = System.Drawing.SystemColors.Control;
     158            this.textBox3.Location = new System.Drawing.Point(6, 60);
     159            this.textBox3.Name = "textBox3";
     160            this.textBox3.ReadOnly = true;
     161            this.textBox3.Size = new System.Drawing.Size(33, 20);
     162            this.textBox3.TabIndex = 14;
     163            //
     164            // selectTargetVariable
     165            //
     166            this.selectTargetVariable.AutoSize = true;
     167            this.selectTargetVariable.Location = new System.Drawing.Point(31, 36);
     168            this.selectTargetVariable.Name = "selectTargetVariable";
     169            this.selectTargetVariable.Size = new System.Drawing.Size(112, 13);
     170            this.selectTargetVariable.TabIndex = 8;
     171            this.selectTargetVariable.Text = "Select Target Variable";
     172            //
     173            // targetVariablesCombo
     174            //
     175            this.targetVariablesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     176            this.targetVariablesCombo.FormattingEnabled = true;
     177            this.targetVariablesCombo.Location = new System.Drawing.Point(159, 33);
     178            this.targetVariablesCombo.Name = "targetVariablesCombo";
     179            this.targetVariablesCombo.Size = new System.Drawing.Size(61, 21);
     180            this.targetVariablesCombo.TabIndex = 1;
     181            this.targetVariablesCombo.DropDown += new System.EventHandler(this.targetVariablesCombo_Dropdown);
     182            this.targetVariablesCombo.SelectedIndexChanged += new System.EventHandler(this.targetVariablesCombo_SelectedIndexChanged);
     183            //
     184            // selectedThreshold2
     185            //
     186            this.selectedThreshold2.AutoSize = true;
     187            this.selectedThreshold2.Location = new System.Drawing.Point(31, 93);
     188            this.selectedThreshold2.Name = "selectedThreshold2";
     189            this.selectedThreshold2.Size = new System.Drawing.Size(93, 13);
     190            this.selectedThreshold2.TabIndex = 7;
     191            this.selectedThreshold2.Text = "Select Threshold: ";
     192            //
     193            // targetThreshold
     194            //
     195            this.targetThreshold.Location = new System.Drawing.Point(132, 90);
     196            this.targetThreshold.Name = "targetThreshold";
     197            this.targetThreshold.Size = new System.Drawing.Size(48, 20);
     198            this.targetThreshold.TabIndex = 6;
     199            this.targetThreshold.Text = "0";
     200            this.targetThreshold.TextChanged += new System.EventHandler(this.targetThreshold_TextChanged);
     201            this.targetThreshold.KeyDown += new System.Windows.Forms.KeyEventHandler(this.targetThreshold_KeyDown);
     202            //
     203            // trackBar2
     204            //
     205            this.trackBar2.BackColor = System.Drawing.SystemColors.Control;
     206            this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
     207            this.trackBar2.LargeChange = 4;
     208            this.trackBar2.Location = new System.Drawing.Point(34, 60);
     209            this.trackBar2.Name = "trackBar2";
     210            this.trackBar2.Size = new System.Drawing.Size(186, 45);
     211            this.trackBar2.TabIndex = 3;
     212            this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
     213            this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged);
     214            this.trackBar2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar2_MouseDown);
     215            //
     216            // groupBox3
     217            //
     218            this.groupBox3.Controls.Add(this.textBox2);
     219            this.groupBox3.Controls.Add(this.textBox1);
     220            this.groupBox3.Controls.Add(this.selectedThreshold1);
     221            this.groupBox3.Controls.Add(this.genThreshold);
     222            this.groupBox3.Controls.Add(this.trackBar1);
     223            this.groupBox3.Location = new System.Drawing.Point(365, 19);
     224            this.groupBox3.Name = "groupBox3";
     225            this.groupBox3.Size = new System.Drawing.Size(255, 95);
     226            this.groupBox3.TabIndex = 12;
     227            this.groupBox3.TabStop = false;
     228            this.groupBox3.Text = "Apply General Threshold for Edge Weights";
     229            //
     230            // textBox2
     231            //
     232            this.textBox2.BackColor = System.Drawing.SystemColors.Control;
     233            this.textBox2.Location = new System.Drawing.Point(217, 24);
     234            this.textBox2.Name = "textBox2";
     235            this.textBox2.ReadOnly = true;
     236            this.textBox2.Size = new System.Drawing.Size(32, 20);
     237            this.textBox2.TabIndex = 13;
     238            //
     239            // textBox1
     240            //
     241            this.textBox1.BackColor = System.Drawing.SystemColors.Control;
     242            this.textBox1.Location = new System.Drawing.Point(6, 24);
     243            this.textBox1.Name = "textBox1";
     244            this.textBox1.ReadOnly = true;
     245            this.textBox1.Size = new System.Drawing.Size(33, 20);
     246            this.textBox1.TabIndex = 12;
     247            //
     248            // selectedThreshold1
     249            //
     250            this.selectedThreshold1.AutoSize = true;
     251            this.selectedThreshold1.Location = new System.Drawing.Point(31, 62);
     252            this.selectedThreshold1.Name = "selectedThreshold1";
     253            this.selectedThreshold1.Size = new System.Drawing.Size(93, 13);
     254            this.selectedThreshold1.TabIndex = 10;
     255            this.selectedThreshold1.Text = "Select Threshold: ";
     256            //
     257            // genThreshold
     258            //
     259            this.genThreshold.Location = new System.Drawing.Point(132, 59);
     260            this.genThreshold.Name = "genThreshold";
     261            this.genThreshold.Size = new System.Drawing.Size(48, 20);
     262            this.genThreshold.TabIndex = 9;
     263            this.genThreshold.Text = "0";
     264            this.genThreshold.TextChanged += new System.EventHandler(this.genThreshold_TextChanged);
     265            this.genThreshold.KeyDown += new System.Windows.Forms.KeyEventHandler(this.genThreshold_KeyDown);
     266            //
     267            // trackBar1
     268            //
     269            this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand;
     270            this.trackBar1.LargeChange = 4;
     271            this.trackBar1.Location = new System.Drawing.Point(34, 24);
     272            this.trackBar1.Name = "trackBar1";
     273            this.trackBar1.RightToLeft = System.Windows.Forms.RightToLeft.No;
     274            this.trackBar1.Size = new System.Drawing.Size(186, 45);
     275            this.trackBar1.TabIndex = 2;
     276            this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
     277            this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
     278            this.trackBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseDown);
     279            //
     280            // errorProvider
     281            //
     282            this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
     283            this.errorProvider.ContainerControl = this;
     284            //
     285            // errorProvider2
     286            //
     287            this.errorProvider2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
     288            this.errorProvider2.ContainerControl = this;
    99289            //
    100290            // VariableInteractionNetworkView
     
    105295            this.Controls.Add(this.groupBox1);
    106296            this.Name = "VariableInteractionNetworkView";
    107             this.Size = new System.Drawing.Size(635, 513);
     297            this.Size = new System.Drawing.Size(810, 599);
    108298            this.groupBox1.ResumeLayout(false);
    109299            this.groupBox2.ResumeLayout(false);
     300            this.groupBox4.ResumeLayout(false);
     301            this.groupBox4.PerformLayout();
     302            ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
     303            this.groupBox3.ResumeLayout(false);
     304            this.groupBox3.PerformLayout();
     305            ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
     306            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     307            ((System.ComponentModel.ISupportInitialize)(this.errorProvider2)).EndInit();
    110308            this.ResumeLayout(false);
    111309
     
    115313
    116314        private System.Windows.Forms.GroupBox groupBox1;
     315        private System.Windows.Forms.GroupBox groupBox2;
     316        private System.Windows.Forms.GroupBox groupBox3;
     317        private System.Windows.Forms.GroupBox groupBox4;
    117318        private MainForm.WindowsForms.ViewHost viewHost1;
    118319        private MainForm.WindowsForms.ViewHost viewHost2;
    119         private System.Windows.Forms.GroupBox groupBox2;
    120320        private MainForm.WindowsForms.ViewHost viewHost3;
     321        private System.Windows.Forms.TrackBar trackBar1;
     322        private System.Windows.Forms.TrackBar trackBar2;
     323        private System.Windows.Forms.ComboBox targetVariablesCombo;
     324        private System.Windows.Forms.TextBox genThreshold;
     325        private System.Windows.Forms.TextBox targetThreshold;
     326        private System.Windows.Forms.Label selectedThreshold2;
     327        private System.Windows.Forms.Label selectedThreshold1;
     328        private System.Windows.Forms.Label selectTargetVariable;
     329        private System.Windows.Forms.TextBox textBox2;
     330        private System.Windows.Forms.TextBox textBox1;
     331        private System.Windows.Forms.ErrorProvider errorProvider;
     332        private System.Windows.Forms.TextBox textBox4;
     333        private System.Windows.Forms.TextBox textBox3;
     334        private System.Windows.Forms.ErrorProvider errorProvider2;
    121335    }
    122336}
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.cs

    r12263 r12320  
    3636using System.Collections;
    3737
    38 namespace HeuristicLab.VariableInteractionNetworks.Views {
    39   [View("Variable Interaction Network")]
    40   [Content(typeof(RunCollection), IsDefaultView = false)]
    41 
    42   public sealed partial class VariableInteractionNetworkView : AsynchronousContentView {
    43     private const string variableImpactResultName = "Variable impacts";
    44     private const string TrainingBestSolutionParameterName = "Best training solution";
    45     public new RunCollection Content {
    46       get { return (RunCollection)base.Content; }
    47       set { base.Content = value; }
     38namespace HeuristicLab.VariableInteractionNetworks.Views
     39{
     40    [View("Variable Interaction Network")]
     41    [Content(typeof(RunCollection), IsDefaultView = false)]
     42
     43    public sealed partial class VariableInteractionNetworkView : AsynchronousContentView
     44    {
     45        private const string variableImpactResultName = "Variable impacts";
     46        private const string TrainingBestSolutionParameterName = "Best training solution";
     47
     48        public new RunCollection Content
     49        {
     50            get { return (RunCollection)base.Content; }
     51            set { base.Content = value; }
     52        }
     53
     54        public VariableInteractionNetworkView()
     55        {
     56            InitializeComponent();
     57        }
     58
     59        internal class NoFocusTrackBar : System.Windows.Forms.TrackBar
     60        {
     61            [System.Runtime.InteropServices.DllImport("user32.dll")]
     62            public extern static int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
     63
     64            private static int MakeParam(int loWord, int hiWord)
     65            {
     66                return (hiWord << 16) | (loWord & 0xffff);
     67            }
     68
     69            protected override void OnGotFocus(EventArgs e)
     70            {
     71                base.OnGotFocus(e);
     72                SendMessage(this.Handle, 0x0128, MakeParam(1, 0x1), 0);
     73            }
     74        }
     75
     76        #region events
     77
     78        //  #region Event Handlers (Content)
     79        protected override void OnContentChanged()
     80        {
     81            base.OnContentChanged();
     82            if (Content == null)
     83            {
     84                // TODO: Add code when content has been changed and is null
     85            }
     86            else
     87            {
     88                // TODO: Add code when content has been changed and is not null
     89                viewHost2.Content = CalculateNodeImportance(CalculateAdjacencyMatrix());     
     90                var adjMatrix = CalculateAdjacencyMatrix();
     91                viewHost1.Content = adjMatrix;
     92                viewHost3.Content = (DoubleMatrix)adjMatrix.Clone();
     93                trackBar1.Minimum = (int)(1000 * GetMinNonNullElement(adjMatrix));
     94                trackBar1.Maximum = (int)(1000 * (adjMatrix.Max()));
     95            }
     96        }
     97        #endregion
     98
     99        protected override void SetEnabledStateOfControls()
     100        {
     101            base.SetEnabledStateOfControls();
     102            // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
     103        }
     104
     105        #region Event Handlers (child controls)
     106        // TODO: Put event handlers of child controls here.
     107        #endregion
     108
     109        private DoubleMatrix CalculateAdjacencyMatrix()
     110        {
     111            var runCollection = Content;
     112            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
     113
     114            var allVariableImpacts = runCollection.Select(run => (DoubleMatrix)run.Results[variableImpactResultName]);
     115            var variableNames = (from variableImpact in allVariableImpacts
     116                                 from variableName in variableImpact.RowNames
     117                                 select variableName).Distinct().ToArray();
     118            var adjMatrix = new DoubleMatrix(variableNames.Length, variableNames.Length);
     119
     120            adjMatrix.RowNames = groupRunCollection.Select(x => x.Key);
     121            adjMatrix.ColumnNames = adjMatrix.RowNames;
     122            for (int j = 0; j < groupRunCollection.Count; ++j)
     123            {
     124                var g = groupRunCollection[j];
     125                var matrix = CalculateAdjacencyRows(g);
     126                var variables = new List<Tuple<string, double>>();
     127                var columnNames = matrix.ColumnNames.ToList();
     128
     129                for (int i = 0; i < matrix.Columns; ++i)
     130                {
     131                    variables.Add(new Tuple<string, double>(columnNames[i], matrix[0, i]));
     132                }
     133                variables.Add(new Tuple<string, double>(g.Key, 0));
     134                variables.Sort((a, b) => a.Item1.CompareTo(b.Item1));
     135                for (int i = 0; i < variables.Count; ++i)
     136                {
     137                    adjMatrix[j, i] = variables[i].Item2;
     138
     139                }
     140            }
     141            return adjMatrix;
     142        }
     143
     144        private DoubleMatrix CalculateAdjacencyRows(IEnumerable<IRun> runs)
     145        {
     146            IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
     147                                                            select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
     148            var variableNames = (from variableImpact in allVariableImpacts
     149                                 from variableName in variableImpact.RowNames
     150                                 select variableName)
     151                                              .Distinct().ToArray();
     152
     153            List<string> variableNamesList = (from variableName in variableNames
     154                                              where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
     155                                              select variableName)
     156                                             .ToList();
     157
     158            var runNames = runs.Select(x => x.Name).ToArray();
     159            var runsArray = runs.ToArray();
     160            DoubleMatrix varImpactMatrix = CalculateVariableImpactMatrix(runsArray, runNames);
     161            var targetMatrix = new DoubleMatrix(1, variableNames.Length);
     162
     163            for (int i = 0; i < varImpactMatrix.Rows; ++i)
     164            {
     165                targetMatrix[0, i] = varImpactMatrix[i, runNames.Length];
     166            }
     167
     168            targetMatrix.RowNames = new[] { "Target" };
     169            targetMatrix.ColumnNames = variableNames;
     170
     171            return targetMatrix;
     172        }
     173
     174        private DoubleMatrix UpdateAdjacencyMatrixByThresholdAndTargetVariable(double threshold, string targetVariable, DoubleMatrix adjMatrix)
     175        {
     176            var originalMatrix = (DoubleMatrix)viewHost1.Content;
     177            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
     178            string[] targets = adjMatrix.RowNames.ToArray();
     179            var targetIndex = Array.IndexOf(targets, targetVariable);
     180
     181            for (int j = 0; j < groupRunCollection.Count; ++j)
     182            {
     183                double originalValue = originalMatrix[targetIndex, j];
     184                adjMatrix[targetIndex, j] = (originalValue <= Math.Max(threshold, Double.Parse(genThreshold.Text))) ? 0 : originalValue;
     185            }
     186            return adjMatrix;
     187        }
     188
     189        private DoubleMatrix UpdateAdjacencyMatrixByThreshold(double threshold, DoubleMatrix adjMatrix)
     190        {
     191         //   var updatedMatrix = (DoubleMatrix) adjMatrix.Clone();
     192            var originalMatrix = (DoubleMatrix)viewHost1.Content;
     193            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
     194
     195            for (int i = 0; i < adjMatrix.Rows; ++i)
     196            {
     197                for (int j = 0; j < adjMatrix.Columns; ++j)
     198                {
     199                    double originalValue = originalMatrix[i, j];
     200                    adjMatrix[i, j] = originalValue <= threshold ? 0 : originalValue;
     201                }
     202            }
     203            return adjMatrix;
     204        }
     205
     206        private double GetMinNonNullElement(DoubleMatrix adjMatrix)
     207        {
     208            double min = adjMatrix.Max();
     209            for (int i = 0; i < adjMatrix.Rows; i++)
     210            {
     211                for (int j = 0; j < adjMatrix.Columns; j++)
     212                {                 
     213                    min = (min > adjMatrix[i, j] && adjMatrix[i, j] != 0) ? adjMatrix[i, j] : min;
     214                }
     215            }
     216            return min;
     217        }
     218
     219        private double GetMaxFromRow(int rowIndex, DoubleMatrix adjMatrix)
     220        {
     221            double max = adjMatrix.Min();
     222            for (int j = 0; j < adjMatrix.Columns; ++j)
     223            {
     224                max = (max < adjMatrix[rowIndex, j] && adjMatrix[rowIndex, j] != 0) ? adjMatrix[rowIndex, j] : max;
     225            }
     226            return max;
     227        }
     228
     229        private DoubleMatrix CalculateNodeImportance(DoubleMatrix adjMatrix)
     230        {
     231            DoubleMatrix nodeImportance = new DoubleMatrix(adjMatrix.Rows, 1);
     232            var variables = new List<Tuple<string, double>>();
     233            var rowNames = adjMatrix.RowNames.ToList();
     234            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
     235            double[] meanQuality = new double[groupRunCollection.Count];
     236
     237            for (int j = 0; j < groupRunCollection.Count; ++j)
     238            {
     239                var g = groupRunCollection[j];
     240                meanQuality[j] = g.Average(x => ((IRegressionSolution)x.Results[TrainingBestSolutionParameterName]).TrainingRSquared);
     241            }
     242
     243            for (int i = 0; i < adjMatrix.Columns; ++i)
     244            {
     245                for (int j = 0; j < adjMatrix.Rows; ++j)
     246                {
     247                    nodeImportance[i, 0] += adjMatrix[j, i] * meanQuality[j];
     248                }
     249                nodeImportance[i, 0] /= (adjMatrix.Rows - 1);
     250                variables.Add(new Tuple<string, double>(rowNames[i], nodeImportance[i, 0]));
     251            }
     252
     253            variables.Sort((b, a) => a.Item2.CompareTo(b.Item2));
     254
     255            for (int i = 0; i < nodeImportance.Rows; ++i)
     256            {
     257                nodeImportance[i, 0] = variables[i].Item2;
     258                rowNames[i] = variables[i].Item1;
     259            }
     260
     261            nodeImportance.RowNames = rowNames;
     262            nodeImportance.ColumnNames = new[] { "Node Importance" };
     263            return nodeImportance;
     264        }
     265
     266        //adapted from RunCollectionVariableImpactView
     267        private DoubleMatrix CalculateVariableImpactMatrix(IRun[] runs, string[] runNames)
     268        {
     269            IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
     270                                                            select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
     271            IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts
     272                                                 from variableName in variableImpact.RowNames
     273                                                 select variableName).Distinct();
     274
     275            // filter variableNames: only include names that have at least one non-zero value in a run
     276            List<string> variableNamesList = (from variableName in variableNames
     277                                              where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
     278                                              select variableName).ToList();
     279
     280            List<string> columnNames = new List<string>(runNames);
     281            columnNames.Add("Mean");
     282
     283            int numberOfRuns = runs.Length;
     284
     285            DoubleMatrix matrix = new DoubleMatrix(variableNamesList.Count, numberOfRuns + 1);
     286            matrix.SortableView = true;
     287            matrix.ColumnNames = columnNames;
     288
     289            List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList
     290                                                          select GetVariableImpacts(variableName, allVariableImpacts).ToList()).ToList();
     291
     292            for (int row = 0; row < variableImpactsOverRuns.Count; row++)
     293            {
     294                matrix[row, numberOfRuns] = Math.Round(variableImpactsOverRuns[row].Average(), 3);
     295            }
     296
     297            // fill matrix with impacts from runs
     298            for (int i = 0; i < runs.Length; i++)
     299            {
     300                IRun run = runs[i];
     301                DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName];
     302                for (int j = 0; j < runVariableImpacts.Rows; j++)
     303                {
     304                    int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j));
     305                    if (rowIndex > -1)
     306                    {
     307                        matrix[rowIndex, i] = Math.Round(runVariableImpacts[j, 0], 3);
     308                    }
     309                }
     310            }
     311            return matrix;
     312        }
     313
     314        //taken from RunCollectionVariableImpactView
     315        private IEnumerable<double> GetVariableImpacts(string variableName, IEnumerable<DoubleMatrix> allVariableImpacts)
     316        {
     317            foreach (DoubleMatrix runVariableImpacts in allVariableImpacts)
     318            {
     319                int row = 0;
     320                foreach (string rowName in runVariableImpacts.RowNames)
     321                {
     322                    if (rowName == variableName)
     323                        yield return runVariableImpacts[row, 0];
     324                    row++;
     325                }
     326            }
     327        }
     328
     329        private void trackBar1_ValueChanged(object sender, EventArgs e)
     330        {
     331            genThreshold.Text = (0.001 * trackBar1.Value).ToString();
     332            textBox1.Text = (0.001 * trackBar1.Minimum).ToString();
     333            textBox2.Text = (0.001 * trackBar1.Maximum).ToString();
     334            viewHost3.Content = UpdateAdjacencyMatrixByThreshold(0.001 * trackBar1.Value, (DoubleMatrix)viewHost3.Content);
     335        }
     336
     337        private void mouseDownEvent(TrackBar tb, MouseEventArgs e)
     338        {
     339                double percentage = (double)e.X / (double)(tb.Width - 6);
     340                double clickPos = percentage * (tb.Maximum - tb.Minimum);
     341                try
     342                {
     343                    tb.Value = (int)clickPos + tb.Minimum;
     344                }
     345                catch
     346                {
     347                    MessageBox.Show("Value outside range!");
     348                    return;
     349                }
     350        }
     351
     352        private void trackBar1_MouseDown(object sender, MouseEventArgs e)
     353        {
     354            mouseDownEvent(trackBar1, e);
     355        }
     356
     357        private void trackBar2_MouseDown(object sender, MouseEventArgs e)
     358        {
     359            if (targetVariablesCombo.SelectedIndex < 0)
     360            {
     361                return;
     362            }
     363            else
     364            {
     365                mouseDownEvent(trackBar2, e);
     366            }
     367        }
     368
     369        private void trackBar2_ValueChanged(object sender, EventArgs e)
     370        {
     371            targetThreshold.Text = (0.001 * trackBar2.Value).ToString();
     372
     373            if (targetVariablesCombo.SelectedIndex < 0)
     374            {
     375                MessageBox.Show("Please select target variable!");
     376                return;
     377            }
     378            else
     379            {
     380                string selectedItem = (string)targetVariablesCombo.Items[targetVariablesCombo.SelectedIndex];
     381                viewHost3.Content = UpdateAdjacencyMatrixByThresholdAndTargetVariable(0.001 * trackBar2.Value, selectedItem, (DoubleMatrix)viewHost3.Content);
     382            }
     383        }
     384
     385        private void genThresholdEvent()
     386        {
     387            this.errorProvider.SetError(genThreshold, "");
     388
     389            if (genThreshold.Text != "")
     390            {
     391                if (Double.Parse(genThreshold.Text) >= GetMinNonNullElement((DoubleMatrix)viewHost1.Content) && Double.Parse(genThreshold.Text) <= ((DoubleMatrix)viewHost1.Content).Max())
     392                {
     393                    genThreshold.Select(genThreshold.Text.Length, 0);
     394                    trackBar1.Value = (int)(1000 * Double.Parse(genThreshold.Text));
     395                    viewHost3.Content = UpdateAdjacencyMatrixByThreshold(Double.Parse(genThreshold.Text), (DoubleMatrix)viewHost3.Content);
     396                }
     397                else
     398                {
     399                    this.errorProvider.SetError(genThreshold, "Value out of range!");
     400                }
     401            }
     402            else
     403            {
     404                MessageBox.Show("Please select a threshold!");
     405                this.errorProvider.SetError(genThreshold, "");
     406                return;
     407            }
     408        }
     409
     410        private void genThreshold_TextChanged(object sender, EventArgs e)
     411        {
     412            genThresholdEvent();
     413        }
     414
     415        private void genThreshold_KeyDown(object sender, KeyEventArgs e)
     416        {
     417            if (e.KeyCode == Keys.Enter)
     418                genThresholdEvent();       
     419        }
     420
     421        private void targetThresholdEvent()
     422        {
     423            this.errorProvider2.SetError(targetThreshold, "");
     424
     425            if (targetVariablesCombo.SelectedIndex < 0)
     426            {
     427                return;
     428            }
     429            else
     430            {
     431                string selectedItem = (string)targetVariablesCombo.Items[targetVariablesCombo.SelectedIndex];
     432                if (Double.Parse(targetThreshold.Text) >= Double.Parse(textBox3.Text) && Double.Parse(targetThreshold.Text) <= Double.Parse(textBox4.Text))
     433                {
     434                    trackBar2.Value = (int)(1000 * Double.Parse(targetThreshold.Text));
     435                }
     436                else
     437                {
     438                    this.errorProvider2.SetError(targetThreshold, "Value out of range!");
     439                    return;
     440                }
     441            }
     442        }
     443
     444        private void targetThreshold_TextChanged(object sender, EventArgs e)
     445        {
     446            targetThresholdEvent();
     447        }
     448
     449        private void targetThreshold_KeyDown(object sender, KeyEventArgs e)
     450        {
     451            if (e.KeyCode == Keys.Enter)
     452            {
     453                targetThresholdEvent();
     454            }
     455        }
     456
     457        private void targetVariablesCombo_Dropdown(object sender, System.EventArgs e)
     458        {
     459            targetVariablesCombo.Items.Clear();
     460            string[] targetVariables = ((DoubleMatrix)viewHost3.Content).RowNames.ToArray();
     461            targetVariablesCombo.Items.AddRange(targetVariables);
     462        }
     463
     464        private void targetVariablesCombo_SelectedIndexChanged(object sender, System.EventArgs e)
     465        {
     466            var targetIndex = targetVariablesCombo.SelectedIndex;
     467            string selectedItem = (string)targetVariablesCombo.Items[targetIndex];
     468            trackBar2.Minimum = 0;
     469            trackBar2.Maximum = (int)(1000 * GetMaxFromRow(targetIndex, (DoubleMatrix)viewHost1.Content));
     470            textBox3.Text = trackBar2.Minimum.ToString();
     471            textBox4.Text = (0.001 * trackBar2.Maximum).ToString();
     472            UpdateAdjacencyMatrixByThresholdAndTargetVariable(0.001 * trackBar2.Value, selectedItem, (DoubleMatrix)viewHost3.Content);
     473        }
    48474    }
    49 
    50     public VariableInteractionNetworkView() {
    51       InitializeComponent();
    52     }
    53 
    54     #region events
    55    
    56   //  #region Event Handlers (Content)
    57     protected override void OnContentChanged() {
    58       base.OnContentChanged();
    59       if (Content == null) {
    60         // TODO: Add code when content has been changed and is null
    61       } else {
    62         // TODO: Add code when content has been changed and is not null
    63         CalculateAdjacencyMatrix();
    64       }
    65     }
    66     #endregion
    67 
    68     protected override void SetEnabledStateOfControls() {
    69       base.SetEnabledStateOfControls();
    70       // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
    71     }
    72 
    73     #region Event Handlers (child controls)
    74     // TODO: Put event handlers of child controls here.
    75     #endregion
    76 
    77     private void CalculateAdjacencyMatrix()
    78     {
    79         var runCollection = Content;
    80         var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
    81 
    82         var allVariableImpacts = runCollection.Select(run => (DoubleMatrix)run.Results[variableImpactResultName]);
    83         var variableNames = (from variableImpact in allVariableImpacts
    84                              from variableName in variableImpact.RowNames
    85                              select variableName).Distinct().ToArray();
    86         var adjMatrix = new DoubleMatrix(variableNames.Length, variableNames.Length);
    87 
    88         adjMatrix.RowNames = groupRunCollection.Select(x => x.Key);
    89         adjMatrix.ColumnNames = adjMatrix.RowNames;
    90 
    91         for (int j = 0; j < groupRunCollection.Count; ++j)
    92         {
    93             var g = groupRunCollection[j];
    94             var matrix = CalculateAdjacencyRows(g);
    95             var variables = new List<Tuple<string, double>>();
    96             var columnNames = matrix.ColumnNames.ToList();
    97            
    98             for (int i = 0; i < matrix.Columns; ++i)
    99             {
    100                 variables.Add(new Tuple<string, double>(columnNames[i], matrix[0, i]));
    101             }
    102             variables.Add(new Tuple<string, double>(g.Key, 0));
    103             variables.Sort((a, b) => a.Item1.CompareTo(b.Item1));
    104             for (int i = 0; i < variables.Count; ++i)
    105             {
    106                 adjMatrix[j, i] = variables[i].Item2;
    107             }
    108         }
    109         viewHost2.Content = CalculateNodeImportance(adjMatrix);
    110         viewHost3.Content = UpdateAdjacencyMatrixByThreshold(0.2, "x1", adjMatrix);
    111         viewHost1.Content = adjMatrix;
    112     }
    113 
    114     private DoubleMatrix CalculateAdjacencyRows(IEnumerable<IRun> runs)
    115     {
    116         IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
    117                                                       select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
    118         var variableNames = (from variableImpact in allVariableImpacts
    119                                            from variableName in variableImpact.RowNames
    120                                            select variableName)
    121                                           .Distinct().ToArray();
    122        
    123         List<string> variableNamesList = (from variableName in variableNames
    124                                           where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
    125                                           select variableName)
    126                                          .ToList();
    127    
    128         var runNames = runs.Select(x => x.Name).ToArray();
    129         var runsArray = runs.ToArray();
    130         DoubleMatrix varImpactMatrix = CalculateVariableImpactMatrix(runsArray, runNames);
    131         var targetMatrix = new DoubleMatrix(1, variableNames.Length);
    132 
    133         for (int i = 0; i < varImpactMatrix.Rows; ++i)
    134         {
    135             targetMatrix[0, i] = varImpactMatrix[i, runNames.Length];
    136         }
    137    
    138         targetMatrix.RowNames = new[] { "Target" };
    139         targetMatrix.ColumnNames = variableNames;
    140 
    141         return targetMatrix;
    142     }
    143 
    144     private DoubleMatrix UpdateAdjacencyMatrixByThreshold(double threshold, string targetVariable, DoubleMatrix adjMatrix)
    145     {
    146         var updatedMatrix = (DoubleMatrix) adjMatrix.Clone();
    147         var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
    148         string[] targets = adjMatrix.RowNames.ToArray();
    149         var targetIndex = Array.IndexOf(targets, targetVariable);
    150        
    151         for (int j = 0; j < groupRunCollection.Count; ++j)
    152         {
    153             if (updatedMatrix[targetIndex, j] < threshold)
    154             {
    155                 updatedMatrix[targetIndex, j] = 0;
    156             }         
    157         }
    158         return updatedMatrix;
    159     }
    160 
    161     private DoubleMatrix CalculateNodeImportance(DoubleMatrix adjMatrix)
    162     {
    163            DoubleMatrix nodeImportance = new DoubleMatrix(adjMatrix.Rows, 1);
    164            var variables = new List<Tuple<string, double>>();
    165            var rowNames = adjMatrix.RowNames.ToList();
    166            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
    167            double[] meanQuality = new double[groupRunCollection.Count];
    168 
    169            for (int j = 0; j < groupRunCollection.Count; ++j)
    170            {
    171                var g = groupRunCollection[j];
    172                meanQuality[j] = g.Average(x => ((IRegressionSolution)x.Results[TrainingBestSolutionParameterName]).TrainingRSquared);
    173            }
    174 
    175            for (int i = 0; i < adjMatrix.Columns; ++i)
    176            {
    177                for (int j = 0; j < adjMatrix.Rows; ++j)
    178                {
    179                    nodeImportance[i, 0] += adjMatrix[j, i];
    180                }
    181                nodeImportance[i, 0] = nodeImportance[i, 0] * meanQuality[i] / (adjMatrix.Rows - 1);
    182                variables.Add(new Tuple<string, double>(rowNames[i], nodeImportance[i, 0]));
    183            }
    184            
    185            variables.Sort((b,a) => a.Item2.CompareTo(b.Item2));
    186 
    187            for (int i = 0; i < nodeImportance.Rows; ++i)
    188            {
    189                nodeImportance[i, 0] = variables[i].Item2;
    190                rowNames[i] = variables[i].Item1;
    191            }
    192 
    193            nodeImportance.RowNames = rowNames;
    194            nodeImportance.ColumnNames = new[] { "Node Importance" };
    195            return nodeImportance;   
    196     }
    197 
    198     //adapted from RunCollectionVariableImpactView
    199     private DoubleMatrix CalculateVariableImpactMatrix(IRun[] runs, string[] runNames)
    200     {
    201         IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
    202                                                         select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
    203         IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts
    204                                              from variableName in variableImpact.RowNames
    205                                              select variableName).Distinct();
    206 
    207         // filter variableNames: only include names that have at least one non-zero value in a run
    208         List<string> variableNamesList = (from variableName in variableNames
    209                                           where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
    210                                           select variableName).ToList();
    211 
    212         List<string> columnNames = new List<string>(runNames);
    213         columnNames.Add("Mean");
    214      
    215         int numberOfRuns = runs.Length;
    216 
    217         DoubleMatrix matrix = new DoubleMatrix(variableNamesList.Count, numberOfRuns + 1);
    218         matrix.SortableView = true;
    219         matrix.ColumnNames = columnNames;
    220 
    221         List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList
    222                                                       select GetVariableImpacts(variableName, allVariableImpacts).ToList()).ToList();
    223 
    224         for (int row = 0; row < variableImpactsOverRuns.Count; row++)
    225         {
    226             matrix[row, numberOfRuns] = Math.Round(variableImpactsOverRuns[row].Average(), 3);
    227         }
    228 
    229         // fill matrix with impacts from runs
    230         for (int i = 0; i < runs.Length; i++)
    231         {
    232             IRun run = runs[i];
    233             DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName];
    234             for (int j = 0; j < runVariableImpacts.Rows; j++)
    235             {
    236                 int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j));
    237                 if (rowIndex > -1)
    238                 {
    239                     matrix[rowIndex, i] = Math.Round(runVariableImpacts[j, 0], 3);
    240                 }
    241             }
    242         }
    243         return matrix;
    244     }
    245 
    246     //taken from RunCollectionVariableImpactView
    247     private IEnumerable<double> GetVariableImpacts(string variableName, IEnumerable<DoubleMatrix> allVariableImpacts)
    248     {
    249         foreach (DoubleMatrix runVariableImpacts in allVariableImpacts)
    250         {
    251             int row = 0;
    252             foreach (string rowName in runVariableImpacts.RowNames)
    253             {
    254                 if (rowName == variableName)
    255                     yield return runVariableImpacts[row, 0];
    256                 row++;
    257             }
    258         }
    259     }
    260   }
    261475}
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperiment.cs

    r12198 r12320  
    66using HeuristicLab.Optimizer;
    77
    8 namespace HeuristicLab.VariableInteractionNetworks {
    9   internal class CreateTargetVariationExperiment : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
    10     public override string Name {
    11       get { return "Create Target Variation &Experiment"; }
     8namespace HeuristicLab.VariableInteractionNetworks
     9{
     10    internal class CreateTargetVariationExperiment : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider
     11    {
     12        public override string Name
     13        {
     14            get { return "Create Target Variation &Experiment"; }
     15        }
     16        public override IEnumerable<string> Structure
     17        {
     18            get { return new string[] { "&Edit" }; }
     19        }
     20        public override int Position
     21        {
     22            get { return 2300; }
     23        }
     24        public override string ToolTipText
     25        {
     26            get { return "Create an experiment for varying the target variable"; }
     27        }
     28
     29        protected override void OnToolStripItemSet(EventArgs e)
     30        {
     31            ToolStripItem.Enabled = false;
     32        }
     33        protected override void OnActiveViewChanged(object sender, EventArgs e)
     34        {
     35            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
     36            ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
     37        }
     38
     39        public override void Execute()
     40        {
     41            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
     42            if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
     43            {
     44                using (CreateTargetVariationExperimentDialog dialog = new CreateTargetVariationExperimentDialog((IAlgorithm)activeView.Content))
     45                {
     46                    if (dialog.ShowDialog() == DialogResult.OK) MainFormManager.MainForm.ShowContent(dialog.Experiment);
     47                }
     48            }
     49        }
    1250    }
    13     public override IEnumerable<string> Structure {
    14       get { return new string[] { "&Edit" }; }
    15     }
    16     public override int Position {
    17       get { return 2300; }
    18     }
    19     public override string ToolTipText {
    20       get { return "Create an experiment for varying the target variable"; }
    21     }
    22 
    23     protected override void OnToolStripItemSet(EventArgs e) {
    24       ToolStripItem.Enabled = false;
    25     }
    26     protected override void OnActiveViewChanged(object sender, EventArgs e) {
    27       IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    28       ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
    29     }
    30 
    31     public override void Execute() {
    32       IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
    33       if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
    34       {
    35           var experiment = TargetVariation.CreateVariableCombinations((IAlgorithm) activeView.Content);
    36           MainFormManager.MainForm.ShowContent(experiment);
    37       }
    38     }
    39   }
    4051}
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/HeuristicLab.VariableInteractionNetworks-3.3.csproj

    r12198 r12320  
    5656      <SpecificVersion>False</SpecificVersion>
    5757      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     58      <Private>False</Private>
     59    </Reference>
     60    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     61      <SpecificVersion>False</SpecificVersion>
     62      <HintPath>..\..\..\..\trunk\sources\HeuristicLab.Data.Views\3.3\obj\Release\HeuristicLab.Data.Views-3.3.dll</HintPath>
    5863      <Private>False</Private>
    5964    </Reference>
     
    138143  <ItemGroup>
    139144    <Compile Include="CreateTargetVariationExperiment.cs" />
     145    <Compile Include="CreateTargetVariationExperimentDialog.cs">
     146      <SubType>Form</SubType>
     147    </Compile>
     148    <Compile Include="CreateTargetVariationExperimentDialog.Designer.cs">
     149      <DependentUpon>CreateTargetVariationExperimentDialog.cs</DependentUpon>
     150    </Compile>
    140151    <Compile Include="Plugin.cs" />
    141152    <Compile Include="Properties\AssemblyInfo.cs" />
    142     <Compile Include="TargetVariation.cs" />
    143153  </ItemGroup>
    144154  <ItemGroup>
     
    146156    <None Include="Plugin.cs.frame" />
    147157    <None Include="Properties\AssemblyInfo.cs.frame" />
     158  </ItemGroup>
     159  <ItemGroup>
     160    <WCFMetadata Include="Service References\" />
    148161  </ItemGroup>
    149162  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Note: See TracChangeset for help on using the changeset viewer.