Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/HeuristicLab.VariableInteractionNetworks.Views-3.3.csproj
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/HeuristicLab.VariableInteractionNetworks.Views-3.3.csproj	(revision 12319)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/HeuristicLab.VariableInteractionNetworks.Views-3.3.csproj	(revision 12320)
@@ -147,9 +147,4 @@
     <None Include="Plugin.cs.frame" />
   </ItemGroup>
-  <ItemGroup>
-    <EmbeddedResource Include="VariableInteractionNetworkView.resx">
-      <DependentUpon>VariableInteractionNetworkView.cs</DependentUpon>
-    </EmbeddedResource>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.Designer.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.Designer.cs	(revision 12319)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.Designer.cs	(revision 12320)
@@ -1,3 +1,5 @@
-﻿namespace HeuristicLab.VariableInteractionNetworks.Views
+﻿using System.Linq;
+
+namespace HeuristicLab.VariableInteractionNetworks.Views
 {
     partial class VariableInteractionNetworkView
@@ -21,4 +23,5 @@
         }
 
+
         #region Component Designer generated code
 
@@ -29,4 +32,5 @@
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
             this.viewHost1 = new HeuristicLab.MainForm.WindowsForms.ViewHost();
@@ -34,6 +38,28 @@
             this.groupBox2 = new System.Windows.Forms.GroupBox();
             this.viewHost3 = new HeuristicLab.MainForm.WindowsForms.ViewHost();
+            this.groupBox4 = new System.Windows.Forms.GroupBox();
+            this.textBox4 = new System.Windows.Forms.TextBox();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.selectTargetVariable = new System.Windows.Forms.Label();
+            this.targetVariablesCombo = new System.Windows.Forms.ComboBox();
+            this.selectedThreshold2 = new System.Windows.Forms.Label();
+            this.targetThreshold = new System.Windows.Forms.TextBox();
+            this.trackBar2 = new System.Windows.Forms.TrackBar();
+            this.groupBox3 = new System.Windows.Forms.GroupBox();
+            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            this.selectedThreshold1 = new System.Windows.Forms.Label();
+            this.genThreshold = new System.Windows.Forms.TextBox();
+            this.trackBar1 = new System.Windows.Forms.TrackBar();
+            this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+            this.errorProvider2 = new System.Windows.Forms.ErrorProvider(this.components);
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
+            this.groupBox4.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
+            this.groupBox3.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider2)).BeginInit();
             this.SuspendLayout();
             // 
@@ -42,7 +68,7 @@
             this.groupBox1.Controls.Add(this.viewHost1);
             this.groupBox1.Controls.Add(this.viewHost2);
-            this.groupBox1.Location = new System.Drawing.Point(0, 3);
+            this.groupBox1.Location = new System.Drawing.Point(6, 3);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(635, 228);
+            this.groupBox1.Size = new System.Drawing.Size(641, 276);
             this.groupBox1.TabIndex = 0;
             this.groupBox1.TabStop = false;
@@ -70,5 +96,5 @@
             this.viewHost2.Name = "viewHost2";
             this.viewHost2.ReadOnly = false;
-            this.viewHost2.Size = new System.Drawing.Size(210, 259);
+            this.viewHost2.Size = new System.Drawing.Size(218, 247);
             this.viewHost2.TabIndex = 0;
             this.viewHost2.ViewsLabelVisible = true;
@@ -77,11 +103,15 @@
             // groupBox2
             // 
+            this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
             this.groupBox2.Controls.Add(this.viewHost3);
-            this.groupBox2.Location = new System.Drawing.Point(6, 268);
+            this.groupBox2.Controls.Add(this.groupBox4);
+            this.groupBox2.Controls.Add(this.groupBox3);
+            this.groupBox2.Location = new System.Drawing.Point(6, 285);
             this.groupBox2.Name = "groupBox2";
-            this.groupBox2.Size = new System.Drawing.Size(629, 258);
+            this.groupBox2.Size = new System.Drawing.Size(641, 283);
             this.groupBox2.TabIndex = 1;
             this.groupBox2.TabStop = false;
-            this.groupBox2.Text = "Updated Adjacency Matrix (for target variable x1 and threshold 0.2)";
+            this.groupBox2.Text = "Updated Adjacency Matrix";
             // 
             // viewHost3
@@ -93,8 +123,168 @@
             this.viewHost3.Name = "viewHost3";
             this.viewHost3.ReadOnly = false;
-            this.viewHost3.Size = new System.Drawing.Size(367, 239);
+            this.viewHost3.Size = new System.Drawing.Size(354, 239);
             this.viewHost3.TabIndex = 0;
             this.viewHost3.ViewsLabelVisible = true;
             this.viewHost3.ViewType = null;
