Index: trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/AveragePercentageChangeEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/AveragePercentageChangeEvaluator.cs	(revision 702)
+++ trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/AveragePercentageChangeEvaluator.cs	(revision 712)
@@ -45,5 +45,5 @@
       bool differential = GetVariableValue<BoolData>("Differential", scope, true).Data;
       DoubleData apc = GetVariableValue<DoubleData>("APC", scope, false, false);
-      if(apc == null) {
+      if (apc == null) {
         apc = new DoubleData();
         scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("APC"), apc));
@@ -51,27 +51,27 @@
 
       double percentageSum = 0;
-      for(int sample = start; sample < end; sample++) {
+      for (int sample = start; sample < end; sample++) {
         double prevOriginal;
         double originalPercentageChange;
         double estimatedPercentageChange;
-        if(differential) {
-          prevOriginal = dataset.GetValue(targetVariable,sample - 1);
-          originalPercentageChange = (dataset.GetValue(targetVariable,sample) - prevOriginal) / prevOriginal;
+        if (differential) {
+          prevOriginal = dataset.GetValue(sample - 1, targetVariable);
+          originalPercentageChange = (dataset.GetValue(sample, targetVariable) - prevOriginal) / prevOriginal;
           estimatedPercentageChange = (evaluator.Evaluate(sample) - prevOriginal) / prevOriginal;
-          if(updateTargetValues) {
-            dataset.SetValue(targetVariable, sample, estimatedPercentageChange * prevOriginal + prevOriginal);
+          if (updateTargetValues) {
+            dataset.SetValue(sample, targetVariable, estimatedPercentageChange * prevOriginal + prevOriginal);
           }
         } else {
-          originalPercentageChange = dataset.GetValue(targetVariable,sample);
+          originalPercentageChange = dataset.GetValue(sample, targetVariable);
           estimatedPercentageChange = evaluator.Evaluate(sample);
-          if(updateTargetValues) {
-            dataset.SetValue(targetVariable, sample, estimatedPercentageChange);
+          if (updateTargetValues) {
+            dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
           }
         }
-        if(!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) {
-          if((estimatedPercentageChange > 0 && originalPercentageChange > 0) ||
+        if (!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) {
+          if ((estimatedPercentageChange > 0 && originalPercentageChange > 0) ||
             (estimatedPercentageChange < 0 && originalPercentageChange < 0)) {
             percentageSum += Math.Abs(originalPercentageChange);
-          } else if((estimatedPercentageChange > 0 && originalPercentageChange < 0) ||
+          } else if ((estimatedPercentageChange > 0 && originalPercentageChange < 0) ||
             (estimatedPercentageChange < 0 && originalPercentageChange > 0)) {
             percentageSum -= Math.Abs(originalPercentageChange);
@@ -81,5 +81,5 @@
 
       percentageSum /= (end - start);
-      if(double.IsNaN(percentageSum) || double.IsInfinity(percentageSum)) {
+      if (double.IsNaN(percentageSum) || double.IsInfinity(percentageSum)) {
         percentageSum = double.MinValue;
       }
Index: trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/ProfitEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/ProfitEvaluator.cs	(revision 702)
+++ trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/ProfitEvaluator.cs	(revision 712)
@@ -47,5 +47,5 @@
       double transactionCost = GetVariableValue<DoubleData>("TransactionCost", scope, true).Data;
       DoubleData profit = GetVariableValue<DoubleData>("Profit", scope, false, false);
-      if(profit == null) {
+      if (profit == null) {
         profit = new DoubleData();
         scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Profit"), profit));
@@ -55,17 +55,17 @@
       double cB = 0;
       double exchangeRate = double.MaxValue;
-      for(int sample = start; sample < end; sample++) {
+      for (int sample = start; sample < end; sample++) {
         exchangeRate = dataset.GetValue(sample, exchangeRateVarIndex);
-        double originalPercentageChange = dataset.GetValue(targetVariable, sample);
+        double originalPercentageChange = dataset.GetValue(sample, targetVariable);
         double estimatedPercentageChange = evaluator.Evaluate(sample);
-        if(updateTargetValues) {
-          dataset.SetValue(targetVariable, sample, estimatedPercentageChange);
+        if (updateTargetValues) {
+          dataset.SetValue(sample, targetVariable, estimatedPercentageChange);
         }
-        if(!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) {
-          if(estimatedPercentageChange > 0) {
+        if (!double.IsNaN(originalPercentageChange) && !double.IsInfinity(originalPercentageChange)) {
+          if (estimatedPercentageChange > 0) {
             // prediction is the rate of B/A will increase (= get more B for one A) => exchange all B to A
             cA += (cB / exchangeRate) * (1 - transactionCost);
             cB = 0;
-          } else if(estimatedPercentageChange < 0) {
+          } else if (estimatedPercentageChange < 0) {
             // prediction is the rate of B/A will drop (= get more A for one B) => exchange all A to B
             cB += (cA * exchangeRate) * (1 - transactionCost);
@@ -75,5 +75,5 @@
       }
 
-      if(double.IsNaN(cA) || double.IsInfinity(cA) || double.IsInfinity(cB) || double.IsNaN(cB)) {
+      if (double.IsNaN(cA) || double.IsInfinity(cA) || double.IsInfinity(cB) || double.IsNaN(cB)) {
         cA = 0;
         cB = 0;
Index: trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/TheilInequalityCoefficientEvaluator.cs
===================================================================
--- trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/TheilInequalityCoefficientEvaluator.cs	(revision 702)
+++ trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/TheilInequalityCoefficientEvaluator.cs	(revision 712)
@@ -55,22 +55,22 @@
 
     public override void Evaluate(IScope scope, BakedTreeEvaluator evaluator, Dataset dataset, int targetVariable, int start, int end, bool updateTargetValues) {
-    #region create result variables
+      #region create result variables
       DoubleData theilInequaliy = GetVariableValue<DoubleData>("TheilInequalityCoefficient", scope, false, false);
-      if(theilInequaliy == null) {
+      if (theilInequaliy == null) {
         theilInequaliy = new DoubleData();
         scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TheilInequalityCoefficient"), theilInequaliy));
       }
       DoubleData uBias = GetVariableValue<DoubleData>("TheilInequalityCoefficientBias", scope, false, false);
-      if(uBias == null) {
+      if (uBias == null) {
         uBias = new DoubleData();
         scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TheilInequalityCoefficientBias"), uBias));
       }
       DoubleData uVariance = GetVariableValue<DoubleData>("TheilInequalityCoefficientVariance", scope, false, false);
-      if(uVariance == null) {
+      if (uVariance == null) {
         uVariance = new DoubleData();
         scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TheilInequalityCoefficientVariance"), uVariance));
       }
       DoubleData uCovariance = GetVariableValue<DoubleData>("TheilInequalityCoefficientCovariance", scope, false, false);
-      if(uCovariance == null) {
+      if (uCovariance == null) {
         uCovariance = new DoubleData();
         scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TheilInequalityCoefficientCovariance"), uCovariance));
@@ -83,12 +83,12 @@
       double[] originalChanges = new double[end - start];
       int nSamples = 0;
-      for(int sample = start; sample < end; sample++) {
-        double prevValue = dataset.GetValue(targetVariable, sample - 1);
+      for (int sample = start; sample < end; sample++) {
+        double prevValue = dataset.GetValue(sample - 1, targetVariable);
         double estimatedChange = evaluator.Evaluate(sample) - prevValue;
-        double originalChange = dataset.GetValue(targetVariable, sample) - prevValue;
-        if(updateTargetValues) {
-          dataset.SetValue(targetVariable, sample, estimatedChange + prevValue);
+        double originalChange = dataset.GetValue(sample, targetVariable) - prevValue;
+        if (updateTargetValues) {
+          dataset.SetValue(sample, targetVariable, estimatedChange + prevValue);
         }
-        if(!double.IsNaN(originalChange) && !double.IsInfinity(originalChange)) {
+        if (!double.IsNaN(originalChange) && !double.IsInfinity(originalChange)) {
           double error = estimatedChange - originalChange;
           errorsSquaredSum += error * error;
@@ -100,5 +100,5 @@
       }
       double quality = Math.Sqrt(errorsSquaredSum / nSamples) / Math.Sqrt(originalSquaredSum / nSamples);
-      if(double.IsNaN(quality) || double.IsInfinity(quality))
+      if (double.IsNaN(quality) || double.IsInfinity(quality))
         quality = double.MaxValue;
       theilInequaliy.Data = quality; // U2
