Index: /trunk/sources/HeuristicLab.GP.Boolean/BooleanTreeInterpreter.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.Boolean/BooleanTreeInterpreter.cs	(revision 729)
+++ /trunk/sources/HeuristicLab.GP.Boolean/BooleanTreeInterpreter.cs	(revision 730)
@@ -34,46 +34,41 @@
     private const double EPSILON = 0.00001;
     private Dataset dataset;
-    private IFunctionTree tree;
+    private List<LightWeightFunction> expression;
     private int targetVariable;
     private int currentRow;
-    private Dictionary<IFunctionTree, int> cachedIndex = new Dictionary<IFunctionTree, int>();
+    private int pc;
 
-    public void Reset(Dataset dataset, IFunctionTree tree, int targetVariable) {
+    public void Reset(Dataset dataset, BakedFunctionTree tree, int targetVariable) {
       this.dataset = dataset;
-      this.tree = tree;
+      this.expression = tree.LinearRepresentation;
       this.targetVariable = targetVariable;
-      cachedIndex.Clear();
     }
 
-    internal int GetNumberMatchingInstances(int start, int end) {
-      int matchingInstances = 0;
+    internal int GetNumberOfErrors(int start, int end) {
+      int errors = 0;
       for (int i = start; i < end; i++) {
+        pc = 0;
         currentRow = i;
-        int result = Step(tree) ? 1 : 0;
-        if (Math.Abs(result - dataset.GetValue(i, targetVariable)) < EPSILON) matchingInstances++;
+        int result = Step() ? 1 : 0;
+        if (Math.Abs(result - dataset.GetValue(i, targetVariable)) > EPSILON) errors++;
       }
-      return matchingInstances;
+      return errors;
     }
 
-    internal bool Step(IFunctionTree tree) {
-      int symbol = SymbolTable.MapFunction(tree.Function);
+    internal bool Step() {
+      LightWeightFunction curFun = expression[pc++];
+      int symbol = SymbolTable.MapFunction(curFun.functionType);
       switch (symbol) {
-        case SymbolTable.AND: return Step(tree.SubTrees[0]) && Step(tree.SubTrees[1]);
-        case SymbolTable.OR: return Step(tree.SubTrees[0]) || Step(tree.SubTrees[1]);
-        case SymbolTable.NOT: return !Step(tree.SubTrees[0]);
-        case SymbolTable.XOR: return Step(tree.SubTrees[0]) ^ Step(tree.SubTrees[1]);
-        case SymbolTable.NAND: return !(Step(tree.SubTrees[0]) && Step(tree.SubTrees[1]));
-        case SymbolTable.NOR: return !(Step(tree.SubTrees[0]) || Step(tree.SubTrees[1]));
+        case SymbolTable.AND: return Step() & Step();
+        case SymbolTable.OR: return Step() | Step();
+        case SymbolTable.NOT: return !Step();
+        case SymbolTable.XOR: return Step() ^ Step();
+        case SymbolTable.NAND: return !(Step() & Step());
+        case SymbolTable.NOR: return !(Step() | Step());
         case SymbolTable.VARIABLE:
-          int index;
-          if (cachedIndex.TryGetValue(tree, out index)==false) {
-          } else {
-            index = ((ConstrainedIntData)tree.LocalVariables.ToArray()[0].Value).Data;
-            cachedIndex[tree] = index;
-          }
-          return dataset.GetValue(currentRow, index) != 0.0;
+          return dataset.GetValue(currentRow, (int)curFun.data[0]) != 0.0;
         case SymbolTable.UNKNOWN:
         default:
-          throw new InvalidOperationException(tree.Function.ToString());
+          throw new InvalidOperationException(curFun.functionType.ToString());
 
       }
Index: /trunk/sources/HeuristicLab.GP.Boolean/Evaluator.cs
===================================================================
--- /trunk/sources/HeuristicLab.GP.Boolean/Evaluator.cs	(revision 729)
+++ /trunk/sources/HeuristicLab.GP.Boolean/Evaluator.cs	(revision 730)
@@ -32,14 +32,14 @@
     public Evaluator()
       : base() {
-      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree representing the ant", typeof(IFunctionTree), VariableKind.In));
+      AddVariableInfo(new VariableInfo("FunctionTree", "The function tree representing the ant", typeof(BakedFunctionTree), VariableKind.In));
       AddVariableInfo(new VariableInfo("Dataset", "The boolean dataset (values 0.0 = false, 1.0=true)", typeof(Dataset), VariableKind.In));
       AddVariableInfo(new VariableInfo("TargetVariable", "Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
       AddVariableInfo(new VariableInfo("SamplesEnd", "End index of samples in dataset to evaluate", typeof(IntData), VariableKind.In));
-      AddVariableInfo(new VariableInfo("MatchingCases", "", typeof(DoubleData), VariableKind.New | VariableKind.Out));
+      AddVariableInfo(new VariableInfo("Errors", "", typeof(DoubleData), VariableKind.New | VariableKind.Out));
     }
 
     public override IOperation Apply(IScope scope) {
-      IFunctionTree tree = GetVariableValue<IFunctionTree>("FunctionTree", scope, true);
+      BakedFunctionTree tree = GetVariableValue<BakedFunctionTree>("FunctionTree", scope, true);
       Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true);
       int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;
@@ -49,7 +49,7 @@
       BooleanTreeInterpreter interpreter = new BooleanTreeInterpreter();
       interpreter.Reset(dataset, tree, targetVariable);
-      int matchingCases = interpreter.GetNumberMatchingInstances(start, end);
+      int errors = interpreter.GetNumberOfErrors(start, end);
 
-      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("MatchingCases"), new DoubleData(matchingCases)));
+      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Errors"), new DoubleData(errors)));
       return null;
     }