+            // 
+            // groupBox4
+            // 
+            this.groupBox4.Controls.Add(this.textBox4);
+            this.groupBox4.Controls.Add(this.textBox3);
+            this.groupBox4.Controls.Add(this.selectTargetVariable);
+            this.groupBox4.Controls.Add(this.targetVariablesCombo);
+            this.groupBox4.Controls.Add(this.selectedThreshold2);
+            this.groupBox4.Controls.Add(this.targetThreshold);
+            this.groupBox4.Controls.Add(this.trackBar2);
+            this.groupBox4.Location = new System.Drawing.Point(365, 148);
+            this.groupBox4.Name = "groupBox4";
+            this.groupBox4.Size = new System.Drawing.Size(255, 123);
+            this.groupBox4.TabIndex = 13;
+            this.groupBox4.TabStop = false;
+            this.groupBox4.Text = "Apply Edge Weights Threshold for a Chosen Target Variable";
+            // 
+            // textBox4
+            // 
+            this.textBox4.BackColor = System.Drawing.SystemColors.Control;
+            this.textBox4.Location = new System.Drawing.Point(217, 60);
+            this.textBox4.Name = "textBox4";
+            this.textBox4.ReadOnly = true;
+            this.textBox4.Size = new System.Drawing.Size(32, 20);
+            this.textBox4.TabIndex = 14;
+            // 
+            // textBox3
+            // 
+            this.textBox3.BackColor = System.Drawing.SystemColors.Control;
+            this.textBox3.Location = new System.Drawing.Point(6, 60);
+            this.textBox3.Name = "textBox3";
+            this.textBox3.ReadOnly = true;
+            this.textBox3.Size = new System.Drawing.Size(33, 20);
+            this.textBox3.TabIndex = 14;
+            // 
+            // selectTargetVariable
+            // 
+            this.selectTargetVariable.AutoSize = true;
+            this.selectTargetVariable.Location = new System.Drawing.Point(31, 36);
+            this.selectTargetVariable.Name = "selectTargetVariable";
+            this.selectTargetVariable.Size = new System.Drawing.Size(112, 13);
+            this.selectTargetVariable.TabIndex = 8;
+            this.selectTargetVariable.Text = "Select Target Variable";
+            // 
+            // targetVariablesCombo
+            // 
+            this.targetVariablesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.targetVariablesCombo.FormattingEnabled = true;
+            this.targetVariablesCombo.Location = new System.Drawing.Point(159, 33);
+            this.targetVariablesCombo.Name = "targetVariablesCombo";
+            this.targetVariablesCombo.Size = new System.Drawing.Size(61, 21);
+            this.targetVariablesCombo.TabIndex = 1;
+            this.targetVariablesCombo.DropDown += new System.EventHandler(this.targetVariablesCombo_Dropdown);
+            this.targetVariablesCombo.SelectedIndexChanged += new System.EventHandler(this.targetVariablesCombo_SelectedIndexChanged);
+            // 
+            // selectedThreshold2
+            // 
+            this.selectedThreshold2.AutoSize = true;
+            this.selectedThreshold2.Location = new System.Drawing.Point(31, 93);
+            this.selectedThreshold2.Name = "selectedThreshold2";
+            this.selectedThreshold2.Size = new System.Drawing.Size(93, 13);
+            this.selectedThreshold2.TabIndex = 7;
+            this.selectedThreshold2.Text = "Select Threshold: ";
+            // 
+            // targetThreshold
+            // 
+            this.targetThreshold.Location = new System.Drawing.Point(132, 90);
+            this.targetThreshold.Name = "targetThreshold";
+            this.targetThreshold.Size = new System.Drawing.Size(48, 20);
+            this.targetThreshold.TabIndex = 6;
+            this.targetThreshold.Text = "0";
+            this.targetThreshold.TextChanged += new System.EventHandler(this.targetThreshold_TextChanged);
+            this.targetThreshold.KeyDown += new System.Windows.Forms.KeyEventHandler(this.targetThreshold_KeyDown);
+            // 
+            // trackBar2
+            // 
+            this.trackBar2.BackColor = System.Drawing.SystemColors.Control;
+            this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.trackBar2.LargeChange = 4;
+            this.trackBar2.Location = new System.Drawing.Point(34, 60);
+            this.trackBar2.Name = "trackBar2";
+            this.trackBar2.Size = new System.Drawing.Size(186, 45);
+            this.trackBar2.TabIndex = 3;
+            this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
+            this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged);
+            this.trackBar2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar2_MouseDown);
+            // 
+            // groupBox3
+            // 
+            this.groupBox3.Controls.Add(this.textBox2);
+            this.groupBox3.Controls.Add(this.textBox1);
+            this.groupBox3.Controls.Add(this.selectedThreshold1);
+            this.groupBox3.Controls.Add(this.genThreshold);
+            this.groupBox3.Controls.Add(this.trackBar1);
+            this.groupBox3.Location = new System.Drawing.Point(365, 19);
+            this.groupBox3.Name = "groupBox3";
+            this.groupBox3.Size = new System.Drawing.Size(255, 95);
+            this.groupBox3.TabIndex = 12;
+            this.groupBox3.TabStop = false;
+            this.groupBox3.Text = "Apply General Threshold for Edge Weights";
+            // 
+            // textBox2
+            // 
+            this.textBox2.BackColor = System.Drawing.SystemColors.Control;
+            this.textBox2.Location = new System.Drawing.Point(217, 24);
+            this.textBox2.Name = "textBox2";
+            this.textBox2.ReadOnly = true;
+            this.textBox2.Size = new System.Drawing.Size(32, 20);
+            this.textBox2.TabIndex = 13;
+            // 
+            // textBox1
+            // 
+            this.textBox1.BackColor = System.Drawing.SystemColors.Control;
+            this.textBox1.Location = new System.Drawing.Point(6, 24);
+            this.textBox1.Name = "textBox1";
+            this.textBox1.ReadOnly = true;
+            this.textBox1.Size = new System.Drawing.Size(33, 20);
+            this.textBox1.TabIndex = 12;
+            // 
+            // selectedThreshold1
+            // 
+            this.selectedThreshold1.AutoSize = true;
+            this.selectedThreshold1.Location = new System.Drawing.Point(31, 62);
+            this.selectedThreshold1.Name = "selectedThreshold1";
+            this.selectedThreshold1.Size = new System.Drawing.Size(93, 13);
+            this.selectedThreshold1.TabIndex = 10;
+            this.selectedThreshold1.Text = "Select Threshold: ";
+            // 
+            // genThreshold
+            // 
+            this.genThreshold.Location = new System.Drawing.Point(132, 59);
+            this.genThreshold.Name = "genThreshold";
+            this.genThreshold.Size = new System.Drawing.Size(48, 20);
+            this.genThreshold.TabIndex = 9;
+            this.genThreshold.Text = "0";
+            this.genThreshold.TextChanged += new System.EventHandler(this.genThreshold_TextChanged);
+            this.genThreshold.KeyDown += new System.Windows.Forms.KeyEventHandler(this.genThreshold_KeyDown);
+            // 
+            // trackBar1
+            // 
+            this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.trackBar1.LargeChange = 4;
+            this.trackBar1.Location = new System.Drawing.Point(34, 24);
+            this.trackBar1.Name = "trackBar1";
+            this.trackBar1.RightToLeft = System.Windows.Forms.RightToLeft.No;
+            this.trackBar1.Size = new System.Drawing.Size(186, 45);
+            this.trackBar1.TabIndex = 2;
+            this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
+            this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
+            this.trackBar1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBar1_MouseDown);
+            // 
+            // errorProvider
+            // 
+            this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
+            this.errorProvider.ContainerControl = this;
+            // 
+            // errorProvider2
+            // 
+            this.errorProvider2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
+            this.errorProvider2.ContainerControl = this;
             // 
             // VariableInteractionNetworkView
@@ -105,7 +295,15 @@
             this.Controls.Add(this.groupBox1);
             this.Name = "VariableInteractionNetworkView";
-            this.Size = new System.Drawing.Size(635, 513);
+            this.Size = new System.Drawing.Size(810, 599);
             this.groupBox1.ResumeLayout(false);
             this.groupBox2.ResumeLayout(false);
