Index: branches/2966_interval_calculation/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
===================================================================
--- branches/2966_interval_calculation/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs	(revision 16374)
+++ branches/2966_interval_calculation/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs	(revision 16376)
@@ -38,5 +38,4 @@
 
     private const string EvaluatedSolutionsParameterName = "EvaluatedSolutions";
-    private static int InstructionCount = 0;
 
     public IFixedValueParameter<IntValue> EvaluatedSolutionsParameter {
@@ -72,17 +71,12 @@
     #endregion
 
-    private static void ResetInstrucitonCount() {
-      InstructionCount = 0;
-    }
-
-
     public Interval GetSymbolicExressionTreeIntervals(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows = null) {
       lock (syncRoot) {
         EvaluatedSolutions++;
-        ResetInstrucitonCount();
-      }
+      }
+      int instructionCount = 0;
       var intervalBoundaries = DatasetUtil.GetVariableBoundaries(dataset, rows);
       var instructions = PrepareInterpreterState(tree, intervalBoundaries);
-      var x = Evaluate(instructions);
+      var x = Evaluate(instructions, ref instructionCount);
 
       return x;
@@ -93,10 +87,10 @@
       lock (syncRoot) {
         EvaluatedSolutions++;
-        ResetInstrucitonCount();
-      }
+      }
+      int instructionCount = 0;
       var intervalBoundaries = DatasetUtil.GetVariableBoundaries(dataset, rows);
       intervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
       var instructions = PrepareInterpreterState(tree, intervalBoundaries);
-      var x = Evaluate(instructions, intervals);
+      var x = Evaluate(instructions, ref instructionCount, intervals);
 
       return x;
@@ -106,8 +100,8 @@
       lock (syncRoot) {
         EvaluatedSolutions++;
-        ResetInstrucitonCount();
-      }
+      }
+      int instructionCount = 0;
       var instructions = PrepareInterpreterState(tree, customIntervals);
-      var x = Evaluate(instructions);
+      var x = Evaluate(instructions, ref instructionCount);
 
       return x;
@@ -119,9 +113,9 @@
       lock (syncRoot) {
         EvaluatedSolutions++;
-        ResetInstrucitonCount();
-      }
+      }
+      int instructionCount = 0;
       intervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
       var instructions = PrepareInterpreterState(tree, customIntervals);
-      var x = Evaluate(instructions, intervals);
+      var x = Evaluate(instructions, ref instructionCount, intervals);
 
       return x;
@@ -146,7 +140,7 @@
     }
 
-    private Interval Evaluate(Instruction[] instructions, Dictionary<ISymbolicExpressionTreeNode,
+    private Interval Evaluate(Instruction[] instructions, ref int instructionCount, Dictionary<ISymbolicExpressionTreeNode,
       Interval> intervals = null) {
-      Instruction currentInstr = instructions[InstructionCount++];
+      Instruction currentInstr = instructions[instructionCount++];
       Interval result = null;
 
@@ -154,28 +148,28 @@
         //Elementary arithmetic rules
         case OpCodes.Add: {
-            result = Evaluate(instructions, intervals);
-            for (int i = 1; i < currentInstr.nArguments; i++) {
-              result = Interval.Add(result, Evaluate(instructions, intervals));
+            result = Evaluate(instructions, ref instructionCount, intervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              result = Interval.Add(result, Evaluate(instructions, ref instructionCount, intervals));
             }
             break;
           }
         case OpCodes.Sub: {
-            result = Evaluate(instructions, intervals);
-            for (int i = 1; i < currentInstr.nArguments; i++) {
-              result = Interval.Subtract(result, Evaluate(instructions, intervals));
+            result = Evaluate(instructions, ref instructionCount, intervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              result = Interval.Subtract(result, Evaluate(instructions, ref instructionCount, intervals));
             }
             break;
           }
         case OpCodes.Mul: {
-            result = Evaluate(instructions, intervals);
-            for (int i = 1; i < currentInstr.nArguments; i++) {
-              result = Interval.Multiply(result, Evaluate(instructions, intervals));
+            result = Evaluate(instructions, ref instructionCount, intervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              result = Interval.Multiply(result, Evaluate(instructions, ref instructionCount, intervals));
             }
             break;
           }
         case OpCodes.Div: {
-            result = Evaluate(instructions, intervals);
-            for (int i = 1; i < currentInstr.nArguments; i++) {
-              result = Interval.Divide(result, Evaluate(instructions, intervals));
+            result = Evaluate(instructions, ref instructionCount, intervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              result = Interval.Divide(result, Evaluate(instructions, ref instructionCount, intervals));
             }
             break;
@@ -183,44 +177,44 @@
         //Trigonometric functions
         case OpCodes.Sin: {
-            result = Interval.Sine(Evaluate(instructions, intervals));
+            result = Interval.Sine(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
         case OpCodes.Cos: {
-            result = Interval.Cosine(Evaluate(instructions, intervals));
+            result = Interval.Cosine(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
         case OpCodes.Tan: {
-            result = Interval.Tangens(Evaluate(instructions, intervals));
+            result = Interval.Tangens(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
         //Exponential functions
         case OpCodes.Log: {
-            result = Interval.Logarithm(Evaluate(instructions, intervals));
+            result = Interval.Logarithm(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
         case OpCodes.Exp: {
-            result = Interval.Exponential(Evaluate(instructions, intervals));
+            result = Interval.Exponential(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
         case OpCodes.Power: {
-            result = Evaluate(instructions, intervals);
-            for (int i = 1; i < currentInstr.nArguments; i++) {
-              result = Interval.Power(result, Evaluate(instructions, intervals));
+            result = Evaluate(instructions, ref instructionCount, intervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              result = Interval.Power(result, Evaluate(instructions, ref instructionCount, intervals));
             }
             break;
           }
         case OpCodes.Square: {
-            result = Interval.Square(Evaluate(instructions, intervals));
+            result = Interval.Square(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
         case OpCodes.Root: {
-            result = Evaluate(instructions, intervals);
-            for (int i = 1; i < currentInstr.nArguments; i++) {
-              result = Interval.Root(result, Evaluate(instructions, intervals));
+            result = Evaluate(instructions, ref instructionCount, intervals);
+            for (int i = 1; i < currentInstr.nArguments; i++) {
+              result = Interval.Root(result, Evaluate(instructions, ref instructionCount, intervals));
             }
             break;
           }
         case OpCodes.SquareRoot: {
-            result = Interval.SquareRoot(Evaluate(instructions, intervals));
+            result = Interval.SquareRoot(Evaluate(instructions, ref instructionCount, intervals));
             break;
           }
