Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs	(revision 16950)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs	(revision 16951)
@@ -604,10 +604,16 @@
         results.Add(new Result("SNMSE", typeof(DoubleValue)));
       }
+      if(!results.ContainsKey("SNMSE values")) {
+        var dt = new DataTable("SNMSE values");
+        dt.Rows.Add(new DataRow("ODE SNMSE"));
+        dt.Rows.Add(new DataRow("Fitness"));
+        results.Add(new Result("SNMSE values", dt));
+      }
       if (!results.ContainsKey("Solution")) {
         results.Add(new Result("Solution", typeof(Solution)));
       }
-      if (!results.ContainsKey("Squared error and gradient")) {
-        results.Add(new Result("Squared error and gradient", typeof(DataTable)));
-      }
+      // if (!results.ContainsKey("Squared error and gradient")) {
+      //   results.Add(new Result("Squared error and gradient", typeof(DataTable)));
+      // }
 
       var bestIndividualAndQuality = this.GetBestIndividual(individuals, qualities);
@@ -679,9 +685,10 @@
         // for target values and latent variables
         var trainingRows = optimizationData.rows;
+        double trainingSNMSE = 0.0;
         for (int colIdx = 0; colIdx < trees.Length; colIdx++) {
           // is target variable
           if (colIdx < targetVars.Length) {
             var targetVar = targetVars[colIdx];
-            var trainingDataTable = new DataTable(targetVar + " prediction (training)");
+            var trainingDataTable = new DataTable(targetVar + " prediction (training)"); 
             var actualValuesRow = new DataRow(targetVar, "The values of " + targetVar, problemData.Dataset.GetDoubleValues(targetVar, trainingRows));
             var idx = Enumerable.Range(0, trainingRows.Length).Select(i => i * targetVars.Length + colIdx);
@@ -690,4 +697,7 @@
             trainingDataTable.Rows.Add(actualValuesRow);
             trainingDataTable.Rows.Add(predictedValuesRow);
+
+            // again calculate the integrated error (regardless how fitness is determined)
+            trainingSNMSE += actualValuesRow.Values.Zip(predictedValuesRow.Values, (a, p) => Math.Pow(a - p, 2)).Average() / actualValuesRow.Values.Variance() / targetVars.Length;
 
             for (int paramIdx = 0; paramIdx < numParams; paramIdx++) {
@@ -710,16 +720,21 @@
         }
 
-        var errorTable = new DataTable("Squared error and gradient");
-        var seRow = new DataRow("Squared error");
-        var gradientRows = Enumerable.Range(0, numParams).Select(i => new DataRow($"∂SE/∂θ{i}")).ToArray();
-        errorTable.Rows.Add(seRow);
-        foreach (var gRow in gradientRows) {
-          gRow.VisualProperties.SecondYAxis = true;
-          errorTable.Rows.Add(gRow);
-        }
-        var targetValues = targetVars.Select(v => problemData.Dataset.GetDoubleValues(v, trainingRows).ToArray()).ToArray();
-        int r = 0;
-
-        // foreach (var y_pred in trainingPrediction) {
+        results.AddOrUpdateResult("ODE SNMSE", new DoubleValue(trainingSNMSE));
+        var odeSNMSETable = (DataTable)results["SNMSE values"].Value;
+        odeSNMSETable.Rows["ODE SNMSE"].Values.Add(trainingSNMSE);
+        odeSNMSETable.Rows["Fitness"].Values.Add(bestIndividualAndQuality.Item2);
+
+        // var errorTable = new DataTable("Squared error and gradient");
+        // var seRow = new DataRow("Squared error");
+        // var gradientRows = Enumerable.Range(0, numParams).Select(i => new DataRow($"∂SE/∂θ{i}")).ToArray();
+        // errorTable.Rows.Add(seRow);
+        // foreach (var gRow in gradientRows) {
+        //   gRow.VisualProperties.SecondYAxis = true;
+        //   errorTable.Rows.Add(gRow);
+        // }
+        // var targetValues = targetVars.Select(v => problemData.Dataset.GetDoubleValues(v, trainingRows).ToArray()).ToArray();
+        // int r = 0;
+
+        // foreach (var y_pred in fi) {
         //   // calculate objective function gradient
         //   double f_i = 0.0;
@@ -1599,13 +1614,4 @@
     #region  helper
 
-    private static IEnumerable<T> EveryNth<T>(IEnumerable<T> xs, int step) {
-      var e = xs.GetEnumerator();
-      while (e.MoveNext()) {
-        for (int i = 0; i < step; i++) {
-          if (!e.MoveNext()) yield break;
-        }
-        yield return e.Current;
-      }
-    }
 
     private void InitAllParameters() {
@@ -1630,5 +1636,4 @@
 
     private static bool IsConstantNode(ISymbolicExpressionTreeNode n) {
-      // return n.Symbol.Name[0] == 'θ';
       return n is ConstantTreeNode;
     }
@@ -1736,6 +1741,4 @@
 
       grammar.ConfigureAsDefaultRegressionGrammar();
-      grammar.GetSymbol("Logarithm").Enabled = false; // not supported yet
-      grammar.GetSymbol("Exponential").Enabled = false; // not supported yet
 
       // configure initialization of constants