+            this.groupBox4.ResumeLayout(false);
+            this.groupBox4.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
+            this.groupBox3.ResumeLayout(false);
+            this.groupBox3.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.errorProvider2)).EndInit();
             this.ResumeLayout(false);
 
@@ -115,8 +313,24 @@
 
         private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.GroupBox groupBox3;
+        private System.Windows.Forms.GroupBox groupBox4;
         private MainForm.WindowsForms.ViewHost viewHost1;
         private MainForm.WindowsForms.ViewHost viewHost2;
-        private System.Windows.Forms.GroupBox groupBox2;
         private MainForm.WindowsForms.ViewHost viewHost3;
+        private System.Windows.Forms.TrackBar trackBar1;
+        private System.Windows.Forms.TrackBar trackBar2;
+        private System.Windows.Forms.ComboBox targetVariablesCombo;
+        private System.Windows.Forms.TextBox genThreshold;
+        private System.Windows.Forms.TextBox targetThreshold;
+        private System.Windows.Forms.Label selectedThreshold2;
+        private System.Windows.Forms.Label selectedThreshold1;
+        private System.Windows.Forms.Label selectTargetVariable;
+        private System.Windows.Forms.TextBox textBox2;
+        private System.Windows.Forms.TextBox textBox1;
+        private System.Windows.Forms.ErrorProvider errorProvider;
+        private System.Windows.Forms.TextBox textBox4;
+        private System.Windows.Forms.TextBox textBox3;
+        private System.Windows.Forms.ErrorProvider errorProvider2;
     }
 }
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.cs	(revision 12319)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/VariableInteractionNetworkView.cs	(revision 12320)
@@ -36,226 +36,440 @@
 using System.Collections;
 
