Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs	(revision 13787)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs	(revision 13788)
@@ -29,85 +29,138 @@
         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) 
+      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();
+      this.binomialCoeffNumericUpDown = new System.Windows.Forms.NumericUpDown();
+      this.label1 = new System.Windows.Forms.Label();
+      this.label2 = new System.Windows.Forms.Label();
+      ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit();
+      ((System.ComponentModel.ISupportInitialize)(this.binomialCoeffNumericUpDown)).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[] {
+      this.repetitionsNumericUpDown.Location = new System.Drawing.Point(128, 12);
+      this.repetitionsNumericUpDown.Maximum = new decimal(new int[] {
             1000000,
             0,
             0,
             0});
-            this.repetitionsNumericUpDown.Minimum = new decimal(new int[] {
+      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[] {
+      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();
+      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, 130);
+      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, 130);
+      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);
+      // 
+      // binomialCoeffNumericUpDown
+      // 
+      this.binomialCoeffNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.binomialCoeffNumericUpDown.Location = new System.Drawing.Point(128, 38);
+      this.binomialCoeffNumericUpDown.Maximum = new decimal(new int[] {
+            1000000,
+            0,
+            0,
+            0});
+      this.binomialCoeffNumericUpDown.Minimum = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+      this.binomialCoeffNumericUpDown.Name = "binomialCoeffNumericUpDown";
+      this.binomialCoeffNumericUpDown.Size = new System.Drawing.Size(185, 20);
+      this.binomialCoeffNumericUpDown.TabIndex = 4;
+      this.binomialCoeffNumericUpDown.ThousandsSeparator = true;
+      this.binomialCoeffNumericUpDown.Value = new decimal(new int[] {
+            10,
+            0,
+            0,
+            0});
+      this.binomialCoeffNumericUpDown.Validated += new System.EventHandler(this.binomialCoefficientNumericUpDown_Validated);
+      // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Location = new System.Drawing.Point(26, 40);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(79, 13);
+      this.label1.TabIndex = 5;
+      this.label1.Text = "&Binomial coeff.:";
+      // 
+      // label2
+      // 
+      this.label2.ForeColor = System.Drawing.Color.Red;
+      this.label2.Location = new System.Drawing.Point(26, 67);
+      this.label2.Name = "label2";
+      this.label2.Size = new System.Drawing.Size(287, 50);
+      this.label2.TabIndex = 5;
+      this.label2.Text = "Warning: depending on the binomial coefficient and the number of variables, this " +
+    "can create very large experiments. ";
+      // 
+      // 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, 165);
+      this.Controls.Add(this.okButton);
+      this.Controls.Add(this.cancelButton);
+      this.Controls.Add(this.label2);
+      this.Controls.Add(this.label1);
+      this.Controls.Add(this.repetitionsLabel);
+      this.Controls.Add(this.binomialCoeffNumericUpDown);
+      this.Controls.Add(this.repetitionsNumericUpDown);
+      this.Name = "CreateTargetVariationExperimentDialog";
+      this.Text = "Create Target Variation Experiment";
+      ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit();
+      ((System.ComponentModel.ISupportInitialize)(this.binomialCoeffNumericUpDown)).EndInit();
+      this.ResumeLayout(false);
+      this.PerformLayout();
 
         }
@@ -119,4 +172,7 @@
         private System.Windows.Forms.Button cancelButton;
         private System.Windows.Forms.Button okButton;
-    }
+    private System.Windows.Forms.NumericUpDown binomialCoeffNumericUpDown;
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.Label label2;
+  }
 }
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs	(revision 13787)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs	(revision 13788)
@@ -21,4 +21,5 @@
 
 using System;
+using System.Collections.Generic;
 using System.Linq;
 using System.Windows.Forms;
@@ -31,4 +32,5 @@
     public Experiment Experiment { get; private set; }
     private int repetitions;
+    private int binomialCoefficient;
 
     public CreateTargetVariationExperimentDialog() : this(null) { }
@@ -47,4 +49,10 @@
     }
 
