Index: branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
===================================================================
--- branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 4869)
+++ branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj	(revision 4900)
@@ -1,3 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
+﻿<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
@@ -198,4 +198,6 @@
     <Compile Include="SupportVectorMachine\SupportVectorMachineUtil.cs" />
     <Compile Include="Symbolic\ArithmeticExpressionGrammar.cs" />
+    <Compile Include="Symbolic\Formatters\SymbolicExpressionTreeGraphvizFormatter.cs" />
+    <Compile Include="Symbolic\Formatters\SymbolicExpressionTreeLatexFormatter.cs" />
     <Compile Include="Symbolic\Formatters\SymbolicExpressionTreeSmalltalkStringFormatter.cs" />
     <Compile Include="Symbolic\FullFunctionalExpressionGrammar.cs" />
Index: branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeGraphvizFormatter.cs
===================================================================
--- branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeGraphvizFormatter.cs	(revision 4900)
+++ branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeGraphvizFormatter.cs	(revision 4900)
@@ -0,0 +1,119 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Text;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using System.Collections.Generic;
+using HeuristicLab.Core;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Formatters {
+  [StorableClass]
+  [Item("SymbolicExpressionTreeGraphvizFormatter", "Formatter for symbolic expression trees for import into GraphViz documents.")]
+  public sealed class SymbolicExpressionTreeGraphvizFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [Storable]
+    public bool Indent { get; set; }
+
+    private readonly static Dictionary<string, string> symbolNameMap = new Dictionary<string, string>() {
+      {"Multiplication", "Mul"},
+      {"Addition", "Add"},
+      {"Division", "Div"},
+      {"Subtraction", "Sub"},
+      {"Average", "Avg"},
+      
+      {"Logarithm", "Log"},
+      {"Exponential", "Exp"},
+
+      {"Cosine", "Cos"},
+      {"Sine", "Sin"},
+      {"Tangent", "Tan"},
+
+      {"GreaterThan", ">"},
+      {"LessThan", "<"},
+      {"IfThenElse", "If"},
+
+      // match Koza style
+      {"ProgramRootSymbol", "Prog"},
+      {"StartSymbol", "RPB"}, 
+    };
+
+
+    [StorableConstructor]
+    private SymbolicExpressionTreeGraphvizFormatter(bool deserializing) : base(deserializing) { }
+    public SymbolicExpressionTreeGraphvizFormatter()
+      : base("SymbolicExpressionTreeLatexFormatter", "Formatter for symbolic expression trees for import into LaTeX documents.") {
+      Indent = true;
+    }
+    private SymbolicExpressionTreeGraphvizFormatter(SymbolicExpressionTreeGraphvizFormatter original, Cloner cloner)
+      : base(original, cloner) {
+      this.Indent = original.Indent;
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeGraphvizFormatter(this, cloner);
+    }
+
+    public string Format(SymbolicExpressionTree symbolicExpressionTree) {
+      int nodeCounter = 1;
+      StringBuilder strBuilder = new StringBuilder();
+      strBuilder.AppendLine("graph {");
+      strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root, 0, ref nodeCounter));
+      strBuilder.AppendLine("}");
+      return strBuilder.ToString();
+    }
+
+    private string FormatRecursively(SymbolicExpressionTreeNode node, int indentLength, ref int nodeId) {
+      // save id of current node
+      int currentNodeId = nodeId;
+      // increment id for next node
+      nodeId++;
+
+      StringBuilder strBuilder = new StringBuilder();
+      if (Indent) strBuilder.Append(' ', indentLength);
+
+      // get label for node and map if necessary
+      string nodeLabel = node.ToString();
+      if (symbolNameMap.ContainsKey(nodeLabel)) {
+        nodeLabel = symbolNameMap[nodeLabel];
+      }
+
+      strBuilder.Append("node" + currentNodeId + "[label=\"" + nodeLabel + "\"");
+      // leaf nodes should have box shape
+      if (node.SubTrees.Count == 0) {
+        strBuilder.AppendLine(", shape=\"box\"];");
+      } else {
+        strBuilder.AppendLine("];");
+      }
+
+      // internal nodes or leaf nodes?
+      foreach (SymbolicExpressionTreeNode subTree in node.SubTrees) {
+        // add an edge 
+        if (Indent) strBuilder.Append(' ', indentLength);
+        strBuilder.AppendLine("node" + currentNodeId + " -- node" + nodeId + ";");
+        // format the whole subtree
+        strBuilder.Append(FormatRecursively(subTree, indentLength + 2, ref nodeId));
+      }
+
+      return strBuilder.ToString();
+    }
+  }
+}
Index: branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeLatexFormatter.cs
===================================================================
--- branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeLatexFormatter.cs	(revision 4900)
+++ branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeLatexFormatter.cs	(revision 4900)
@@ -0,0 +1,150 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2010 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.Text;
+using System.Linq;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
+using System.Collections.Generic;
+using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
+using System;
+using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
+using HeuristicLab.Core;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Formatters {
+  [Item("SymbolicExpressionTreeLatexFormatter", "Formatter for symbolic expression trees for import into LaTeX documents.")]
+  public sealed class SymbolicExpressionTreeLatexFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
+    [StorableConstructor]
+    private SymbolicExpressionTreeLatexFormatter(bool deserializing) : base(deserializing) { }
+    public SymbolicExpressionTreeLatexFormatter()
+      : base("SymbolicExpressionTreeLatexFormatter", "Formatter for symbolic expression trees for import into LaTeX documents.") { }
+    private SymbolicExpressionTreeLatexFormatter(SymbolicExpressionTreeLatexFormatter original, Cloner cloner) : base(original, cloner) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SymbolicExpressionTreeLatexFormatter(this, cloner);
+    }
+
+    public string Format(SymbolicExpressionTree symbolicExpressionTree) {
+      try {
+        StringBuilder strBuilder = new StringBuilder();
+        strBuilder.AppendLine("\\begin{eqnarray}");
+        strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root));
+        strBuilder.AppendLine("\\end{eqnarray}");
+        return strBuilder.ToString();
+      }
+      catch (NotImplementedException ex) {
+        return ex.Message + Environment.NewLine + ex.StackTrace;
+      }
+    }
+
+    private string FormatRecursively(SymbolicExpressionTreeNode node) {
+      StringBuilder strBuilder = new StringBuilder();
+
+      FormatBegin(node, strBuilder);
+
+      if (node.SubTrees.Count > 0) {
+        strBuilder.Append(FormatRecursively(node.SubTrees[0]));
+      }
+      foreach (SymbolicExpressionTreeNode subTree in node.SubTrees.Skip(1)) {
+        FormatSep(node, strBuilder);
+        // format the whole subtree
+        strBuilder.Append(FormatRecursively(subTree));
+      }
+
+      FormatEnd(node, strBuilder);
+
+      return strBuilder.ToString();
+    }
+
+    private void FormatBegin(SymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.Symbol is Addition) {
+        strBuilder.Append(@" \left( ");
+      } else if (node.Symbol is Subtraction) {
+        strBuilder.Append(@" \left( ");
+      } else if (node.Symbol is Multiplication) {
+      } else if (node.Symbol is Division) {
+        if (node.SubTrees.Count != 2) throw new NotImplementedException("Division with more than 2 arguments is not implemented.");
+        strBuilder.Append(@" \frac{ ");
+      } else if (node.Symbol is Constant) {
+        strBuilder.Append(" c ");
+      } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable) {
+        var varNode = node as VariableTreeNode;
+        strBuilder.Append(" " + varNode.ToString() + " ");
+      } else if (node.Symbol is ProgramRootSymbol) {
+      } else if (node.Symbol is Defun) {
+        var defunNode = node as DefunTreeNode;
+        strBuilder.Append(defunNode.FunctionName + " & = & ");
+      } else if (node.Symbol is InvokeFunction) {
+        var invokeNode = node as InvokeFunctionTreeNode;
+        strBuilder.Append(invokeNode.Symbol.FunctionName + @" \left( ");
+      } else if (node.Symbol is StartSymbol) {
+        strBuilder.Append("Result & = & ");
+      } else if (node.Symbol is Argument) {
+        var argSym = node.Symbol as Argument;
+        strBuilder.Append(" ARG+" + argSym.ArgumentIndex + " ");
+      } else {
+        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
+      }
+    }
+
+    private void FormatSep(SymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.Symbol is Addition) {
+        strBuilder.Append(" + ");
+      } else if (node.Symbol is Subtraction) {
+        strBuilder.Append(" - ");
+      } else if (node.Symbol is Multiplication) {
+      } else if (node.Symbol is Division) {
+        strBuilder.Append(" }{ ");
+      } else if (node.Symbol is ProgramRootSymbol) {
+        strBuilder.Append(@"\\" + Environment.NewLine);
+      } else if (node.Symbol is Defun) {
+      } else if (node.Symbol is InvokeFunction) {
+        strBuilder.Append(" , ");
+      } else if (node.Symbol is StartSymbol) {
+        strBuilder.Append(@"\\" + Environment.NewLine + " & & ");
+      } else {
+        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
+      }
+    }
+
+    private void FormatEnd(SymbolicExpressionTreeNode node, StringBuilder strBuilder) {
+      if (node.Symbol is Addition) {
+        strBuilder.Append(@" \right) ");
+      } else if (node.Symbol is Subtraction) {
+        strBuilder.Append(@" \right) ");
+      } else if (node.Symbol is Multiplication) {
+      } else if (node.Symbol is Division) {
+        strBuilder.Append(" } ");
+      } else if (node.Symbol is Constant) {
+      } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable) {
+      } else if (node.Symbol is ProgramRootSymbol) {
+      } else if (node.Symbol is Defun) {
+      } else if (node.Symbol is InvokeFunction) {
+        strBuilder.Append(@" \right) ");
+      } else if (node.Symbol is StartSymbol) {
+      } else if (node.Symbol is Argument) {
+      } else {
+        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
+      }
+    }
+  }
+}