-namespace HeuristicLab.VariableInteractionNetworks.Views {
-  [View("Variable Interaction Network")]
-  [Content(typeof(RunCollection), IsDefaultView = false)]
-
-  public sealed partial class VariableInteractionNetworkView : AsynchronousContentView {
-    private const string variableImpactResultName = "Variable impacts";
-    private const string TrainingBestSolutionParameterName = "Best training solution";
-    public new RunCollection Content {
-      get { return (RunCollection)base.Content; }
-      set { base.Content = value; }
+namespace HeuristicLab.VariableInteractionNetworks.Views
+{
+    [View("Variable Interaction Network")]
+    [Content(typeof(RunCollection), IsDefaultView = false)]
+
+    public sealed partial class VariableInteractionNetworkView : AsynchronousContentView
+    {
+        private const string variableImpactResultName = "Variable impacts";
+        private const string TrainingBestSolutionParameterName = "Best training solution";
+
+        public new RunCollection Content
+        {
+            get { return (RunCollection)base.Content; }
+            set { base.Content = value; }
+        }
+
+        public VariableInteractionNetworkView()
+        {
+            InitializeComponent();
+        }
+
+        internal class NoFocusTrackBar : System.Windows.Forms.TrackBar
+        {
+            [System.Runtime.InteropServices.DllImport("user32.dll")]
+            public extern static int SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
+
+            private static int MakeParam(int loWord, int hiWord)
+            {
+                return (hiWord << 16) | (loWord & 0xffff);
+            }
+
+            protected override void OnGotFocus(EventArgs e)
+            {
+                base.OnGotFocus(e);
+                SendMessage(this.Handle, 0x0128, MakeParam(1, 0x1), 0);
+            }
+        }
+
+        #region events
+
+        //  #region Event Handlers (Content)
+        protected override void OnContentChanged()
+        {
+            base.OnContentChanged();
+            if (Content == null)
+            {
+                // TODO: Add code when content has been changed and is null
+            }
+            else
+            {
+                // TODO: Add code when content has been changed and is not null
+                viewHost2.Content = CalculateNodeImportance(CalculateAdjacencyMatrix());     
+                var adjMatrix = CalculateAdjacencyMatrix();
+                viewHost1.Content = adjMatrix;
+                viewHost3.Content = (DoubleMatrix)adjMatrix.Clone();
+                trackBar1.Minimum = (int)(1000 * GetMinNonNullElement(adjMatrix));
+                trackBar1.Maximum = (int)(1000 * (adjMatrix.Max()));
+            }
+        }
+        #endregion
+
+        protected override void SetEnabledStateOfControls()
+        {
+            base.SetEnabledStateOfControls();
+            // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
+        }
+
+        #region Event Handlers (child controls)
+        // TODO: Put event handlers of child controls here.
+        #endregion
+
+        private DoubleMatrix CalculateAdjacencyMatrix()
+        {
+            var runCollection = Content;
+            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
+
+            var allVariableImpacts = runCollection.Select(run => (DoubleMatrix)run.Results[variableImpactResultName]);
+            var variableNames = (from variableImpact in allVariableImpacts
+                                 from variableName in variableImpact.RowNames
+                                 select variableName).Distinct().ToArray();
+            var adjMatrix = new DoubleMatrix(variableNames.Length, variableNames.Length);
+
+            adjMatrix.RowNames = groupRunCollection.Select(x => x.Key);
+            adjMatrix.ColumnNames = adjMatrix.RowNames;
+            for (int j = 0; j < groupRunCollection.Count; ++j)
+            {
+                var g = groupRunCollection[j];
+                var matrix = CalculateAdjacencyRows(g);
+                var variables = new List<Tuple<string, double>>();
+                var columnNames = matrix.ColumnNames.ToList();
+
+                for (int i = 0; i < matrix.Columns; ++i)
+                {
+                    variables.Add(new Tuple<string, double>(columnNames[i], matrix[0, i]));
+                }
+                variables.Add(new Tuple<string, double>(g.Key, 0));
+                variables.Sort((a, b) => a.Item1.CompareTo(b.Item1));
+                for (int i = 0; i < variables.Count; ++i)
+                {
+                    adjMatrix[j, i] = variables[i].Item2;
+
+                }
+            }
+            return adjMatrix;
+        }
+
+        private DoubleMatrix CalculateAdjacencyRows(IEnumerable<IRun> runs)
+        {
+            IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
+                                                            select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
+            var variableNames = (from variableImpact in allVariableImpacts
+                                 from variableName in variableImpact.RowNames
+                                 select variableName)
+                                              .Distinct().ToArray();
+
+            List<string> variableNamesList = (from variableName in variableNames
+                                              where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
+                                              select variableName)
+                                             .ToList();
+
+            var runNames = runs.Select(x => x.Name).ToArray();
+            var runsArray = runs.ToArray();
+            DoubleMatrix varImpactMatrix = CalculateVariableImpactMatrix(runsArray, runNames);
+            var targetMatrix = new DoubleMatrix(1, variableNames.Length);
+
+            for (int i = 0; i < varImpactMatrix.Rows; ++i)
+            {
+                targetMatrix[0, i] = varImpactMatrix[i, runNames.Length];
+            }
+
+            targetMatrix.RowNames = new[] { "Target" };
+            targetMatrix.ColumnNames = variableNames;
+
+            return targetMatrix;
+        }
+
+        private DoubleMatrix UpdateAdjacencyMatrixByThresholdAndTargetVariable(double threshold, string targetVariable, DoubleMatrix adjMatrix)
+        {
+            var originalMatrix = (DoubleMatrix)viewHost1.Content;
+            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
+            string[] targets = adjMatrix.RowNames.ToArray();
+            var targetIndex = Array.IndexOf(targets, targetVariable);
+
+            for (int j = 0; j < groupRunCollection.Count; ++j)
+            {
+                double originalValue = originalMatrix[targetIndex, j];
+                adjMatrix[targetIndex, j] = (originalValue <= Math.Max(threshold, Double.Parse(genThreshold.Text))) ? 0 : originalValue;
+            }
+            return adjMatrix;
+        }
+
+        private DoubleMatrix UpdateAdjacencyMatrixByThreshold(double threshold, DoubleMatrix adjMatrix)
+        {
+         //   var updatedMatrix = (DoubleMatrix) adjMatrix.Clone();
+            var originalMatrix = (DoubleMatrix)viewHost1.Content;
+            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
+
+            for (int i = 0; i < adjMatrix.Rows; ++i)
+            {
+                for (int j = 0; j < adjMatrix.Columns; ++j)
+                {
+                    double originalValue = originalMatrix[i, j];
+                    adjMatrix[i, j] = originalValue <= threshold ? 0 : originalValue;
+                }
+            }
+            return adjMatrix;
+        }
+
+        private double GetMinNonNullElement(DoubleMatrix adjMatrix)
+        {
+            double min = adjMatrix.Max();
+            for (int i = 0; i < adjMatrix.Rows; i++)
+            {
+                for (int j = 0; j < adjMatrix.Columns; j++)
+                {                  
+                    min = (min > adjMatrix[i, j] && adjMatrix[i, j] != 0) ? adjMatrix[i, j] : min;
+                }
+            }
+            return min;
+        }
+
+        private double GetMaxFromRow(int rowIndex, DoubleMatrix adjMatrix)
+        {
+            double max = adjMatrix.Min();
+            for (int j = 0; j < adjMatrix.Columns; ++j)
+            {
+                max = (max < adjMatrix[rowIndex, j] && adjMatrix[rowIndex, j] != 0) ? adjMatrix[rowIndex, j] : max;
+            }
+            return max;
+        }
+
+        private DoubleMatrix CalculateNodeImportance(DoubleMatrix adjMatrix)
+        {
+            DoubleMatrix nodeImportance = new DoubleMatrix(adjMatrix.Rows, 1);
+            var variables = new List<Tuple<string, double>>();
+            var rowNames = adjMatrix.RowNames.ToList();
+            var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
+            double[] meanQuality = new double[groupRunCollection.Count];
+
+            for (int j = 0; j < groupRunCollection.Count; ++j)
+            {
+                var g = groupRunCollection[j];
+                meanQuality[j] = g.Average(x => ((IRegressionSolution)x.Results[TrainingBestSolutionParameterName]).TrainingRSquared);
+            }
+
+            for (int i = 0; i < adjMatrix.Columns; ++i)
+            {
+                for (int j = 0; j < adjMatrix.Rows; ++j)
+                {
+                    nodeImportance[i, 0] += adjMatrix[j, i] * meanQuality[j];
+                }
+                nodeImportance[i, 0] /= (adjMatrix.Rows - 1);
+                variables.Add(new Tuple<string, double>(rowNames[i], nodeImportance[i, 0]));
+            }
+
+            variables.Sort((b, a) => a.Item2.CompareTo(b.Item2));
+
+            for (int i = 0; i < nodeImportance.Rows; ++i)
+            {
+                nodeImportance[i, 0] = variables[i].Item2;
+                rowNames[i] = variables[i].Item1;
+            }
+
+            nodeImportance.RowNames = rowNames;
+            nodeImportance.ColumnNames = new[] { "Node Importance" };
+            return nodeImportance;
+        }
+
+        //adapted from RunCollectionVariableImpactView
+        private DoubleMatrix CalculateVariableImpactMatrix(IRun[] runs, string[] runNames)
+        {
+            IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
+                                                            select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
+            IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts
+                                                 from variableName in variableImpact.RowNames
+                                                 select variableName).Distinct();
+
+            // filter variableNames: only include names that have at least one non-zero value in a run
+            List<string> variableNamesList = (from variableName in variableNames
+                                              where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
+                                              select variableName).ToList();
+
+            List<string> columnNames = new List<string>(runNames);
+            columnNames.Add("Mean");
+
+            int numberOfRuns = runs.Length;
+
+            DoubleMatrix matrix = new DoubleMatrix(variableNamesList.Count, numberOfRuns + 1);
+            matrix.SortableView = true;
+            matrix.ColumnNames = columnNames;
+
+            List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList
+                                                          select GetVariableImpacts(variableName, allVariableImpacts).ToList()).ToList();
+
+            for (int row = 0; row < variableImpactsOverRuns.Count; row++)
+            {
+                matrix[row, numberOfRuns] = Math.Round(variableImpactsOverRuns[row].Average(), 3);
+            }
+
+            // fill matrix with impacts from runs
+            for (int i = 0; i < runs.Length; i++)
+            {
+                IRun run = runs[i];
+                DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName];
+                for (int j = 0; j < runVariableImpacts.Rows; j++)
+                {
+                    int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j));
+                    if (rowIndex > -1)
+                    {
+                        matrix[rowIndex, i] = Math.Round(runVariableImpacts[j, 0], 3);
+                    }
+                }
+            }
+            return matrix;
+        }
+
+        //taken from RunCollectionVariableImpactView
+        private IEnumerable<double> GetVariableImpacts(string variableName, IEnumerable<DoubleMatrix> allVariableImpacts)
+        {
+            foreach (DoubleMatrix runVariableImpacts in allVariableImpacts)
+            {
+                int row = 0;
+                foreach (string rowName in runVariableImpacts.RowNames)
+                {
+                    if (rowName == variableName)
+                        yield return runVariableImpacts[row, 0];
+                    row++;
+                }
+            }
+        }
+
+        private void trackBar1_ValueChanged(object sender, EventArgs e)
+        {
+            genThreshold.Text = (0.001 * trackBar1.Value).ToString();
+            textBox1.Text = (0.001 * trackBar1.Minimum).ToString();
+            textBox2.Text = (0.001 * trackBar1.Maximum).ToString();
+            viewHost3.Content = UpdateAdjacencyMatrixByThreshold(0.001 * trackBar1.Value, (DoubleMatrix)viewHost3.Content);
+        }
+
+        private void mouseDownEvent(TrackBar tb, MouseEventArgs e)
+        {
+                double percentage = (double)e.X / (double)(tb.Width - 6);
+                double clickPos = percentage * (tb.Maximum - tb.Minimum);
+                try
+                {
+                    tb.Value = (int)clickPos + tb.Minimum;
+                }
+                catch
+                {
+                    MessageBox.Show("Value outside range!");
+                    return;
+                }
+        }
+
+        private void trackBar1_MouseDown(object sender, MouseEventArgs e)
+        {
+            mouseDownEvent(trackBar1, e);
+        }
+
+        private void trackBar2_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (targetVariablesCombo.SelectedIndex < 0)
+            {
+                return;
+            }
+            else
+            {
+                mouseDownEvent(trackBar2, e);
+            }
+        }
+
+        private void trackBar2_ValueChanged(object sender, EventArgs e)
+        {
+            targetThreshold.Text = (0.001 * trackBar2.Value).ToString();
+
+            if (targetVariablesCombo.SelectedIndex < 0)
+            {
+                MessageBox.Show("Please select target variable!");
+                return;
+            }
+            else
+            {
+                string selectedItem = (string)targetVariablesCombo.Items[targetVariablesCombo.SelectedIndex];
+                viewHost3.Content = UpdateAdjacencyMatrixByThresholdAndTargetVariable(0.001 * trackBar2.Value, selectedItem, (DoubleMatrix)viewHost3.Content);
+            }
+        }
+
+        private void genThresholdEvent()
+        {
+            this.errorProvider.SetError(genThreshold, "");
+
+            if (genThreshold.Text != "")
+            {
+                if (Double.Parse(genThreshold.Text) >= GetMinNonNullElement((DoubleMatrix)viewHost1.Content) && Double.Parse(genThreshold.Text) <= ((DoubleMatrix)viewHost1.Content).Max())
+                {
+                    genThreshold.Select(genThreshold.Text.Length, 0);
+                    trackBar1.Value = (int)(1000 * Double.Parse(genThreshold.Text));
+                    viewHost3.Content = UpdateAdjacencyMatrixByThreshold(Double.Parse(genThreshold.Text), (DoubleMatrix)viewHost3.Content);
+                }
+                else
+                {
+                    this.errorProvider.SetError(genThreshold, "Value out of range!");
+                }
+            }
+            else
+            {
+                MessageBox.Show("Please select a threshold!");
+                this.errorProvider.SetError(genThreshold, "");
+                return;
+            }
+        }
+
+        private void genThreshold_TextChanged(object sender, EventArgs e)
+        {
+            genThresholdEvent();
+        }
+
+        private void genThreshold_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+                genThresholdEvent();        
+        }
+
+        private void targetThresholdEvent()
+        {
+            this.errorProvider2.SetError(targetThreshold, "");
+
+            if (targetVariablesCombo.SelectedIndex < 0)
+            {
+                return;
+            }
+            else
+            {
+                string selectedItem = (string)targetVariablesCombo.Items[targetVariablesCombo.SelectedIndex];
+                if (Double.Parse(targetThreshold.Text) >= Double.Parse(textBox3.Text) && Double.Parse(targetThreshold.Text) <= Double.Parse(textBox4.Text))
+                {
+                    trackBar2.Value = (int)(1000 * Double.Parse(targetThreshold.Text));
+                }
+                else
+                {
+                    this.errorProvider2.SetError(targetThreshold, "Value out of range!");
+                    return;
+                }
+            }
+        }
+
+        private void targetThreshold_TextChanged(object sender, EventArgs e)
+        {
+            targetThresholdEvent();
+        }
+
+        private void targetThreshold_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                targetThresholdEvent();
+            }
+        }
+
+        private void targetVariablesCombo_Dropdown(object sender, System.EventArgs e)
+        {
+            targetVariablesCombo.Items.Clear();
+            string[] targetVariables = ((DoubleMatrix)viewHost3.Content).RowNames.ToArray();
+            targetVariablesCombo.Items.AddRange(targetVariables);
+        }
+
+        private void targetVariablesCombo_SelectedIndexChanged(object sender, System.EventArgs e)
+        {
+            var targetIndex = targetVariablesCombo.SelectedIndex;
+            string selectedItem = (string)targetVariablesCombo.Items[targetIndex];
+            trackBar2.Minimum = 0;
+            trackBar2.Maximum = (int)(1000 * GetMaxFromRow(targetIndex, (DoubleMatrix)viewHost1.Content));
+            textBox3.Text = trackBar2.Minimum.ToString();
+            textBox4.Text = (0.001 * trackBar2.Maximum).ToString();
+            UpdateAdjacencyMatrixByThresholdAndTargetVariable(0.001 * trackBar2.Value, selectedItem, (DoubleMatrix)viewHost3.Content);
+        }
     }
