Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs	(revision 16652)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs	(revision 16653)
@@ -23,4 +23,5 @@
 using System.Collections.Generic;
 using System.Diagnostics;
+using System.Globalization;
 using System.Linq;
 using HeuristicLab.Analysis;
@@ -286,7 +287,12 @@
         }
         var adjustedEpisodes = episodes.Select(ep => new IntRange(ep.Start, ep.End - 1)); // because we lose the last row in the differencing step
+
+        // data for input variables is assumed to be known
+        // input variables in pretuning are all target variables and all variable names that occur in the tree
+        var inputVariables = targetVars.Concat(t.IterateNodesPrefix().OfType<VariableTreeNode>().Select(n => n.VariableName));
+
         var myState = new OptimizationData(new[] { t },
           targetVars,
-          problemData.AllowedInputVariables.Concat(targetVars).ToArray(),
+          inputVariables.ToArray(),
           problemData, new[] { targetValuesDiff.ToArray() }, adjustedEpisodes.ToArray(), -99, latentVariables, string.Empty); // TODO
         var paramCount = myState.nodeValueLookup.ParameterCount;
@@ -346,5 +352,9 @@
       }
 
-      var myState = new OptimizationData(trees, targetVars, problemData.AllowedInputVariables.ToArray(), problemData, targetValues, episodes.ToArray(), numericIntegrationSteps, latentVariables, odeSolver);
+      // data for input variables is assumed to be known
+      // input variables are all variable names that occur in the trees except for target variables (we assume that trees have been generated correctly)
+      var inputVariables = trees.SelectMany(t => t.IterateNodesPrefix().OfType<VariableTreeNode>().Select(n => n.VariableName)).Except(targetVars);
+
+      var myState = new OptimizationData(trees, targetVars, inputVariables.ToArray(), problemData, targetValues, episodes.ToArray(), numericIntegrationSteps, latentVariables, odeSolver);
       optTheta = initialTheta;
 
@@ -402,5 +412,10 @@
         // update variable values
         foreach (var variable in variables) {
-          nodeValueLookup.SetVariableValue(variable, ds.GetDoubleValue(variable, rows[trainIdx])); // TODO: perf
+          // in this problem we also allow fixed numeric parameters (represented as variables with the value as name)
+          if (double.TryParse(variable, NumberStyles.Float, CultureInfo.InvariantCulture, out double value)) {
+            nodeValueLookup.SetVariableValue(variable, value); // TODO: Perf we don't need to set this for each index
+          } else {
+            nodeValueLookup.SetVariableValue(variable, ds.GetDoubleValue(variable, rows[trainIdx])); // TODO: perf
+          }
         }
         // interpret all trees
@@ -431,5 +446,10 @@
         // update variable values
         foreach (var variable in variables) {
-          nodeValueLookup.SetVariableValue(variable, ds.GetDoubleValue(variable, rows[trainIdx])); // TODO: perf
+          // in this problem we also allow fixed numeric parameters (represented as variables with the value as name)
+          if (double.TryParse(variable, NumberStyles.Float, CultureInfo.InvariantCulture, out double value)) {
+            nodeValueLookup.SetVariableValue(variable, value); // TODO: Perf we don't need to set this for each index
+          } else {
+            nodeValueLookup.SetVariableValue(variable, ds.GetDoubleValue(variable, rows[trainIdx])); // TODO: perf
+          }
         }
 
@@ -561,5 +581,9 @@
         results["Models"].Value = models;
       } else {
-        var optimizationData = new OptimizationData(trees, targetVars, problemData.AllowedInputVariables.ToArray(), problemData, null, TrainingEpisodes.ToArray(), NumericIntegrationSteps, latentVariables, OdeSolver);
+        // data for input variables is assumed to be known
+        // input variables are all variable names that occur in the trees except for target variables (we assume that trees have been generated correctly)
+        var inputVariables = trees.SelectMany(t => t.IterateNodesPrefix().OfType<VariableTreeNode>().Select(n => n.VariableName)).Except(targetVars);
+
+        var optimizationData = new OptimizationData(trees, targetVars, inputVariables.ToArray(), problemData, null, TrainingEpisodes.ToArray(), NumericIntegrationSteps, latentVariables, OdeSolver);
         var trainingPrediction = Integrate(optimizationData).ToArray();
 
@@ -731,5 +755,5 @@
       var trees = optimizationData.trees;
       var dataset = optimizationData.problemData.Dataset;
-      var inputVariables = optimizationData.problemData.AllowedInputVariables.ToArray();
+      var inputVariables = optimizationData.variables;
       var targetVariables = optimizationData.targetVariables;
       var latentVariables = optimizationData.latentVariables;
@@ -753,6 +777,11 @@
         // initialize values for inputs and targets from dataset
         foreach (var varName in inputVariables) {
-          var y0 = dataset.GetDoubleValue(varName, t0);
-          nodeValues.SetVariableValue(varName, y0, Vector.Zero);
+          // in this problem we also allow fixed numeric parameters (represented as variables with the value as name)
+          if (double.TryParse(varName, NumberStyles.Float, CultureInfo.InvariantCulture, out double value)) {
+            nodeValues.SetVariableValue(varName, value, Vector.Zero);
+          } else {
+            var y0 = dataset.GetDoubleValue(varName, t0);
+            nodeValues.SetVariableValue(varName, y0, Vector.Zero);
+          }
         }
         foreach (var varName in targetVariables) {
@@ -815,5 +844,10 @@
           // update for next time step (only the inputs)
           foreach (var varName in inputVariables) {
-            nodeValues.SetVariableValue(varName, dataset.GetDoubleValue(varName, t), Vector.Zero);
+            // in this problem we also allow fixed numeric parameters (represented as variables with the value as name)
+            if (double.TryParse(varName, NumberStyles.Float, CultureInfo.InvariantCulture, out double value)) {
+              // value is unchanged
+            } else {
+              nodeValues.SetVariableValue(varName, dataset.GetDoubleValue(varName, t), Vector.Zero);
+            }
           }
         }
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Solution.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Solution.cs	(revision 16652)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Solution.cs	(revision 16653)
@@ -91,5 +91,8 @@
       // var random = new FastRandom(12345);
       // snmse = Problem.OptimizeForEpisodes(trees, problemData, targetVars, latentVariables, random, new[] { forecastEpisode }, 100, numericIntegrationSteps, odeSolver);
-      var optimizationData = new Problem.OptimizationData(trees, targetVars, problemData.AllowedInputVariables.ToArray(), problemData, null, new[] { forecastEpisode }, numericIntegrationSteps, latentVariables, odeSolver);
+
+      var inputVariables = trees.SelectMany(t => t.IterateNodesPrefix().OfType<VariableTreeNode>().Select(n => n.VariableName)).Except(targetVars);
+
+      var optimizationData = new Problem.OptimizationData(trees, targetVars, inputVariables.ToArray(), problemData, null, new[] { forecastEpisode }, numericIntegrationSteps, latentVariables, odeSolver);
       // 
       // 
