Index: trunk/sources/HeuristicLab.Modeling/3.2/DefaultModelAnalyzerOperators.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/DefaultModelAnalyzerOperators.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/DefaultModelAnalyzerOperators.cs	(revision 2440)
@@ -58,5 +58,5 @@
       Dataset ds = modelScope.GetVariableValue<Dataset>("Dataset", true);
       model.Dataset = ds;
-      model.TargetVariable = ds.GetVariableName(modelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
+      model.TargetVariable = modelScope.GetVariableValue<StringData>("TargetVariable", true).Data;
       model.Type = ModelType.Regression;
       model.TrainingSamplesStart = modelScope.GetVariableValue<IntData>("TrainingSamplesStart", true).Data;
Index: trunk/sources/HeuristicLab.Modeling/3.2/IAlgorithm.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/IAlgorithm.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/IAlgorithm.cs	(revision 2440)
@@ -32,5 +32,5 @@
 
     Dataset Dataset { get; set; }
-    IEnumerable<int> AllowedVariables { get; set; }
+    IEnumerable<string> AllowedVariables { get; set; }
     int TrainingSamplesStart { get; set; }
     int TrainingSamplesEnd { get; set; }
@@ -39,5 +39,5 @@
     int TestSamplesStart { get; set; }
     int TestSamplesEnd { get; set; }
-    int TargetVariable { get; set; }
+    string TargetVariable { get; set; }
     IEngine Engine { get; }
     IAnalyzerModel Model { get; }
Index: trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjector.cs	(revision 2440)
@@ -41,11 +41,11 @@
       AddVariable(new Variable("Dataset", new Dataset()));
 
-      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(IntData), VariableKind.New));
+      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(StringData), VariableKind.New));
       GetVariableInfo("TargetVariable").Local = true;
-      AddVariable(new Variable("TargetVariable", new IntData()));
+      AddVariable(new Variable("TargetVariable", new StringData()));
 
-      AddVariableInfo(new VariableInfo("AllowedFeatures", "Indexes of allowed input variables", typeof(ItemList<IntData>), VariableKind.New));
+      AddVariableInfo(new VariableInfo("AllowedFeatures", "Indexes of allowed input variables", typeof(ItemList<StringData>), VariableKind.In));
       GetVariableInfo("AllowedFeatures").Local = true;
-      AddVariable(new Variable("AllowedFeatures", new ItemList<IntData>()));
+      AddVariable(new Variable("AllowedFeatures", new ItemList<StringData>()));
 
       AddVariableInfo(new VariableInfo("TrainingSamplesStart", "TrainingSamplesStart", typeof(IntData), VariableKind.New));
@@ -94,6 +94,6 @@
 
       Dataset operatorDataset = (Dataset)GetVariable("Dataset").Value;
-      int targetVariable = ((IntData)GetVariable("TargetVariable").Value).Data;
-      ItemList<IntData> operatorAllowedFeatures = (ItemList<IntData>)GetVariable("AllowedFeatures").Value;
+      string targetVariable = ((StringData)GetVariable("TargetVariable").Value).Data;
+      ItemList<StringData> operatorAllowedFeatures = (ItemList<StringData>)GetVariable("AllowedFeatures").Value;
 
       Dataset scopeDataset = CreateNewDataset(operatorDataset, targetVariable, operatorAllowedFeatures);
@@ -104,5 +104,5 @@
 
       scope.AddVariable(new Variable(scope.TranslateName("Dataset"), scopeDataset));
-      scope.AddVariable(new Variable(scope.TranslateName("TargetVariable"), new IntData(0)));
+      scope.AddVariable(new Variable(scope.TranslateName("TargetVariable"), new StringData(targetVariable)));
       scope.AddVariable(new Variable(scope.TranslateName("NumberOfInputVariables"), new IntData(scopeDataset.Columns - 1)));
       scope.AddVariable(new Variable(scope.TranslateName("InputVariables"), inputVariables));
@@ -127,15 +127,17 @@
     }
 
