Index: /trunk/sources/HeuristicLab.Modeling/3.2/AnalyzerModel.cs
===================================================================
--- /trunk/sources/HeuristicLab.Modeling/3.2/AnalyzerModel.cs	(revision 2420)
+++ /trunk/sources/HeuristicLab.Modeling/3.2/AnalyzerModel.cs	(revision 2421)
@@ -112,5 +112,7 @@
 
     public IEnumerable<KeyValuePair<ModelingResult, double>> GetVariableResults(string variableName) {
-      return variableResults[variableName];
+      if (variableResults.ContainsKey(variableName))
+        return variableResults[variableName];
+      else return new KeyValuePair<ModelingResult, double>[] { };
     }
 
Index: /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj
===================================================================
--- /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj	(revision 2420)
+++ /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj	(revision 2421)
@@ -112,4 +112,8 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Common\3.2\HeuristicLab.Common-3.2.csproj">
+      <Project>{1FC004FC-59AF-4249-B1B6-FF25873A20E4}</Project>
+      <Name>HeuristicLab.Common-3.2</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.Core\3.2\HeuristicLab.Core-3.2.csproj">
       <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
Index: /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/Predictor.cs
===================================================================
--- /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/Predictor.cs	(revision 2420)
+++ /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/Predictor.cs	(revision 2421)
@@ -39,5 +39,5 @@
     }
 
-    private Dictionary<string, int> variableNames = new Dictionary<string, int>();
+    private List<string> variableNames;
     private string targetVariable;
     private int minTimeOffset;
@@ -52,13 +52,13 @@
     public Predictor() : base() { } // for persistence
 
-    public Predictor(SVMModel model, string targetVariable, Dictionary<string, int> variableNames) :
+    public Predictor(SVMModel model, string targetVariable, IEnumerable<string> variableNames) :
       this(model, targetVariable, variableNames, 0, 0) {
     }
 