-
-    public VariableInteractionNetworkView() {
-      InitializeComponent();
-    }
-
-    #region events
-    
-  //  #region Event Handlers (Content)
-    protected override void OnContentChanged() {
-      base.OnContentChanged();
-      if (Content == null) {
-        // TODO: Add code when content has been changed and is null
-      } else {
-        // TODO: Add code when content has been changed and is not null
-        CalculateAdjacencyMatrix();
-      }
-    }
-    #endregion
-
-    protected override void SetEnabledStateOfControls() {
-      base.SetEnabledStateOfControls();
-      // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
-    }
-
-    #region Event Handlers (child controls)
-    // TODO: Put event handlers of child controls here.
-    #endregion
-
-    private void CalculateAdjacencyMatrix()
-    {
-        var runCollection = Content;
-        var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
-
-        var allVariableImpacts = runCollection.Select(run => (DoubleMatrix)run.Results[variableImpactResultName]);
-        var variableNames = (from variableImpact in allVariableImpacts
-                             from variableName in variableImpact.RowNames
-                             select variableName).Distinct().ToArray();
-        var adjMatrix = new DoubleMatrix(variableNames.Length, variableNames.Length);
-
-        adjMatrix.RowNames = groupRunCollection.Select(x => x.Key); 
-        adjMatrix.ColumnNames = adjMatrix.RowNames;
-
-        for (int j = 0; j < groupRunCollection.Count; ++j) 
-        {
-            var g = groupRunCollection[j];
-            var matrix = CalculateAdjacencyRows(g);
-            var variables = new List<Tuple<string, double>>();
-            var columnNames = matrix.ColumnNames.ToList();
-            
-            for (int i = 0; i < matrix.Columns; ++i)
-            {
-                variables.Add(new Tuple<string, double>(columnNames[i], matrix[0, i]));
-            }
-            variables.Add(new Tuple<string, double>(g.Key, 0));
-            variables.Sort((a, b) => a.Item1.CompareTo(b.Item1));
-            for (int i = 0; i < variables.Count; ++i)
-            {
-                adjMatrix[j, i] = variables[i].Item2;
-            }
-        }
-        viewHost2.Content = CalculateNodeImportance(adjMatrix);
-        viewHost3.Content = UpdateAdjacencyMatrixByThreshold(0.2, "x1", adjMatrix);
-        viewHost1.Content = adjMatrix;
-    }
-
-    private DoubleMatrix CalculateAdjacencyRows(IEnumerable<IRun> runs)
-    {
-        IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
-                                                      select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
-        var variableNames = (from variableImpact in allVariableImpacts
-                                           from variableName in variableImpact.RowNames
-                                           select variableName)
-                                          .Distinct().ToArray();
-       
-        List<string> variableNamesList = (from variableName in variableNames
-                                          where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
-                                          select variableName)
-                                         .ToList();
-   
-        var runNames = runs.Select(x => x.Name).ToArray();
-        var runsArray = runs.ToArray();
-        DoubleMatrix varImpactMatrix = CalculateVariableImpactMatrix(runsArray, runNames);
-        var targetMatrix = new DoubleMatrix(1, variableNames.Length);
-
-        for (int i = 0; i < varImpactMatrix.Rows; ++i)
-        {
-            targetMatrix[0, i] = varImpactMatrix[i, runNames.Length];
-        }
-   
-        targetMatrix.RowNames = new[] { "Target" };
-        targetMatrix.ColumnNames = variableNames;
-
-        return targetMatrix;
-    }
-
-    private DoubleMatrix UpdateAdjacencyMatrixByThreshold(double threshold, string targetVariable, DoubleMatrix adjMatrix)
-    {
-        var updatedMatrix = (DoubleMatrix) adjMatrix.Clone();
-        var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
-        string[] targets = adjMatrix.RowNames.ToArray();
-        var targetIndex = Array.IndexOf(targets, targetVariable);
-        
-        for (int j = 0; j < groupRunCollection.Count; ++j)
-        {
-            if (updatedMatrix[targetIndex, j] < threshold)
-            {
-                updatedMatrix[targetIndex, j] = 0;
-            }          
-        }
-        return updatedMatrix;
-    }
-
-    private DoubleMatrix CalculateNodeImportance(DoubleMatrix adjMatrix)
-    {
-           DoubleMatrix nodeImportance = new DoubleMatrix(adjMatrix.Rows, 1);
-           var variables = new List<Tuple<string, double>>();
-           var rowNames = adjMatrix.RowNames.ToList();
-           var groupRunCollection = Content.GroupBy(x => ((IRegressionProblemData)x.Parameters["ProblemData"]).TargetVariable).ToList();
-           double[] meanQuality = new double[groupRunCollection.Count];
-
-           for (int j = 0; j < groupRunCollection.Count; ++j)
-           {
-               var g = groupRunCollection[j];
-               meanQuality[j] = g.Average(x => ((IRegressionSolution)x.Results[TrainingBestSolutionParameterName]).TrainingRSquared);
-           }
-
-           for (int i = 0; i < adjMatrix.Columns; ++i)
-           {
-               for (int j = 0; j < adjMatrix.Rows; ++j)
-               {
-                   nodeImportance[i, 0] += adjMatrix[j, i];
-               }
-               nodeImportance[i, 0] = nodeImportance[i, 0] * meanQuality[i] / (adjMatrix.Rows - 1);
-               variables.Add(new Tuple<string, double>(rowNames[i], nodeImportance[i, 0]));
-           }
-           
-           variables.Sort((b,a) => a.Item2.CompareTo(b.Item2));
-
-           for (int i = 0; i < nodeImportance.Rows; ++i)
-           {
-               nodeImportance[i, 0] = variables[i].Item2;
-               rowNames[i] = variables[i].Item1;
-           }
-
-           nodeImportance.RowNames = rowNames;
-           nodeImportance.ColumnNames = new[] { "Node Importance" };
-           return nodeImportance;    
-    }
-
-    //adapted from RunCollectionVariableImpactView
-    private DoubleMatrix CalculateVariableImpactMatrix(IRun[] runs, string[] runNames)
-    {
-        IEnumerable<DoubleMatrix> allVariableImpacts = (from run in runs
-                                                        select run.Results[variableImpactResultName]).Cast<DoubleMatrix>();
-        IEnumerable<string> variableNames = (from variableImpact in allVariableImpacts
-                                             from variableName in variableImpact.RowNames
-                                             select variableName).Distinct();
-
-        // filter variableNames: only include names that have at least one non-zero value in a run
-        List<string> variableNamesList = (from variableName in variableNames
-                                          where GetVariableImpacts(variableName, allVariableImpacts).Any(x => !x.IsAlmost(0.0))
-                                          select variableName).ToList();
-
-        List<string> columnNames = new List<string>(runNames);
-        columnNames.Add("Mean");
-      
-        int numberOfRuns = runs.Length;
-
-        DoubleMatrix matrix = new DoubleMatrix(variableNamesList.Count, numberOfRuns + 1);
-        matrix.SortableView = true;
-        matrix.ColumnNames = columnNames;
-
-        List<List<double>> variableImpactsOverRuns = (from variableName in variableNamesList
-                                                      select GetVariableImpacts(variableName, allVariableImpacts).ToList()).ToList();
-
-        for (int row = 0; row < variableImpactsOverRuns.Count; row++)
-        {
-            matrix[row, numberOfRuns] = Math.Round(variableImpactsOverRuns[row].Average(), 3);
-        }
-
-        // fill matrix with impacts from runs
-        for (int i = 0; i < runs.Length; i++)
-        {
-            IRun run = runs[i];
-            DoubleMatrix runVariableImpacts = (DoubleMatrix)run.Results[variableImpactResultName];
-            for (int j = 0; j < runVariableImpacts.Rows; j++)
-            {
-                int rowIndex = variableNamesList.FindIndex(s => s == runVariableImpacts.RowNames.ElementAt(j));
-                if (rowIndex > -1)
-                {
-                    matrix[rowIndex, i] = Math.Round(runVariableImpacts[j, 0], 3);
-                }
-            }
-        }
-        return matrix;
-    }
-
-    //taken from RunCollectionVariableImpactView
-    private IEnumerable<double> GetVariableImpacts(string variableName, IEnumerable<DoubleMatrix> allVariableImpacts)
-    {
-        foreach (DoubleMatrix runVariableImpacts in allVariableImpacts)
-        {
-            int row = 0;
-            foreach (string rowName in runVariableImpacts.RowNames)
-            {
-                if (rowName == variableName)
-                    yield return runVariableImpacts[row, 0];
-                row++;
-            }
-        }
-    }
-  }
 }
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperiment.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperiment.cs	(revision 12319)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperiment.cs	(revision 12320)
@@ -6,35 +6,46 @@
 using HeuristicLab.Optimizer;
 