+    private void binomialCoefficientNumericUpDown_Validated(object sender, EventArgs e) {
+      if (binomialCoeffNumericUpDown.Text == string.Empty)
+        binomialCoeffNumericUpDown.Text = binomialCoeffNumericUpDown.Value.ToString();
+      binomialCoefficient = (int)binomialCoeffNumericUpDown.Value;
+    }
+
     public Experiment CreateVariableCombinations(IAlgorithm algorithm) {
       var experiment = new Experiment("Target Variation Experiment");
@@ -61,21 +69,26 @@
 
       for (int i = 0; i < variables.Count; i++) {
-        var alg = (IAlgorithm)algorithm.Clone();
-        var pd = ((IRegressionProblem)alg.Problem).ProblemData;
+        var target = variables[i];
+        var inputs = variables.Where(x => x != target).ToList();
+        var combinations = Util.Combinations(inputs, binomialCoefficient);
 
-        for (int j = 0; j < variables.Count; ++j)
-          pd.InputVariables.SetItemCheckedState(pd.InputVariables[j], true);
+        foreach (var combination in combinations) {
+          var h = new HashSet<string>(combination);
+          var alg = (IAlgorithm)algorithm.Clone();
+          var pd = ((IRegressionProblem)alg.Problem).ProblemData;
+          pd.TargetVariable = target;
+          alg.Name += "{Target = " + target + ", Inputs = (" + combination.Aggregate((a, b) => a + "," + b) + ")}";
 
-        pd.InputVariables.SetItemCheckedState(pd.InputVariables[i], false);
-        pd.TargetVariable = pd.InputVariables[i].Value;
+          foreach (var item in pd.InputVariables) {
+            pd.InputVariables.SetItemCheckedState(item, h.Contains(item.Value));
+          }
 
-        alg.Name += "{Target = " + pd.TargetVariable + "}";
+          var batchrun = new BatchRun(string.Format("Batchrun {0}", i + 1)) {
+            Repetitions = repetitions,
+            Optimizer = alg
+          };
 
-        var batchrun = new BatchRun(string.Format("Batchrun {0}", i + 1)) {
-          Repetitions = repetitions,
-          Optimizer = alg
-        };
-
-        experiment.Optimizers.Add(batchrun);
+          experiment.Optimizers.Add(batchrun);
+        }
       }
       return experiment;
Index: /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/TinySet.cs
===================================================================
--- /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/TinySet.cs	(revision 13788)
+++ /branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/TinySet.cs	(revision 13788)
@@ -0,0 +1,107 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace HeuristicLab.VariableInteractionNetworks {
+  internal static class Util {
+    public static IEnumerable<IEnumerable<T>> Combinations<T>(IList<T> items, int k) {
+      if (k < 0)
+        throw new InvalidOperationException();
+      if (items == null)
+        throw new ArgumentNullException("items");
+      int n = items.Count;
+      if (n > TinySet.Maximum)
+        throw new InvalidOperationException();
+      return
+        from combination in Combinations(n, k)
+        select (from index in combination select items[index]);
+    }
+
+    // Takes integers n and k, both non-negative.
+    // Produces all sets of exactly k elements consisting only of 
+    // integers from 0 through n - 1.
+    private static IEnumerable<TinySet> Combinations(int n, int k) {
+      // Base case: if k is zero then there can be only one set
+      // regardless of the value of n: the empty set is the only set
+      // with zero elements.
+      if (k == 0) {
+        yield return TinySet.Empty;
+        yield break;
+      }
+
+      // Base case: if n < k then there can be no set of exactly
+      // k elements containing values from 0 to n - 1, because sets
+      // do not contain repeated elements.
+
+      if (n < k)
+        yield break;
+
+      // A set containing k elements where each is an integer from
+      // 0 to n - 2 is also a set of k elements where each is an
+      // integer from 0 to n - 1, so yield all of those.
+
+      foreach (var r in Combinations(n - 1, k))
+        yield return r;
+
+      // If we add n - 1 to all the sets of k - 1 elements where each
+      // is an integer from 0 to n - 2, then we get a set of k elements
+      // where each is an integer from 0 to n - 1.
+
+      foreach (var r in Combinations(n - 1, k - 1))
+        yield return r.Add(n - 1);
+    }
+  }
+
+  internal struct TinySet : IEnumerable<int> {
+    public static readonly TinySet Empty = new TinySet(0);
+    public const int Minimum = 0;
+    public const int Maximum = 31;
+    private readonly int bits;
+    private TinySet(int bits) { this.bits = bits; }
+    public bool Contains(int item) {
+      if (item < Minimum || item > Maximum)
+        return false;
+      return (bits & (1 << item)) != 0;
+    }
+    public TinySet Add(int item) {
+      if (item < Minimum || item > Maximum)
+        throw new InvalidOperationException();
+      return new TinySet(bits | (1 << item));
+    }
+    public TinySet Remove(int item) {
+      if (item < Minimum || item > Maximum)
+        return this;
+      return new TinySet(bits & ~(1 << item));
+    }
+    IEnumerator IEnumerable.GetEnumerator() {
+      return this.GetEnumerator();
+    }
+    public IEnumerator<int> GetEnumerator() {
+      for (int item = Minimum; item <= Maximum; ++item)
+        if (Contains(item))
+          yield return item;
+    }
+  }
+}