-    public Predictor(SVMModel model, string targetVariable, Dictionary<string, int> variableNames, int minTimeOffset, int maxTimeOffset)
+    public Predictor(SVMModel model, string targetVariable, IEnumerable<string> variableNames, int minTimeOffset, int maxTimeOffset)
       : base() {
       this.svmModel = model;
       this.targetVariable = targetVariable;
-      this.variableNames = variableNames;
+      this.variableNames = new List<string>(variableNames);
       this.minTimeOffset = minTimeOffset;
       this.maxTimeOffset = maxTimeOffset;
@@ -70,12 +70,6 @@
       RangeTransform transform = svmModel.RangeTransform;
       Model model = svmModel.Model;
-      // maps columns of the current input dataset to the columns that were originally used in training
-      Dictionary<int, int> newIndex = new Dictionary<int, int>();
-      foreach (var pair in variableNames) {
-        newIndex[input.GetVariableIndex(pair.Key)] = pair.Value;
-      }
 
-
-      Problem p = SVMHelper.CreateSVMProblem(input, input.GetVariableIndex(targetVariable), newIndex,
+      Problem p = SVMHelper.CreateSVMProblem(input, input.GetVariableIndex(targetVariable), variableNames,
         start, end, minTimeOffset, maxTimeOffset);
       Problem scaledProblem = transform.Scale(p);
@@ -88,6 +82,10 @@
         if (double.IsNaN(input.GetValue(resultRow, targetVariableIndex)))
           result[resultRow] = UpperPredictionLimit;
-        else
+        else if (resultRow + maxTimeOffset < 0) {
+          result[resultRow] = UpperPredictionLimit;
+          problemRow++;
+        } else {
           result[resultRow] = Math.Max(Math.Min(SVM.Prediction.Predict(model, scaledProblem.X[problemRow++]), UpperPredictionLimit), LowerPredictionLimit);
+        }
       }
       return result;
@@ -95,8 +93,5 @@
 
     public override IEnumerable<string> GetInputVariables() {
-      return from pair in variableNames
-             where pair.Key != targetVariable
-             orderby pair.Value
-             select pair.Key;
+      return variableNames;
     }
 
@@ -109,5 +104,5 @@
       clone.svmModel = (SVMModel)Auxiliary.Clone(svmModel, clonedObjects);
       clone.targetVariable = targetVariable;
-      clone.variableNames = new Dictionary<string, int>(variableNames);
+      clone.variableNames = new List<string>(variableNames);
       clone.minTimeOffset = minTimeOffset;
       clone.maxTimeOffset = maxTimeOffset;
@@ -128,13 +123,10 @@
       node.AppendChild(PersistenceManager.Persist(svmModel, document, persistedObjects));
       XmlNode variablesNode = document.CreateElement("Variables");
-      foreach (var pair in variableNames) {
-        XmlNode pairNode = document.CreateElement("Variable");
+      foreach (var variableName in variableNames) {
+        XmlNode variableNameNode = document.CreateElement("Variable");
         XmlAttribute nameAttr = document.CreateAttribute("Name");
-        XmlAttribute indexAttr = document.CreateAttribute("Index");
-        nameAttr.Value = pair.Key;
-        indexAttr.Value = XmlConvert.ToString(pair.Value);
-        pairNode.Attributes.Append(nameAttr);
-        pairNode.Attributes.Append(indexAttr);
-        variablesNode.AppendChild(pairNode);
+        nameAttr.Value = variableName;
+        variableNameNode.Attributes.Append(nameAttr);
+        variablesNode.AppendChild(variableNameNode);
       }
       node.AppendChild(variablesNode);
@@ -149,8 +141,8 @@
       if (node.Attributes["MinTimeOffset"] != null) minTimeOffset = XmlConvert.ToInt32(node.Attributes["MinTimeOffset"].Value);
       if (node.Attributes["MaxTimeOffset"] != null) maxTimeOffset = XmlConvert.ToInt32(node.Attributes["MaxTimeOffset"].Value);
-      variableNames = new Dictionary<string, int>();
+      variableNames = new List<string>();
       XmlNode variablesNode = node.ChildNodes[1];
-      foreach (XmlNode pairNode in variablesNode.ChildNodes) {
-        variableNames[pairNode.Attributes["Name"].Value] = XmlConvert.ToInt32(pairNode.Attributes["Index"].Value);
+      foreach (XmlNode variableNameNode in variablesNode.ChildNodes) {
+        variableNames.Add(variableNameNode.Attributes["Name"].Value);
       }
     }
@@ -190,7 +182,6 @@
       p.maxTimeOffset = int.Parse(maxTimeOffsetLine[1]);
       p.minTimeOffset = int.Parse(minTimeOffsetLine[1]);
-      int i = 1;
       foreach (string inputVariable in inputVariableLine.Skip(1)) {
-        p.variableNames[inputVariable.Trim()] = i++;
+        p.variableNames.Add(inputVariable.Trim());
       }
       p.svmModel = SVMModel.Import(reader);
Index: /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs
===================================================================
--- /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs	(revision 2420)
+++ /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs	(revision 2421)
@@ -36,5 +36,5 @@
       AddVariableInfo(new VariableInfo("SVMModel", "The SVM model", typeof(SVMModel), VariableKind.In));
       AddVariableInfo(new VariableInfo("TargetVariable", "The target variable", typeof(StringData), VariableKind.In));
-      AddVariableInfo(new VariableInfo("InputVariables", "The input variable names", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("InputVariables", "The input variable names", typeof(ItemList), VariableKind.In));
       AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of the training set", typeof(IntData), VariableKind.In));
       AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of the training set", typeof(IntData), VariableKind.In));
@@ -63,11 +63,11 @@
       string targetVariableName = ds.GetVariableName(targetVariable);
       ItemList inputVariables = GetVariableValue<ItemList>("InputVariables", scope, true);
-      Dictionary<string, int> variableNames = new Dictionary<string, int>();
-      for (int i = 0; i < ds.Columns; i++) variableNames[ds.GetVariableName(i)] = i;
+      var inputVariableNames = from x in inputVariables
+                               select ((StringData)x).Data;
 
       double mean = ds.GetMean(targetVariable, start, end);
       double range = ds.GetRange(targetVariable, start, end);
 
-      Predictor predictor = new Predictor(model, targetVariableName, variableNames, minTimeOffset, maxTimeOffset);
+      Predictor predictor = new Predictor(model, targetVariableName, inputVariableNames, minTimeOffset, maxTimeOffset);
       predictor.LowerPredictionLimit = mean - punishmentFactor * range;
       predictor.UpperPredictionLimit = mean + punishmentFactor * range;
Index: /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SVMHelper.cs
===================================================================
--- /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SVMHelper.cs	(revision 2420)
+++ /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SVMHelper.cs	(revision 2421)
@@ -6,51 +6,42 @@
 using HeuristicLab.Data;
 using HeuristicLab.DataAnalysis;
+using HeuristicLab.Common;
 
 namespace HeuristicLab.SupportVectorMachines {
   public class SVMHelper {
+    public static SVM.Problem CreateSVMProblem(Dataset dataset, int targetVariableIndex, IEnumerable<string> inputVariables, int start, int end, int minTimeOffset, int maxTimeOffset) {
+      int rowCount = end - start;
 
-    public static SVM.Problem CreateSVMProblem(Dataset dataset, int targetVariable, int start, int end, int minTimeOffset, int maxTimeOffset) {
-      return CreateSVMProblem(dataset, targetVariable, Enumerable.Range(0, dataset.Columns).ToDictionary<int, int>(x => x), start, end, minTimeOffset, maxTimeOffset);
-    }
+      var targetVector = (from row in Enumerable.Range(start, rowCount)
+                          let val = dataset.GetValue(row, targetVariableIndex)
+                          where !double.IsNaN(val)
+                          select val).ToArray();
 
-    public static SVM.Problem CreateSVMProblem(Dataset dataset, int targetVariable, Dictionary<int, int> columnMapping, int start, int end, int minTimeOffset, int maxTimeOffset) {
-      int rowCount = end - start;
-      List<int> skippedFeatures = new List<int>();
-      for (int i = 0; i < dataset.Columns; i++) {
-        if (i != targetVariable) {
-          if (dataset.GetRange(i, start, end) == 0)
-            skippedFeatures.Add(i);
-        }
-      }
-
-      int maxColumns = 0;
-
-      double[] targetVector = new double[rowCount];
-      for (int i = 0; i < rowCount; i++) {
-        double value = dataset.GetValue(start + i, targetVariable);
-        targetVector[i] = value;
-      }
-      targetVector = targetVector.Where(x => !double.IsNaN(x)).ToArray();
 
       SVM.Node[][] nodes = new SVM.Node[targetVector.Length][];
       List<SVM.Node> tempRow;
       int addedRows = 0;
-      int timeOffsetBase = columnMapping.Count;
+      int maxColumns = 0;
       for (int row = 0; row < rowCount; row++) {
         tempRow = new List<SVM.Node>();
-        for (int col = 0; col < dataset.Columns; col++) {
-          if (!skippedFeatures.Contains(col) && col != targetVariable && columnMapping.ContainsKey(col)) {
+        int nodeIndex = 0;
+        foreach (var inputVariable in inputVariables) {
+          ++nodeIndex;
+          int col = dataset.GetVariableIndex(inputVariable);
+          if (IsUsefulColumn(dataset, col, start, end)) {
             for (int timeOffset = minTimeOffset; timeOffset <= maxTimeOffset; timeOffset++) {
-              int actualColumn = columnMapping[col] * (maxTimeOffset - minTimeOffset + 1) + (timeOffset - minTimeOffset);
-              double value = dataset.GetValue(start + row + timeOffset, col);
-              if (!double.IsNaN(value)) {
-                tempRow.Add(new SVM.Node(actualColumn, value));
-                if (actualColumn > maxColumns) maxColumns = actualColumn;
+              int actualColumn = nodeIndex * (maxTimeOffset - minTimeOffset + 1) + (timeOffset - minTimeOffset);
+              if (start + row + timeOffset >= 0 && start + row + timeOffset < dataset.Rows) {
+                double value = dataset.GetValue(start + row + timeOffset, col);
+                if (!double.IsNaN(value)) {
+                  tempRow.Add(new SVM.Node(actualColumn, value));
+                  if (actualColumn > maxColumns) maxColumns = actualColumn;
+                }
               }
             }
           }
         }
-        if (!double.IsNaN(dataset.GetValue(start + row, targetVariable))) {
-          nodes[addedRows] = tempRow.OrderBy(x => x.Index).ToArray();
+        if (!double.IsNaN(dataset.GetValue(start + row, targetVariableIndex))) {
+          nodes[addedRows] = tempRow.ToArray();
           addedRows++;
         }
@@ -59,4 +50,19 @@
       return new SVM.Problem(targetVector.Length, targetVector, nodes, maxColumns);
     }
+
+    // checks if the column has at least two different non-NaN and non-Infinity values
+    private static bool IsUsefulColumn(Dataset dataset, int col, int start, int end) {
+      double min = double.PositiveInfinity;
+      double max = double.NegativeInfinity;
+      for (int i = start; i < end; i++) {
+        double x = dataset.GetValue(i, col);
+        if (!double.IsNaN(x) && !double.IsInfinity(x)) {
+          min = Math.Min(min, x);
+          max = Math.Max(max, x);
+        }
+        if (min != max) return true;
+      }
+      return false;
+    }
   }
 }
Index: /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorCreator.cs
===================================================================
--- /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorCreator.cs	(revision 2420)
+++ /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorCreator.cs	(revision 2421)
@@ -41,4 +41,5 @@
       AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In));
       AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("InputVariables", "List of allowed input variable names", typeof(ItemList), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesEnd", "End index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
@@ -70,4 +71,7 @@
       Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
       int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
+      ItemList inputVaribales = GetVariableValue<ItemList>("InputVariables", scope, true);
+      var inputVariableNames = from x in inputVaribales
+                               select ((StringData)x).Data;
       int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data;
       int end = GetVariableValue<IntData>("SamplesEnd", scope, true).Data;
@@ -89,5 +93,5 @@
       parameter.Probability = false;
 
-      SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, targetVariable, start, end, minTimeOffset, maxTimeOffset);
+      SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, targetVariable, inputVariableNames, start, end, minTimeOffset, maxTimeOffset);
       SVM.RangeTransform rangeTransform = SVM.RangeTransform.Compute(problem);
       SVM.Problem scaledProblem = rangeTransform.Scale(problem);
Index: /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs	(revision 2420)
+++ /trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs	(revision 2421)
@@ -37,4 +37,5 @@
       AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In));
       AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("InputVariables", "List of allowed input variable names", typeof(ItemList), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesEnd", "End index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
@@ -48,4 +49,7 @@
     public override IOperation Apply(IScope scope) {
       Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
+      ItemList inputVariables = GetVariableValue<ItemList>("InputVariables", scope, true);
+      var inputVariableNames = from x in inputVariables
+                               select ((StringData)x).Data;
       int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
       int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data;
@@ -56,5 +60,6 @@
       int maxTimeOffset = maxTimeOffsetData == null ? 0 : maxTimeOffsetData.Data;
       SVMModel modelData = GetVariableValue<SVMModel>("SVMModel", scope, true);
-      SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, targetVariable, start, end, minTimeOffset, maxTimeOffset);
+
+      SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, targetVariable, inputVariableNames, start, end, minTimeOffset, maxTimeOffset);
       SVM.Problem scaledProblem = modelData.RangeTransform.Scale(problem);
 
