Index: branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeSmalltalkStringFormatter.cs
===================================================================
--- branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeSmalltalkStringFormatter.cs	(revision 4864)
+++ branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeSmalltalkStringFormatter.cs	(revision 4868)
@@ -46,7 +46,14 @@
 
     private string FormatRecursively(SymbolicExpressionTreeNode node) {
+
+      Symbol symbol = node.Symbol;
+
+      if (symbol is ProgramRootSymbol || symbol is StartSymbol)
+        return FormatRecursively(node.SubTrees[0]);
+
       StringBuilder stringBuilder = new StringBuilder();
 
-      Symbol symbol = node.Symbol;
+      stringBuilder.Append("(");
+
       if (symbol is Addition) {
         for (int i = 0; i < node.SubTrees.Count; i++) {
@@ -57,10 +64,12 @@
         }
       } else if (symbol is And) {
+        stringBuilder.Append("(");
         for (int i = 0; i < node.SubTrees.Count; i++) {
           if (i > 0) stringBuilder.Append("&");
-          stringBuilder.Append("(");
+          stringBuilder.Append("((");
           stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
-          stringBuilder.Append(")");
+          stringBuilder.Append(")>=0)");
         }
+        stringBuilder.Append(") ifTrue:[1] ifFalse:[-1]");
       } else if (symbol is Average) {
         stringBuilder.Append("(1/");
@@ -79,24 +88,31 @@
       } else if (symbol is Cosine) {
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
-        stringBuilder.Append("cos");
+        stringBuilder.Append(" cos");
       } else if (symbol is Division) {
-        for (int i = 0; i < node.SubTrees.Count; i++) {
-          if (i > 0) stringBuilder.Append("/");
-          stringBuilder.Append("(");
-          stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
+        if (node.SubTrees.Count == 1) {
+          stringBuilder.Append("1/");
+          stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
+        } else {
+          stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
+          stringBuilder.Append("/(");
+          for (int i = 1; i < node.SubTrees.Count; i++) {
+            if (i > 1) stringBuilder.Append("*");
+            stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
+          }
           stringBuilder.Append(")");
         }
       } else if (symbol is Exponential) {
-        stringBuilder.Append("not yet implemented");
+        stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
+        stringBuilder.Append(" exp");
       } else if (symbol is GreaterThan) {
         stringBuilder.Append("(");
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
-        stringBuilder.Append(">");
+        stringBuilder.Append(" > ");
         stringBuilder.Append(FormatRecursively(node.SubTrees[1]));
-        stringBuilder.Append(")");
+        stringBuilder.Append(") ifTrue: [1] ifFalse: [-1]");
       } else if (symbol is IfThenElse) {
         stringBuilder.Append("(");
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
-        stringBuilder.Append(" ifTrue: [");
+        stringBuilder.Append(" > 0) ifTrue: [");
         stringBuilder.Append(FormatRecursively(node.SubTrees[1]));
         stringBuilder.Append("] ifFalse: [");
@@ -108,36 +124,40 @@
         stringBuilder.Append("(");
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
-        stringBuilder.Append("<");
+        stringBuilder.Append(" < ");
         stringBuilder.Append(FormatRecursively(node.SubTrees[1]));
-        stringBuilder.Append(")");
+        stringBuilder.Append(") ifTrue: [1] ifFalse: [-1]");
       } else if (symbol is Logarithm) {
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
-        stringBuilder.Append("log");
+        stringBuilder.Append("ln");
       } else if (symbol is Multiplication) {
         for (int i = 0; i < node.SubTrees.Count; i++) {
           if (i > 0) stringBuilder.Append("*");
-          stringBuilder.Append("(");
           stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
-          stringBuilder.Append(")");
         }
       } else if (symbol is Not) {
-        stringBuilder.Append("!");
+        stringBuilder.Append("-");
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
       } else if (symbol is Or) {
+        stringBuilder.Append("(");
         for (int i = 0; i < node.SubTrees.Count; i++) {
           if (i > 0) stringBuilder.Append("|");
-          stringBuilder.Append("(");
+          stringBuilder.Append("((");
           stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
-          stringBuilder.Append(")");
+          stringBuilder.Append(")>=0)");
         }
+        stringBuilder.Append(") ifTrue:[1] ifFalse:[-1]");
       } else if (symbol is Sine) {
         stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
-        stringBuilder.Append("sin");
+        stringBuilder.Append(" sin");
       } else if (symbol is Subtraction) {
-        for (int i = 0; i < node.SubTrees.Count; i++) {
-          if (i > 0) stringBuilder.Append("-");
-          stringBuilder.Append("(");
-          stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
-          stringBuilder.Append(")");
+        if (node.SubTrees.Count == 1) {
+          stringBuilder.Append("-");
+          stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
+        } else {
+          stringBuilder.Append(FormatRecursively(node.SubTrees[0]));
+          for (int i = 1; i < node.SubTrees.Count; i++) {
+            stringBuilder.Append("-");
+            stringBuilder.Append(FormatRecursively(node.SubTrees[i]));
+          }
         }
       } else if (symbol is Tangent) {
@@ -145,5 +165,8 @@
         stringBuilder.Append("tan");
       } else if (symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable) {
-        stringBuilder.Append("not yet implemented");
+        VariableTreeNode variableTreeNode = node as VariableTreeNode;
+        stringBuilder.Append(variableTreeNode.Weight);
+        stringBuilder.Append("*");
+        stringBuilder.Append(variableTreeNode.VariableName);
       }
 
@@ -151,4 +174,6 @@
         stringBuilder.Append("ERROR");
       }
+
+      stringBuilder.Append(")");
 
       return stringBuilder.ToString();
