Index: /trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanAbsolutePercentageErrorEvaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanAbsolutePercentageErrorEvaluator.cs	(revision 395)
+++ /trunk/sources/HeuristicLab.StructureIdentification/Evaluation/MeanAbsolutePercentageErrorEvaluator.cs	(revision 395)
@@ -0,0 +1,72 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Operators;
+using HeuristicLab.Functions;
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.StructureIdentification {
+  public class MeanAbsolutePercentageErrorEvaluator : GPEvaluatorBase {
+    public override string Description {
+      get {
+        return @"Evaluates 'FunctionTree' for all samples of 'Dataset' and calculates
+the 'mean absolute percentage error (scale invariant)' of estimated values vs. real values of 'TargetVariable'.";
+      }
+    }
+
+    public MeanAbsolutePercentageErrorEvaluator()
+      : base() {
+    }
+
+    public override double Evaluate(IScope scope, IFunctionTree functionTree, int targetVariable, Dataset dataset) {
+      int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
+      int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
+      double errorsSum = 0.0;
+      functionTree.PrepareEvaluation(dataset);
+      for(int sample = trainingStart; sample < trainingEnd; sample++) {
+        double estimated = functionTree.Evaluate(sample);
+        double original = dataset.GetValue(sample, targetVariable);
+        if(!double.IsNaN(original) && !double.IsInfinity(original)) {
+          if(double.IsNaN(estimated) || double.IsInfinity(estimated))
+            estimated = maximumPunishment;
+          else if(estimated > maximumPunishment)
+            estimated = maximumPunishment;
+          else if(estimated < -maximumPunishment)
+            estimated = -maximumPunishment;
+
+          double percent_error = Math.Abs((estimated - original) / original);
+          errorsSum += percent_error;
+        }
+      }
+      int nSamples = trainingEnd - trainingStart;
+      double quality = errorsSum / nSamples;
+      if(double.IsNaN(quality) || double.IsInfinity(quality))
+        quality = double.MaxValue;
+      return quality;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.StructureIdentification/Evaluation/TheilInequalityCoefficientEvaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.StructureIdentification/Evaluation/TheilInequalityCoefficientEvaluator.cs	(revision 394)
+++ /trunk/sources/HeuristicLab.StructureIdentification/Evaluation/TheilInequalityCoefficientEvaluator.cs	(revision 395)
@@ -41,4 +41,5 @@
     public TheilInequalityCoefficientEvaluator()
       : base() {
+      AddVariableInfo(new VariableInfo("Differential", "Wether to calculate the coefficient for the predicted change vs. original change or for the absolute prediction vs. original value", typeof(BoolData), VariableKind.In));
     }
 
@@ -46,4 +47,5 @@
       int trainingStart = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
       int trainingEnd = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
+      bool difference = GetVariableValue<BoolData>("Differential", scope, true).Data;
       double errorsSquaredSum = 0.0;
       double estimatedSquaredSum = 0.0;
@@ -51,5 +53,6 @@
       functionTree.PrepareEvaluation(dataset);
       for(int sample = trainingStart; sample < trainingEnd; sample++) {
-        double prevValue = dataset.GetValue(sample - 1, targetVariable);
+        double prevValue = 0.0;
+        if(difference) prevValue = dataset.GetValue(sample - 1, targetVariable);
         double estimatedChange = functionTree.Evaluate(sample) - prevValue;
         double originalChange = dataset.GetValue(sample, targetVariable) - prevValue;
Index: /trunk/sources/HeuristicLab.StructureIdentification/HeuristicLab.StructureIdentification.csproj
===================================================================
--- /trunk/sources/HeuristicLab.StructureIdentification/HeuristicLab.StructureIdentification.csproj	(revision 394)
+++ /trunk/sources/HeuristicLab.StructureIdentification/HeuristicLab.StructureIdentification.csproj	(revision 395)
@@ -48,4 +48,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Evaluation\MeanAbsolutePercentageErrorEvaluator.cs" />
     <Compile Include="Evaluation\TheilInequalityCoefficientEvaluator.cs" />
     <Compile Include="Evaluation\SimpleEvaluator.cs" />