-    private Dataset CreateNewDataset(Dataset operatorDataset, int targetVariable, ItemList<IntData> operatorAllowedFeatures) {
-      int columns = (operatorAllowedFeatures.Count() + 1);
-      double[] values = new double[operatorDataset.Rows * columns];
-
-      for (int i = 0; i < values.Length; i++) {
-        int row = i / columns;
-        int column = i % columns;
-        if (column == 0) {
-          values[i] = operatorDataset.GetValue(row, targetVariable);
-        } else {
-          values[i] = operatorDataset.GetValue(row, operatorAllowedFeatures[column-1].Data);
+    private Dataset CreateNewDataset(Dataset operatorDataset, string targetVariable, ItemList<StringData> operatorAllowedVariables) {
+      int columns = (operatorAllowedVariables.Count() + 1);
+      int rows = operatorDataset.Rows;
+      double[] values = new double[rows * columns];
+      int targetVariableIndex = operatorDataset.GetVariableIndex(targetVariable);
+      for (int row = 0; row < rows; row++) {
+        int column = 0;
+        values[row*columns + column] = operatorDataset.GetValue(row, targetVariableIndex); // set target variable value to column index 0
+        column++; // start input variables at column index 1
+        foreach (var inputVariable in operatorAllowedVariables) {
+          int variableColumnIndex = operatorDataset.GetVariableIndex(inputVariable.Data);
+          values[row * columns + column] = operatorDataset.GetValue(row, variableColumnIndex);
+          column++;
         }
       }
@@ -148,11 +150,12 @@
       double[] scalingFactor = new double[columns];
       double[] scalingOffset = new double[columns];
-      ds.SetVariableName(0, operatorDataset.GetVariableName(targetVariable));
-      scalingFactor[0] = operatorDataset.ScalingFactor[targetVariable];
-      scalingOffset[0] = operatorDataset.ScalingOffset[targetVariable];
+      ds.SetVariableName(0, targetVariable);
+      scalingFactor[0] = operatorDataset.ScalingFactor[targetVariableIndex];
+      scalingOffset[0] = operatorDataset.ScalingOffset[targetVariableIndex];
       for (int column = 1; column < columns; column++) {
-        ds.SetVariableName(column, operatorDataset.GetVariableName(operatorAllowedFeatures[column - 1].Data));
-        scalingFactor[column] = operatorDataset.ScalingFactor[operatorAllowedFeatures[column - 1].Data];
-        scalingOffset[column] = operatorDataset.ScalingOffset[operatorAllowedFeatures[column - 1].Data];
+        int variableColumnIndex = operatorDataset.GetVariableIndex(operatorAllowedVariables[column - 1].Data);
+        ds.SetVariableName(column, operatorAllowedVariables[column - 1].Data);
+        scalingFactor[column] = operatorDataset.ScalingFactor[variableColumnIndex];
+        scalingOffset[column] = operatorDataset.ScalingOffset[variableColumnIndex];
       }
       ds.ScalingOffset = scalingOffset;
Index: trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjectorView.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjectorView.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/ProblemInjectorView.cs	(revision 2440)
@@ -106,17 +106,19 @@
           TrySetVariable("TestSamplesStart", parser.TestSamplesStart);
           TrySetVariable("TestSamplesEnd", parser.TestSamplesEnd);
-          TrySetVariable("TargetVariable", parser.TargetVariable);
-
+          
           for (int i = 0; i < parser.VariableNames.Length; i++) {
             dataset.SetVariableName(i, parser.VariableNames[i]);
           }
 
+          ((StringData)(ProblemInjector.GetVariable("TargetVariable").Value)).Data = 
+            dataset.GetVariableName(parser.TargetVariable);
+
           IVariable var = ProblemInjector.GetVariable("AllowedFeatures");
           if (var != null) {
-            ItemList<IntData> allowedFeatures = (ItemList<IntData>)var.Value;
+            ItemList<StringData> allowedFeatures = (ItemList<StringData>)var.Value;
             allowedFeatures.Clear();
             List<int> nonInputVariables = parser.NonInputVariables;
             for (int i = 0; i < dataset.Columns; i++) {
-              if (!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i));
+              if (!nonInputVariables.Contains(i)) allowedFeatures.Add(new StringData(dataset.GetVariableName(i)));
             }
           }
Index: trunk/sources/HeuristicLab.Modeling/3.2/TargetClassesCalculator.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/TargetClassesCalculator.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/TargetClassesCalculator.cs	(revision 2440)
@@ -32,5 +32,5 @@
       : base() {
       AddVariableInfo(new VariableInfo("Dataset", "The dataset", typeof(Dataset), VariableKind.In));
-      AddVariableInfo(new VariableInfo("TargetVariable", "Index of the target variable", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("TargetVariable", "Name the target variable", typeof(StringData), VariableKind.In));
       AddVariableInfo(new VariableInfo("TargetClassValues", "The original class values of target variable (for instance negative=0 and positive=1).", typeof(ItemList<DoubleData>), VariableKind.New));
     }
@@ -38,5 +38,5 @@
     public override IOperation Apply(IScope scope) {
       Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
-      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
+      string targetVariable = GetVariableValue<StringData>("TargetVariable", scope, true).Data;
 
       ItemList<DoubleData> classes = new ItemList<DoubleData>();
Index: trunk/sources/HeuristicLab.Modeling/3.2/VariableEvaluationImpactCalculator.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/VariableEvaluationImpactCalculator.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/VariableEvaluationImpactCalculator.cs	(revision 2440)
@@ -37,5 +37,5 @@
       AddVariableInfo(new VariableInfo("Predictor", "The predictor used to evaluate the model", typeof(IPredictor), VariableKind.In));
       AddVariableInfo(new VariableInfo("Dataset", "Dataset", typeof(Dataset), VariableKind.In));
-      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(StringData), VariableKind.In));
       AddVariableInfo(new VariableInfo("InputVariableNames", "Names of used variables in the model (optional)", typeof(ItemList<StringData>), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesStart", "TrainingSamplesStart", typeof(IntData), VariableKind.In));
@@ -51,6 +51,6 @@
       IPredictor predictor = GetVariableValue<IPredictor>("Predictor", scope, true);
       Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
-      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
-      string targetVariableName = dataset.GetVariableName(targetVariable);
+      string targetVariableName = GetVariableValue<StringData>("TargetVariable", scope, true).Data;
+      int targetVariable = dataset.GetVariableIndex(targetVariableName);
       ItemList<StringData> inputVariableNames = GetVariableValue<ItemList<StringData>>("InputVariableNames", scope, true, false);
       int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data;
Index: trunk/sources/HeuristicLab.Modeling/3.2/VariableQualityImpactCalculator.cs
===================================================================
--- trunk/sources/HeuristicLab.Modeling/3.2/VariableQualityImpactCalculator.cs	(revision 2430)
+++ trunk/sources/HeuristicLab.Modeling/3.2/VariableQualityImpactCalculator.cs	(revision 2440)
@@ -36,5 +36,5 @@
       AddVariableInfo(new VariableInfo("Predictor", "The predictor used to evaluate the model", typeof(IPredictor), VariableKind.In));
       AddVariableInfo(new VariableInfo("Dataset", "Dataset", typeof(Dataset), VariableKind.In));
-      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("TargetVariable", "TargetVariable", typeof(StringData), VariableKind.In));
       AddVariableInfo(new VariableInfo("InputVariableNames", "Names of used variables in the model (optional)", typeof(ItemList<StringData>), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesStart", "SamplesStart", typeof(IntData), VariableKind.In));
@@ -50,6 +50,6 @@
       IPredictor predictor = GetVariableValue<IPredictor>("Predictor", scope, true);
       Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
-      int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
-      string targetVariableName = dataset.GetVariableName(targetVariable);
+      string targetVariableName = GetVariableValue<StringData>("TargetVariable", scope, true).Data;
+      int targetVariable = dataset.GetVariableIndex(targetVariableName);
       ItemList<StringData> inputVariableNames = GetVariableValue<ItemList<StringData>>("InputVariableNames", scope, true, false);
       int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data;