-namespace HeuristicLab.VariableInteractionNetworks {
-  internal class CreateTargetVariationExperiment : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider {
-    public override string Name {
-      get { return "Create Target Variation &Experiment"; }
+namespace HeuristicLab.VariableInteractionNetworks
+{
+    internal class CreateTargetVariationExperiment : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider
+    {
+        public override string Name
+        {
+            get { return "Create Target Variation &Experiment"; }
+        }
+        public override IEnumerable<string> Structure
+        {
+            get { return new string[] { "&Edit" }; }
+        }
+        public override int Position
+        {
+            get { return 2300; }
+        }
+        public override string ToolTipText
+        {
+            get { return "Create an experiment for varying the target variable"; }
+        }
+
+        protected override void OnToolStripItemSet(EventArgs e)
+        {
+            ToolStripItem.Enabled = false;
+        }
+        protected override void OnActiveViewChanged(object sender, EventArgs e)
+        {
+            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+            ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
+        }
+
+        public override void Execute()
+        {
+            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+            if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
+            {
+                using (CreateTargetVariationExperimentDialog dialog = new CreateTargetVariationExperimentDialog((IAlgorithm)activeView.Content))
+                {
+                    if (dialog.ShowDialog() == DialogResult.OK) MainFormManager.MainForm.ShowContent(dialog.Experiment);
+                }
+            }
+        }
     }
-    public override IEnumerable<string> Structure {
-      get { return new string[] { "&Edit" }; }
-    }
-    public override int Position {
-      get { return 2300; }
-    }
-    public override string ToolTipText {
-      get { return "Create an experiment for varying the target variable"; }
-    }
-
-    protected override void OnToolStripItemSet(EventArgs e) {
-      ToolStripItem.Enabled = false;
-    }
-    protected override void OnActiveViewChanged(object sender, EventArgs e) {
-      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
-      ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
-    }
-
-    public override void Execute() {
-      IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
-      if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
-      {
-          var experiment = TargetVariation.CreateVariableCombinations((IAlgorithm) activeView.Content);
-          MainFormManager.MainForm.ShowContent(experiment);
-      }
-    }
-  }
 }
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs	(revision 12320)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs	(revision 12320)
@@ -0,0 +1,122 @@
+﻿namespace HeuristicLab.VariableInteractionNetworks
+{
+    partial class CreateTargetVariationExperimentDialog
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown();
+            this.repetitionsLabel = new System.Windows.Forms.Label();
+            this.cancelButton = new System.Windows.Forms.Button();
+            this.okButton = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // repetitionsNumericUpDown
+            // 
+            this.repetitionsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.repetitionsNumericUpDown.Location = new System.Drawing.Point(108, 12);
+            this.repetitionsNumericUpDown.Maximum = new decimal(new int[] {
+            1000000,
+            0,
+            0,
+            0});
+            this.repetitionsNumericUpDown.Minimum = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            this.repetitionsNumericUpDown.Name = "repetitionsNumericUpDown";
+            this.repetitionsNumericUpDown.Size = new System.Drawing.Size(185, 20);
+            this.repetitionsNumericUpDown.TabIndex = 4;
+            this.repetitionsNumericUpDown.ThousandsSeparator = true;
+            this.repetitionsNumericUpDown.Value = new decimal(new int[] {
+            10,
+            0,
+            0,
+            0});
+            this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated);
+            // 
+            // repetitionsLabel
+            // 
+            this.repetitionsLabel.AutoSize = true;
+            this.repetitionsLabel.Location = new System.Drawing.Point(26, 14);
+            this.repetitionsLabel.Name = "repetitionsLabel";
+            this.repetitionsLabel.Size = new System.Drawing.Size(63, 13);
+            this.repetitionsLabel.TabIndex = 5;
+            this.repetitionsLabel.Text = "&Repetitions:";
+            // 
+            // cancelButton
+            // 
+            this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.cancelButton.Location = new System.Drawing.Point(177, 48);
+            this.cancelButton.Name = "cancelButton";
+            this.cancelButton.Size = new System.Drawing.Size(75, 23);
+            this.cancelButton.TabIndex = 9;
+            this.cancelButton.Text = "&Cancel";
+            this.cancelButton.UseVisualStyleBackColor = true;
+            // 
+            // okButton
+            // 
+            this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+            this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+            this.okButton.Location = new System.Drawing.Point(80, 48);
+            this.okButton.Name = "okButton";
+            this.okButton.Size = new System.Drawing.Size(75, 23);
+            this.okButton.TabIndex = 10;
+            this.okButton.Text = "&Ok";
+            this.okButton.UseVisualStyleBackColor = true;
+            this.okButton.Click += new System.EventHandler(this.okButton_Click);
+            // 
+            // CreateTargetVariationExperimentDialog
+            // 
+            this.AcceptButton = this.okButton;
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.CancelButton = this.cancelButton;
+            this.ClientSize = new System.Drawing.Size(349, 83);
+            this.Controls.Add(this.okButton);
+            this.Controls.Add(this.cancelButton);
+            this.Controls.Add(this.repetitionsLabel);
+            this.Controls.Add(this.repetitionsNumericUpDown);
+            this.Name = "CreateTargetVariationExperimentDialog";
+            this.Text = "Create Target Variation Experiment";
+            ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit();
+            this.ResumeLayout(false);
+            this.PerformLayout();
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.NumericUpDown repetitionsNumericUpDown;
+        private System.Windows.Forms.Label repetitionsLabel;
+        private System.Windows.Forms.Button cancelButton;
+        private System.Windows.Forms.Button okButton;
+    }
+}
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs	(revision 12320)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs	(revision 12320)
@@ -0,0 +1,94 @@
+﻿using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Problems.Instances;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.DataAnalysis.Symbolic;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
+using HeuristicLab.Optimizer;
+using HeuristicLab.MainForm;
+
+namespace HeuristicLab.VariableInteractionNetworks
+{
+    public partial class CreateTargetVariationExperimentDialog : Form
+    {
+        public Experiment Experiment { get; private set; }
+        private int repetitions;
+
+
+        public CreateTargetVariationExperimentDialog() : this(null) { }
+        public CreateTargetVariationExperimentDialog(IAlgorithm alg)
+        {
+            InitializeComponent();
+            repetitions = (int)repetitionsNumericUpDown.Value;
+
+            Experiment = null;
+            okButton.Enabled = alg != null;
+        }
+
+        private void repetitionsNumericUpDown_Validated(object sender, EventArgs e)
+        {
+            if (repetitionsNumericUpDown.Text == string.Empty)
+                repetitionsNumericUpDown.Text = repetitionsNumericUpDown.Value.ToString();
+            repetitions = (int)repetitionsNumericUpDown.Value;
+        }
+
+        public Experiment CreateVariableCombinations(IAlgorithm algorithm)
+        {
+            var experiment = new Experiment("Target Variation Experiment");
+
+            if (algorithm == null)
+                throw new InvalidOperationException("Null algorithm!");
+
+            var problem = algorithm.Problem;
+            var regressionProblem = problem as IRegressionProblem;
+            if (regressionProblem == null)
+                throw new Exception();
+
+            var problemData = regressionProblem.ProblemData;
+            var variables = problemData.InputVariables.ToList();
+
+            for (int i = 0; i < variables.Count; i++)
+            {
+                var alg = (IAlgorithm)algorithm.Clone();
+                var pd = ((IRegressionProblem)alg.Problem).ProblemData;
+
+                // set target to false
+                pd.InputVariables.SetItemCheckedState(pd.InputVariables[i], false);
+
+                pd.TargetVariable = pd.InputVariables[i].Value;
+                alg.Name += "{Target variable=" + pd.TargetVariable + "}";
+
+                var batchrun = new BatchRun("Batchrun" + i)
+                {
+                    Repetitions = repetitions,
+                    Optimizer = alg
+                };
+
+                experiment.Optimizers.Add(batchrun);
+            }
+            return experiment;
+        }
+
+        private void okButton_Click(object sender, EventArgs e)
+        {
+            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;
+            if ((activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked)
+            {
+                Experiment = CreateVariableCombinations((IAlgorithm)activeView.Content);
+                DialogResult = System.Windows.Forms.DialogResult.OK;
+                Close();
+            }
+        }
+    }
+}
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/HeuristicLab.VariableInteractionNetworks-3.3.csproj
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/HeuristicLab.VariableInteractionNetworks-3.3.csproj	(revision 12319)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/HeuristicLab.VariableInteractionNetworks-3.3.csproj	(revision 12320)
@@ -56,4 +56,9 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\HeuristicLab.Data.Views\3.3\obj\Release\HeuristicLab.Data.Views-3.3.dll</HintPath>
       <Private>False</Private>
     </Reference>
@@ -138,7 +143,12 @@
   <ItemGroup>
     <Compile Include="CreateTargetVariationExperiment.cs" />
+    <Compile Include="CreateTargetVariationExperimentDialog.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="CreateTargetVariationExperimentDialog.Designer.cs">
+      <DependentUpon>CreateTargetVariationExperimentDialog.cs</DependentUpon>
+    </Compile>
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="TargetVariation.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -146,4 +156,7 @@
     <None Include="Plugin.cs.frame" />
     <None Include="Properties\AssemblyInfo.cs.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: anches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/TargetVariation.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/TargetVariation.cs	(revision 12319)
+++ 	(revision )
@@ -1,60 +1,0 @@
-﻿using System;
-using System.CodeDom;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using HeuristicLab.Data;
-using HeuristicLab.Optimization;
-using HeuristicLab.Persistence;
-using HeuristicLab.Persistence.Default.Xml;
-using HeuristicLab.Problems.DataAnalysis;
-using HeuristicLab.Problems.DataAnalysis.Symbolic;
-using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
-
-namespace HeuristicLab.VariableInteractionNetworks {
-    class TargetVariation
-    {
-        public static Experiment CreateVariableCombinations(IAlgorithm algorithm)
-        {
-            var experiment = new Experiment("Target Variation Experiment");
-
-            if (algorithm == null)
-                throw new InvalidOperationException("Null algorithm!");
-
-            var problem = algorithm.Problem;
-            var regressionProblem = problem as IRegressionProblem;
-            if (regressionProblem == null)
-                throw new Exception();
-
-            var problemData = regressionProblem.ProblemData;
-            var variables = problemData.InputVariables.ToList();
-
-            for (int i = 0; i < variables.Count; i++)
-            {
-                var alg = (IAlgorithm)algorithm.Clone();            
-                var pd = ((IRegressionProblem)alg.Problem).ProblemData;
-               
-                // check all input variables
-                foreach(var v in pd.InputVariables)
-                    pd.InputVariables.SetItemCheckedState(v, true);
-              
-                // set target to false
-                pd.InputVariables.SetItemCheckedState(pd.InputVariables[i], false);
-
-                pd.TargetVariable = pd.InputVariables[i].Value;
-                alg.Name += "{Target variable=" + pd.TargetVariable + "}";
-                 
-                var batchrun = new BatchRun("Batchrun" + i)
-                {
-                    Repetitions = 10,
-                    Optimizer = alg
-                };
-
-                experiment.Optimizers.Add(batchrun); 
-            }
-            return experiment;
-        }
-    }
-  }
