Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Evaluation.csproj
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Evaluation.csproj	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Evaluation.csproj	(revision 12781)
@@ -54,5 +54,5 @@
       <SubType>Designer</SubType>
     </ApplicationDefinition>
-    <Compile Include="EvaluationStat.cs" />
+    <Compile Include="FoundSolution.cs" />
     <Compile Include="Run.cs" />
     <Compile Include="ViewModel\EvaluationViewModel.cs" />
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/EvaluationStat.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/EvaluationStat.cs	(revision 12763)
+++ 	(revision )
@@ -1,28 +1,0 @@
-﻿using System;
-
-namespace Evaluation
-{
-    public class EvaluationStat
-    {
-        public DateTime Time { get; set; }
-
-        public long Iteration { get; set; }
-
-        public double Quality { get; set; }
-
-        public double CurrentBestQuality { get; set; }
-
-        public EvaluationStat()
-        {
-            
-        }
-
-        public EvaluationStat(DateTime time, long iteration, double quality, double currentBestQuality)
-        {
-            Time = time;
-            Iteration = iteration;
-            Quality = quality;
-            CurrentBestQuality = currentBestQuality;
-        }
-    }
-}
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/FoundSolution.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/FoundSolution.cs	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/FoundSolution.cs	(revision 12781)
@@ -0,0 +1,28 @@
+﻿using System;
+
+namespace Evaluation
+{
+    public class FoundSolution
+    {
+        public DateTime Time { get; set; }
+
+        public int Iteration { get; set; }
+
+        public double Quality { get; set; }
+
+        public string Sentence { get; set; }
+
+        public FoundSolution()
+        {
+            
+        }
+
+        public FoundSolution(DateTime time, int iteration, double quality, string sentence)
+        {
+            Time = time;
+            Iteration = iteration;
+            Quality = quality;
+            Sentence = sentence;
+        }
+    }
+}
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml	(revision 12781)
@@ -39,5 +39,5 @@
                           DisplayMemberPath="Name"
                           SelectedValue="{Binding SelectedAlgorithm}"
-                          Width="200"
+                          Width="280"
                           SelectionChanged="ComboBoxAlgorithms_OnSelectionChanged"></ComboBox>
                 <ComboBox Name="ComboBoxPolicies"
@@ -75,6 +75,4 @@
                 <TextBlock Margin="2" Grid.Column="2" Grid.Row="0" VerticalAlignment="Center">MaxLen:</TextBlock>
                 <TextBox Name="TextBoxMaxLen" Margin="2" Grid.Column="3" Grid.Row="0" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxLen}"></TextBox>
-                <TextBlock Margin="2" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center">Threads:</TextBlock>
-                <TextBox Name="TextBoxThreads" Margin="2" Grid.Column="3" Grid.Row="1" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding Threads}"></TextBox>
             </Grid>
         </GroupBox>
@@ -125,8 +123,6 @@
                                         <ColumnDefinition Width="*"></ColumnDefinition>
                                     </Grid.ColumnDefinitions>
-                                    <Grid Name="MyGrid" Grid.Column="0" DataContext="{Binding CurrentRun.TreeInfos}">
+                                    <Grid Name="MyGrid" Grid.Column="0" DataContext="{Binding SelectedRun.TreeInfos}">
                                         <Grid.RowDefinitions>
-                                            <RowDefinition Height="Auto"></RowDefinition>
-                                            <RowDefinition Height="Auto"></RowDefinition>
                                             <RowDefinition Height="Auto"></RowDefinition>
                                             <RowDefinition Height="Auto"></RowDefinition>
@@ -148,9 +144,5 @@
                                         <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding LeaveNodes}" TextAlignment="Right"></TextBlock>
                                         <TextBlock Grid.Row="4" Grid.Column="0" Text="DeepestLevel:"></TextBlock>
-                                        <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding DeepestLevel}" TextAlignment="Right"></TextBlock>
-                                        <TextBlock Grid.Row="5" Grid.Column="0" Text="AverageLevel:"></TextBlock>
-                                        <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding AverageLevel}" TextAlignment="Right"></TextBlock>
-                                        <TextBlock Grid.Row="6" Grid.Column="0" Text="AverageChildren:"></TextBlock>
-                                        <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding AverageChildren}" TextAlignment="Right"></TextBlock>
+                                        <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding DeepestLevel}" TextAlignment="Right"></TextBlock>                                        
                                     </Grid>
                                     <Frame Grid.Column="1" Name="treeDrawing" Source="pack://application:,,,/WpfTestSvgSample;component/DrawingPage.xaml"/>
@@ -162,5 +154,5 @@
 
                 <TabItem Header="Run-Comparison">
-                    <TabControl Name="TabControlRunComparison" SelectionChanged="TabControlRunComparison_OnSelectionChanged">
+                    <TabControl Name="TabControlRunComparison">
                         <TabItem Name="TabItemChartRunComparison" Header="Chart">
                             <d3:ChartPlotter x:Name="ComparisonChartPlotter" LegendVisible="False" EnableSmoothPanningForNumericAxes="True">
@@ -182,5 +174,5 @@
                                                             Header="BestKnownQuality"/>
                                             <GridViewColumn DisplayMemberBinding="{Binding Path=BestSolutionQuality}"
-                                                            Header="BestFoundQuality"/>
+                                                            Header="BestQuality"/>
                                             <GridViewColumn DisplayMemberBinding="{Binding Path=EvaluationsPerSecond}"
                                                             Header="EvaluationsPerSecond"/>
@@ -211,4 +203,5 @@
                     <RowDefinition Height="Auto" />
                     <RowDefinition Height="Auto" />
+                    <RowDefinition Height="Auto" />
                 </Grid.RowDefinitions>
                 <Grid.ColumnDefinitions>
@@ -216,22 +209,24 @@
                     <ColumnDefinition Width="*" />
                 </Grid.ColumnDefinitions>
-                <TextBlock Grid.Row="0" Grid.Column="0">Run:</TextBlock>
-                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding CurrentRunString}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="1" Grid.Column="0">Evaluations:</TextBlock>
-                <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Evaluations}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="2" Grid.Column="0">MaxEvaluations:</TextBlock>
-                <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding MaxEvaluations}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="3" Grid.Column="0">CurrentBestQuality:</TextBlock>
-                <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding CurrentBestQuality}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="4" Grid.Column="0">BestKnownQuality:</TextBlock>
-                <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding BestKnownQuality}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="5" Grid.Column="0">MaxLen:</TextBlock>
-                <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding MaxLen}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="6" Grid.Column="0">Evaluations/sec:</TextBlock>
-                <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding EvaluationsPerSec}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="7" Grid.Column="0">BestSolutionFoundAt:</TextBlock>
-                <TextBlock Grid.Row="7" Grid.Column="1" Text="{Binding BestSolutionFoundAt}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
-                <TextBlock Grid.Row="8" Grid.Column="0">BestSolution:</TextBlock>
-                <TextBlock Grid.Row="8" Grid.Column="1" Text="{Binding BestSolution}" Margin="5,0,0,0" HorizontalAlignment="Right" MaxWidth="100"/>
+                <TextBlock Grid.Row="0" Grid.Column="0">CompletedRuns:</TextBlock>
+                <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding CompletedRuns}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="1" Grid.Column="0">RunState:</TextBlock>
+                <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SelectedRun.RunState}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="2" Grid.Column="0">Evaluations:</TextBlock>
+                <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SelectedRun.Evaluations}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="3" Grid.Column="0">MaxEvaluations:</TextBlock>
+                <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding SelectedRun.MaxEvaluations}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="4" Grid.Column="0">BestQuality:</TextBlock>
+                <TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding SelectedRun.BestQuality}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="5" Grid.Column="0">BestKnownQuality:</TextBlock>
+                <TextBlock Grid.Row="5" Grid.Column="1" Text="{Binding SelectedRun.BestKnownQuality}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="6" Grid.Column="0">MaxLen:</TextBlock>
+                <TextBlock Grid.Row="6" Grid.Column="1" Text="{Binding SelectedRun.MaxLen}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="7" Grid.Column="0">Evaluations/sec:</TextBlock>
+                <TextBlock Grid.Row="7" Grid.Column="1" Text="{Binding SelectedRun.EvaluationsPerSecond}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="8" Grid.Column="0">BestSolutionFoundAt:</TextBlock>
+                <TextBlock Grid.Row="8" Grid.Column="1" Text="{Binding SelectedRun.BestSolutionFoundAt}" Margin="5,0,0,0" HorizontalAlignment="Right"/>
+                <TextBlock Grid.Row="9" Grid.Column="0">BestSolution:</TextBlock>
+                <TextBlock Grid.Row="9" Grid.Column="1" Text="{Binding SelectedRun.BestSolution}" TextWrapping="Wrap" Margin="5,0,0,0" HorizontalAlignment="Right" MaxWidth="100"/>
             </Grid>
         </Grid>
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs	(revision 12781)
@@ -30,5 +30,4 @@
     public partial class MainWindow : Window
     {
-        private BackgroundWorker worker = new BackgroundWorker();
         private EvaluationViewModel vm;
 
@@ -42,20 +41,9 @@
             CenterWindowOnScreen();
             this.DataContext = vm = new EvaluationViewModel();
-            vm.MaxLen = 50;
-            vm.MaxEvaluations = 250000;
-            vm.NrRuns = 1;
-            vm.CurrentRunString = "0/1";
-            vm.Threads = 6;
+            vm.MaxLen = 100;
+            vm.MaxEvaluations = 1000000;
+            vm.NrRuns = 10;
             vm.VerticalAxisString = "SolutionQuality";
             vm.HorizontalAxisString = "Iteration";
-            this.worker.WorkerSupportsCancellation = true;
-            this.worker.DoWork += worker_DoWork;
-            this.worker.ProgressChanged += worker_ProgressChanged;
-            this.worker.RunWorkerCompleted += worker_RunWorkerCompleted;
-
-            ////updateCollectionTimer = new DispatcherTimer();
-            ////updateCollectionTimer.Interval = TimeSpan.FromMilliseconds(100);
-            ////updateCollectionTimer.Tick += updateCollectionTimer_Tick;
-            ////updateCollectionTimer.Start();
         }
 
@@ -70,14 +58,80 @@
         }
 
-        ////void updateCollectionTimer_Tick(object sender, EventArgs e)
-        ////{
-        ////    while (newStats.Count > 0)
-        ////    {
-        ////        EvaluationStat stat = newStats.Pop();
-        ////        stats.Add(stat);
-        ////    }
-        ////}
-
-        void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+        private void DrawLineChart(Run run)
+        {
+            List<FoundSolution> solutions = new List<FoundSolution>(run.FoundSolutions);
+
+            if (run.BestSolutionFoundAt < run.Evaluations)
+            {
+                solutions.Add(new FoundSolution(run.EndTime, run.Evaluations, run.BestQuality, run.BestSolution));
+            }
+
+            var ds = new EnumerableDataSource<FoundSolution>(solutions);
+
+
+            ds.SetXMapping(x => x.Iteration);
+            ds.SetYMapping(y => y.Quality);
+
+            LineGraph graph = new LineGraph(ds);
+
+            graph.StrokeThickness = 2;
+            graph.AddToPlotter(ChartPlotter);
+        }
+
+        private void DrawTreeChart(Run run)
+        {
+            if (!string.IsNullOrEmpty(run.SvgFile))
+            {
+                treeDrawingPage.LoadDocument(run.SvgFile);
+            }
+        }
+
+        private void DoRun(Object threadContext)
+        {
+            Run run = (Run)threadContext;
+            run.RunState = RunState.Running;
+            run.StartTime = DateTime.Now;
+
+            run.Solver.Run(run.MaxEvaluations);
+
+            run.EndTime = DateTime.Now;
+            run.RunState = RunState.Analyzing;
+
+            if (run.FoundSolutions.Count > 0)
+            {
+                if (run.Solver is MonteCarloTreeSearch)
+                {
+                    MonteCarloTreeSearch mctsSolver = (MonteCarloTreeSearch)run.Solver;
+
+                    run.TreeInfos = mctsSolver.GetTreeInfos();
+
+                    //byte[] output = mctsSolver.GenerateSvg();
+                    //if (output != null && output.Length > 0)
+                    //{
+                    //    run.SvgFile = string.Format("MCTS_SVG_#{0}_{1}.svg", run.RunNumber, DateTime.Now.Ticks);
+                    //    File.WriteAllBytes(run.SvgFile, mctsSolver.GenerateSvg());
+                    //}
+                }
+            }
+            run.RunState = RunState.Finished;
+            lock (vm.CompletedRuns)
+            {
+                int completed = 0;
+                foreach (Run r in vm.Runs)
+                {
+                    if (r.RunState == RunState.Finished)
+                    {
+                        completed++;
+                    }
+                }
+                vm.CompletedRuns = string.Format("{0}/{1}", completed, vm.Runs.Count);
+                if (completed == vm.NrRuns)
+                {
+                    Dispatcher.Invoke(AllRunsFinished);
+                }
+            }
+        }
+
+        private void AllRunsFinished()
         {
             ButtonRun.IsEnabled = true;
@@ -85,39 +139,9 @@
             TextBoxMaxLen.IsEnabled = true;
             TextBoxRuns.IsEnabled = true;
-            TextBoxThreads.IsEnabled = true;
-        }
-
-        private void DrawCharts(Run run)
-        {
-            ClearChart();
-
-            var ds = new EnumerableDataSource<EvaluationStat>(run.EvaluationStats);
-            ds.SetXMapping(x => x.Iteration);
-            ds.SetYMapping(y => y.CurrentBestQuality);
-
-            LineGraph graph = new LineGraph(ds);
-
-            graph.StrokeThickness = 2;
-            graph.AddToPlotter(ChartPlotter);
-
-            DrawTreeChart(run);
-        }
-
-        private void DrawTreeChart(Run run)
-        {
-            if (!string.IsNullOrEmpty(run.SvgFile))
-            {
-                treeDrawingPage.LoadDocument(run.SvgFile);
-            }
-        }
-
-
-        void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
-        {
-            Debug.WriteLine(e.UserState);
-        }
-
-        void worker_DoWork(object sender, DoWorkEventArgs e)
-        {
+        }
+
+        private void StartRuns()
+        {
+            vm.CompletedRuns = string.Format("0/{0}", vm.NrRuns);
 
             Type algorithmType = vm.SelectedAlgorithm;
@@ -143,17 +167,13 @@
             }
 
-            vm.BestKnownQuality = problem.BestKnownQuality(vm.MaxLen);
-
             for (int i = 0; i < vm.NrRuns; i++)
             {
-                vm.CurrentRunString = string.Format("{0}/{1}", i + 1, vm.NrRuns);
-                vm.Evaluations = 0;
-                vm.CurrentBestQuality = 0;
-
-                List<EvaluationStat> stats = new List<EvaluationStat>();
-
                 ISolver solver = null;
 
-                if (algorithmType == typeof(MonteCarloTreeSearch))
+                if (algorithmType == typeof(MonteCarloTreeSearch_PruneLeaves))
+                {
+                    solver = new MonteCarloTreeSearch_PruneLeaves(problem, vm.MaxLen, random, policyInstance, new RandomSimulation(problem, random, vm.MaxLen));
+                }
+                else if (algorithmType == typeof(MonteCarloTreeSearch))
                 {
                     solver = new MonteCarloTreeSearch(problem, vm.MaxLen, random, policyInstance, new RandomSimulation(problem, random, vm.MaxLen));
@@ -177,70 +197,34 @@
                 }
 
-                solver.FoundNewBestSolution += (sentence, quality) =>
-                {
-                    vm.BestSolutionFoundAt = vm.Evaluations;
-                    vm.BestSolution = sentence;
-                };
-                solver.SolutionEvaluated += (sentence, quality) =>
-                {
-                    vm.Evaluations++;
-                    if (vm.CurrentBestQuality < quality)
-                    {
-                        vm.CurrentBestQuality = quality;
-                    }
-                    stats.Add(new EvaluationStat(DateTime.Now, vm.Evaluations, quality, vm.CurrentBestQuality));
-                };
-
-                solver.Run(vm.MaxEvaluations);
-
-
-                if (stats.Count > 0)
-                {
-                    TimeSpan totalTimeNeeded = stats[stats.Count - 1].Time - stats[0].Time;
-                    vm.EvaluationsPerSec = Math.Round(vm.Evaluations / totalTimeNeeded.TotalSeconds, 2);
-
-                    TimeSpan timeForBestSolution = stats[vm.BestSolutionFoundAt - 1].Time - stats[0].Time;
-
-                    Run run = new Run(i, vm.Evaluations, vm.CurrentBestQuality, vm.BestKnownQuality,
-                        vm.BestSolutionFoundAt, vm.BestSolution, vm.EvaluationsPerSec,
-                        totalTimeNeeded, timeForBestSolution, stats);
-
-
-                    MonteCarloTreeSearch mctsSolver = null;
-                    if (algorithmType == typeof(MonteCarloTreeSearch))
-                    {
-                        mctsSolver = (MonteCarloTreeSearch)solver;
-
-                        run.TreeInfos = mctsSolver.GetTreeInfos();
-
-                        byte[] output = mctsSolver.GenerateSvg();
-                        if (output.Length > 0)
-                        {
-                            run.SvgFile = string.Format("MCTS_SVG_#{0}_{1}.svg", i, DateTime.Now.Ticks);
-                            File.WriteAllBytes(run.SvgFile, mctsSolver.GenerateSvg());
-                        }
-                    }
-
-                    Dispatcher.BeginInvoke(new Action(() => vm.Runs.Add(run)));
-                }
-            }
-        }
-
-        private void ClearChart()
+                Run run = new Run(problem, policyInstance, solver, i + 1, vm.MaxEvaluations, vm.MaxLen);
+
+                vm.Runs.Add(run);
+
+                ThreadPool.QueueUserWorkItem(DoRun, run);
+            }
+        }
+
+        private void ClearLineChart()
         {
             ChartPlotter.Children.RemoveAll<LineGraph>();
         }
 
+        private void ClearComparisonChart()
+        {
+            ComparisonChartPlotter.Children.RemoveAll<LineGraph>();
+        }
+
         private void ButtonRun_OnClick(object sender, RoutedEventArgs e)
         {
-            ClearChart();
+            ClearLineChart();
+            ClearComparisonChart();
+
             vm.Runs.Clear();
-            vm.CurrentRun = null;
+            vm.SelectedRun = null;
             ButtonRun.IsEnabled = false;
             TextBoxMaxEvaluations.IsEnabled = false;
             TextBoxMaxLen.IsEnabled = false;
             TextBoxRuns.IsEnabled = false;
-            TextBoxThreads.IsEnabled = false;
-            worker.RunWorkerAsync();
+            StartRuns();
         }
 
@@ -264,10 +248,10 @@
         private void ButtonStop_OnClick(object sender, RoutedEventArgs e)
         {
-            worker.CancelAsync();
+            //worker.CancelAsync();
         }
 
         private void ComboBoxAlgorithms_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            if (vm.SelectedAlgorithm == typeof(MonteCarloTreeSearch))
+            if (vm.SelectedAlgorithm == typeof(MonteCarloTreeSearch) || vm.SelectedAlgorithm == typeof(MonteCarloTreeSearch_PruneLeaves))
             {
                 ComboBoxPolicies.IsEnabled = true;
@@ -293,9 +277,31 @@
         private void ListBoxRuns_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
         {
+            if (vm.SelectedRun != null)
+            {
+                vm.SelectedRun.Solver.FoundNewBestSolution -= SelectedRun_FoundNewBestSolution;
+            }
             if (ListBoxRuns.SelectedItem != null)
             {
-                vm.CurrentRun = (Run)ListBoxRuns.SelectedItem;
-                DrawCharts(vm.CurrentRun);
-            }
+                vm.SelectedRun = (Run)ListBoxRuns.SelectedItem;
+
+                vm.SelectedRun.Solver.FoundNewBestSolution += SelectedRun_FoundNewBestSolution;
+
+                ClearLineChart();
+                DrawLineChart(vm.SelectedRun);
+                //DrawTreeChart(vm.SelectedRun);
+            }
+            else
+            {
+                vm.SelectedRun = null;
+            }
+        }
+
+        void SelectedRun_FoundNewBestSolution(string arg1, double arg2)
+        {
+            Dispatcher.BeginInvoke(new Action(() =>
+            {
+                ClearLineChart();
+                DrawLineChart(vm.SelectedRun);
+            }));
         }
 
@@ -349,5 +355,5 @@
         private void LoadButton_OnClick(object sender, RoutedEventArgs e)
         {
-           LoadFromFile();
+            LoadFromFile();
         }
 
@@ -355,22 +361,4 @@
         {
             SaveToFile();
-        }
-
-        private void TabControlRunComparison_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-            ////if (TabControlRunComparison.SelectedItem == TabItemChartRunComparison)
-            ////{
-            ////    ComparisonChartPlotter.Children.RemoveAll<LineGraph>();
-
-            ////    var ds = new EnumerableDataSource<EvaluationStat>(run.EvaluationStats);
-            ////    ds.SetXMapping(x => x.Iteration);
-            ////    ds.SetYMapping(y => y.CurrentBestQuality);
-
-            ////    LineGraph graph = new LineGraph(ds);
-
-            ////    graph.StrokeThickness = 2;
-            ////    graph.AddToPlotter(ChartPlotter);
-
-            ////}
         }
     }
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Run.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Run.cs	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/Run.cs	(revision 12781)
@@ -1,9 +1,22 @@
-﻿using System;
+﻿using HeuristicLab.Algorithms.Bandits;
+using HeuristicLab.Algorithms.GrammaticalOptimization;
+using HeuristicLab.Algorithms.MonteCarloTreeSearch.Base;
+using HeuristicLab.Problems.GrammaticalOptimization;
+using System;
 using System.Collections.Generic;
-using HeuristicLab.Algorithms.MonteCarloTreeSearch.Base;
+using System.ComponentModel;
 
 namespace Evaluation
 {
-    public class Run
+
+    public enum RunState
+    {
+        NotStarted,
+        Running,
+        Analyzing,
+        Finished
+    }
+
+    public class Run : INotifyPropertyChanged
     {
         public Run()
@@ -12,38 +25,264 @@
         }
 
-        public Run(int runNumber, int evaluations, double bestSolutionQuality, double bestKnownQuality,
-            int bestSolutionFoundAt, string bestSolution,
-            double evaluationsPerSecond, TimeSpan totalTime, TimeSpan bestSolutionTime,
-            List<EvaluationStat> evaluationStats)
-        {
+        public Run(ISymbolicExpressionTreeProblem problem, IBanditPolicy banditPolicy, ISolver solver, int runNumber,
+            int maxEvaluations, int maxLen)
+        {
+            Problem = problem;
+            BanditPolicy = banditPolicy;
+            Solver = solver;
             RunNumber = runNumber;
-            Evaluations = evaluations;
-            BestSolutionQuality = bestSolutionQuality;
-            BestKnownQuality = bestKnownQuality;
-            BestSolutionFoundAt = bestSolutionFoundAt;
-            BestSolution = bestSolution;
-            EvaluationsPerSecond = evaluationsPerSecond;
-            TotalTime = totalTime;
-            BestSolutionTime = bestSolutionTime;
-            EvaluationStats = evaluationStats;
-        }
-
-        public int RunNumber { get; set; }
-        public int Evaluations { get; set; }
-        public double BestSolutionQuality { get; set; }
-
-        public string BestSolution { get; set; }
-
-        public double BestKnownQuality { get; set; }
-        public int BestSolutionFoundAt { get; set; }
-
-        public double EvaluationsPerSecond { get; set; }
-        public TimeSpan TotalTime { get; set; }
-        public TimeSpan BestSolutionTime { get; set; }
-        public List<EvaluationStat> EvaluationStats { get; set; }
+            MaxEvaluations = maxEvaluations;
+            MaxLen = maxLen;
+
+            Evaluations = 0;
+            BestQuality = double.MinValue;
+            RunState = RunState.NotStarted;
+            FoundSolutions = new List<FoundSolution>();
+
+            BestKnownQuality = problem.BestKnownQuality(maxLen);
+            solver.SolutionEvaluated += (sentence, quality) =>
+            {
+                Evaluations++;
+                if (quality > BestQuality)
+                {
+                    BestQuality = quality;
+                    BestSolution = sentence;
+                    BestSolutionFoundAt = evaluations;
+                    FoundSolutions.Add(new FoundSolution(DateTime.Now, Evaluations, quality, sentence));
+                }
+            };
+        }
+
+        private ISymbolicExpressionTreeProblem problem;
+
+        public ISymbolicExpressionTreeProblem Problem
+        {
+            get { return this.problem; }
+            set
+            {
+                this.problem = value;
+                this.OnPropertyChanged("Problem");
+            }
+        }
+
+        private IBanditPolicy banditPolicy;
+
+        public IBanditPolicy BanditPolicy
+        {
+            get { return this.banditPolicy; }
+            set
+            {
+                this.banditPolicy = value;
+                this.OnPropertyChanged("BanditPolicy");
+            }
+        }
+
+        private ISolver solver;
+
+        public ISolver Solver
+        {
+            get { return this.solver; }
+            set
+            {
+                this.solver = value;
+                this.OnPropertyChanged("Solver");
+            }
+        }
+
+        private int runNumber;
+
+        public int RunNumber
+        {
+            get { return this.runNumber; }
+            set
+            {
+                this.runNumber = value;
+                this.OnPropertyChanged("RunNumber");
+            }
+        }
+
+        private int maxEvaluations;
+
+        public int MaxEvaluations
+        {
+            get { return this.maxEvaluations; }
+            set
+            {
+                this.maxEvaluations = value;
+                this.OnPropertyChanged("MaxEvaluations");
+            }
+        }
+
+        private int maxLen;
+
+        public int MaxLen
+        {
+            get { return this.maxLen; }
+            set
+            {
+                this.maxLen = value;
+                this.OnPropertyChanged("MaxLen");
+            }
+        }
+
+        private int evaluations;
+
+        public int Evaluations
+        {
+            get { return this.evaluations; }
+            set
+            {
+                this.evaluations = value;
+                this.OnPropertyChanged("Evaluations");
+                if (endTime > startTime)
+                {
+                    // endTime is set...
+                    EvaluationsPerSecond = Math.Round(evaluations / TotalTime.TotalSeconds, 2);
+                }
+                else if (startTime > endTime)
+                {
+                    // only startTime is set...
+                    TimeSpan currentTimeNeeded = DateTime.Now - startTime;
+                    EvaluationsPerSecond = Math.Round(evaluations / currentTimeNeeded.TotalSeconds, 2);
+                }
+            }
+        }
+
+        private double bestQuality;
+
+        public double BestQuality
+        {
+            get { return this.bestQuality; }
+            set
+            {
+                this.bestQuality = value;
+                this.OnPropertyChanged("BestQuality");
+            }
+        }
+
+        private string bestSolution;
+
+        public string BestSolution
+        {
+            get { return this.bestSolution; }
+            set
+            {
+                this.bestSolution = value;
+                this.OnPropertyChanged("BestSolution");
+            }
+        }
+
+        private double bestKnownQuality;
+
+        public double BestKnownQuality
+        {
+            get { return this.bestKnownQuality; }
+            set
+            {
+                this.bestKnownQuality = value;
+                this.OnPropertyChanged("BestKnownQuality");
+            }
+        }
+
+        private int bestSolutionFoundAt;
+
+        public int BestSolutionFoundAt
+        {
+            get { return this.bestSolutionFoundAt; }
+            set
+            {
+                this.bestSolutionFoundAt = value;
+                this.OnPropertyChanged("BestSolutionFoundAt");
+            }
+        }
+
+        private double evaluationsPerSecond;
+
+        public double EvaluationsPerSecond
+        {
+            get { return this.evaluationsPerSecond; }
+            set
+            {
+                this.evaluationsPerSecond = value;
+                this.OnPropertyChanged("EvaluationsPerSecond");
+            }
+        }
+
+        private DateTime startTime;
+
+        public DateTime StartTime
+        {
+            get { return this.startTime; }
+            set
+            {
+                this.startTime = value;
+                this.OnPropertyChanged("StartTime");
+            }
+        }
+
+        private DateTime endTime;
+
+        public DateTime EndTime
+        {
+            get { return this.endTime; }
+            set
+            {
+                this.endTime = value;
+                this.OnPropertyChanged("EndTime");
+                TotalTime = EndTime - StartTime;
+            }
+        }
+
+        private TimeSpan totalTime;
+
+        public TimeSpan TotalTime
+        {
+            get { return this.totalTime; }
+            set
+            {
+                this.totalTime = value;
+                this.OnPropertyChanged("TotalTime");
+            }
+        }
+
+        private TimeSpan bestSolutionTime;
+
+        public TimeSpan BestSolutionTime
+        {
+            get { return this.bestSolutionTime; }
+            set
+            {
+                this.bestSolutionTime = value;
+                this.OnPropertyChanged("BestSolutionTime");
+            }
+        }
+
+        public List<FoundSolution> FoundSolutions { get; set; }
 
         public string SvgFile { get; set; }
 
-        public TreeInfos TreeInfos { get; set; }
+        private TreeInfos treeInfos;
+
+        public TreeInfos TreeInfos
+        {
+            get { return this.treeInfos; }
+            set
+            {
+                this.treeInfos = value;
+                this.OnPropertyChanged("TreeInfos");
+            }
+        }
+
+        private RunState runState;
+
+        public RunState RunState
+        {
+            get { return this.runState; }
+            set
+            {
+                this.runState = value;
+                this.OnPropertyChanged("RunState");
+            }
+        }
 
         public override string ToString()
@@ -51,4 +290,16 @@
             return string.Format("Run #{0}", this.RunNumber);
         }
+
+        #region INotifyPropertyChanged members
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        protected void OnPropertyChanged(string propertyName)
+        {
+            if (PropertyChanged != null)
+                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+        }
+
+        #endregion INotifyPropertyChanged members
     }
 }
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/ViewModel/EvaluationViewModel.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/ViewModel/EvaluationViewModel.cs	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/ViewModel/EvaluationViewModel.cs	(revision 12781)
@@ -1,4 +1,3 @@
-﻿using System.Collections.ObjectModel;
-using HeuristicLab.Algorithms.Bandits.BanditPolicies;
+﻿using HeuristicLab.Algorithms.Bandits.BanditPolicies;
 using HeuristicLab.Algorithms.GeneticProgramming;
 using HeuristicLab.Algorithms.GrammaticalOptimization;
@@ -7,9 +6,7 @@
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using HeuristicLab.Problems.GrammaticalOptimization.SymbReg;
 
 namespace Evaluation.ViewModel
@@ -85,40 +82,4 @@
         }
 
-        private double bestKnownQuality;
-
-        public double BestKnownQuality
-        {
-            get { return this.bestKnownQuality; }
-            set
-            {
-                this.bestKnownQuality = value;
-                this.OnPropertyChanged("BestKnownQuality");
-            }
-        }
-
-        private double currentBestQuality;
-
-        public double CurrentBestQuality
-        {
-            get { return this.currentBestQuality; }
-            set
-            {
-                this.currentBestQuality = value;
-                this.OnPropertyChanged("CurrentBestQuality");
-            }
-        }
-
-        private int evaluations;
-
-        public int Evaluations
-        {
-            get { return this.evaluations; }
-            set
-            {
-                this.evaluations = value;
-                this.OnPropertyChanged("Evaluations");
-            }
-        }
-
         private int nrRuns;
 
@@ -129,12 +90,4 @@
         }
 
-        private int threads;
-
-        public int Threads
-        {
-            get { return this.threads; }
-            set { this.threads = value; this.OnPropertyChanged("Threads"); }
-        }
-
         private int maxLen;
 
@@ -193,52 +146,4 @@
         }
 
-        private string currentRunString;
-
-        public string CurrentRunString
-        {
-            get { return this.currentRunString; }
-            set
-            {
-                currentRunString = value;
-                this.OnPropertyChanged("CurrentRunString");
-            }
-        }
-
-        private double evaluationsPerSec;
-
-        public double EvaluationsPerSec
-        {
-            get { return this.evaluationsPerSec; }
-            set
-            {
-                evaluationsPerSec = value;
-                this.OnPropertyChanged("EvaluationsPerSec");
-            }
-        }
-
-        private int bestSolutionFoundAt;
-
-        public int BestSolutionFoundAt
-        {
-            get { return this.bestSolutionFoundAt; }
-            set
-            {
-                bestSolutionFoundAt = value;
-                this.OnPropertyChanged("BestSolutionFoundAt");
-            }
-        }
-
-        private string bestSolution;
-
-        public string BestSolution
-        {
-            get { return this.bestSolution; }
-            set
-            {
-                bestSolution = value;
-                this.OnPropertyChanged("BestSolution");
-            }
-        }
-
         private ObservableCollection<Run> runs = new ObservableCollection<Run>();
 
@@ -253,20 +158,25 @@
         }
 
-        private Run currentRun;
-
-        public Run CurrentRun
-        {
-            get { return this.currentRun; }
-            set
-            {
-                currentRun = value;
-                if (currentRun != null)
-                {
-                    Evaluations = currentRun.Evaluations;
-                    BestKnownQuality = currentRun.BestKnownQuality;
-                    CurrentBestQuality = currentRun.BestSolutionQuality;
-                    EvaluationsPerSec = currentRun.EvaluationsPerSecond;
-                }
-                this.OnPropertyChanged("CurrentRun");
+        private Run selectedRun;
+
+        public Run SelectedRun
+        {
+            get { return this.selectedRun; }
+            set
+            {
+                selectedRun = value;
+                this.OnPropertyChanged("SelectedRun");
+            }
+        }
+
+        private string completedRuns;
+
+        public string CompletedRuns
+        {
+            get { return this.completedRuns; }
+            set
+            {
+                completedRuns = value;
+                this.OnPropertyChanged("CompletedRuns");
             }
         }
@@ -305,8 +215,9 @@
             this.algorithms.Add(typeof(SequentialSearch));
             this.algorithms.Add(typeof(MonteCarloTreeSearch));
+            this.algorithms.Add(typeof(MonteCarloTreeSearch_PruneLeaves));
             this.algorithms.Add(typeof(StandardGP));
             this.algorithms.Add(typeof(OffspringSelectionGP));
 
-            this.selectedAlgorithm = typeof(MonteCarloTreeSearch);
+            this.selectedAlgorithm = typeof(MonteCarloTreeSearch_PruneLeaves);
         }
 
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/GVedit.html
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/GVedit.html	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/GVedit.html	(revision 12781)
@@ -0,0 +1,305 @@
+<html>
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=Generator content="Microsoft Word 11 (filtered)">
+<title>GVedit Help</title>
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{margin:0in;
+	margin-bottom:.0001pt;
+	font-size:12.0pt;
+	font-family:"Times New Roman";}
+@page Section1
+	{size:8.5in 11.0in;
+	margin:1.0in 1.25in 1.0in 1.25in;}
+div.Section1
+	{page:Section1;}
+-->
+</style>
+
+</head>
+
+<body lang=EN-US>
+
+<div class=Section1>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u>Introduction</u></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'>GVedit<span style='color:black'> is a
+Graphviz tool for creating, viewing, editing and processing DOT files. It
+allows users to set attributes of graphs with dialogue boxes and save them
+for future use. GVedit users can also take advantage of the simple 
+instant previewing feature of the program.</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'>Menu system</span></u></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>GVedit's main menu bar
+provides basic file options such as <b>Open</b>, <b>Save</b>, <b>Save As</b> and simple editing
+operations such as <b>Cut</b>, <b>Copy</b> and <b>Paste</b>. Most of the common commands
+also have standard keyboard shortcuts.
+Below you will find a list of the menu items and brief information on
+each of them.</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+<p class=MsoNormal><b><span style='color:black'>File:</span></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>New: Creates a blank text
+window. You can use it to write a description of a graph in the DOT language.
+New graphs are not saved to disk until you save them manually.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Open: Opens a file
+dialogue box to select and load a DOT file into the editor. Each file is opened in a
+new window and does not affect other open graphs.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Save: Saves the active
+graph to disk. If the active graph is new and does not have a name, 
+it opens a <b>Save As</b> dialogue to allow you
+to specify the file's name before saving.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Save as: Opens a <b>Save As</b>
+dialogue to save the active graph. You can save a graph under different names but
+you will always be working with the most recently saved graph.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+Close: Closes the active graph window. If there are any unsaved changes,
+you get a dialogue box asking if you want to
+save the changes before closing the graph.</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal><b><span style='color:black'>Edit:</span></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Undo : This command
+rolls back the last thing that you have done within the active graph. </span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Cut : Removes selected
+text and keeps it in the clipboard. </span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Copy: Copies selected
+text to the clipboard. </span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+Paste: Inserts the text from the clipboard into the cursor position on the 
+active graph.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Find: Opens the find
+dialogue box to allow you to locate desired text in a graph.</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+<p class=MsoNormal><b><span style='color:black'>Graphviz</span></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Run: Processes the active
+graph with the last attributes that were used for it. If the active graph has
+never been processed before, it opens the settings window.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Settings: Opens the
+settings window. Details of this window are given below.
+</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+<p class=MsoNormal><b><span style='color:black'>View</span></b></p>
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Cascade:
+Sets the style for handling multiple windows to cascade, in which each
+new window overlaps the previous one.
+</span></p>
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Tile:
+Sets the style for handling multiple windows to tiling, in which the
+open graph windows partition the root window. 
+</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+<p class=MsoNormal><b><span style='color:black'>Help</span></b></p>
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+Help: Opens a manual page describing how to use this program.
+</span></p>
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+Graphviz on net: Opens a browser window on the Graphviz home page.
+</span></p>
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+About GVedit: Provides version information about the program.
+</span></p>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'>Tool bar</span></u></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>Under the menu bar,
+there is a toolbar with five buttons on it. These buttons are nothing but shortcuts
+to some menu items. Each button has a tool tip attached to it to
+indicate its purpose.</span></p>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'><span style='text-decoration:none'>&nbsp;</span></span></u></b></p>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'>Working with multiple graphs; the active graph</span></u></b><span
+style='color:black'>.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+GVedit allows you to have multiple graphs open at the same time. At any
+time, there is a single active graph. 
+Anything you do using either the GVedit menus or the settings window affects the
+active graph. When you go to the settings window, you always see the 
+settings of active graph.
+The settings of each graph are maintained separately.
+</span></p>
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+To make a graph active, click on its window.
+The background of the active graph window is white 
+while all others are gray. 
+</span></p>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'><span style='text-decoration:none'>&nbsp;</span></span></u></b></p>
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'>Settings window</span></u></b></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+With the settings window,
+you can select the layout engine, set the output type and file,
+and set any attributes that are available with the Graphviz release 
+installed on your computer.</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'><b>Layout engine:</b>
+Graphviz provides five different graph layouts. You can select
+the one which best fits your needs. More information about these layouts 
+can be found at the <A HREF="http://www.graphviz.org">Graphviz home page</A>
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'><b>Output file name:</b>
+This field allows you to specify the output file name. 
+You can either type in the name, or use the
+small button by the text box to open a file
+dialogue box.
+This field corresponds to the o option of Graphviz. 
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><b><span style='color:black'>Output
+file type:</span></b><span style='color:black'> This drop down list allows 
+you to select the output file type. The output file name's extension is changed
+accordingly.
+This field corresponds to the T option of Graphviz. 
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><b><span style='color:black'>Graphviz
+bin folder:</span></b><span style='color:black'>You usually do not need to
+enter anything here. During the Graphviz installation, locations of the Graphviz
+files are stored in the registry and GVedit retrieves it from there. If, 
+for some reason, Graphviz files are not where they are supposed to be 
+and GVedit can not
+find them, you can edit this information manually.
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><b><span style='color:black'>
+Preview Output file:</span></b><span style='color:black'> 
+If this box is checked,
+GVedit creates a low-quality preview of the output and shows it in a 
+separate window. It is a convenient way to preview the results without 
+executing another viewing program.
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><b><span style='color:black'>
+Apply cairo filter:</span></b><span style='color:black'> 
+If this output format is supported by the cairo library, this box becomes
+active. If checked, output will be generated using the cairo library
+rather than the default renderer. 
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><b><span style='color:black'>Attributes:</span></b><span style='color:black'>
+On the lower half of the settings window, you will see two dropdown lists,
+one small text box, and a larger text editing area. GVedit processes the
+contents of the large box as additional, generic graph, node or edge attributes.
+(These correspond to the G, N, and E command-line options of Graphviz.) 
+You can either type directly in the large text box,
+or use the drop down lists to pick
+an allowed scope and one of the common attribute names.
+For details of these attributes, refer to the
+<A HREF="http://www.graphviz.org/doc/info/attrs.html">page of Graphviz attributes.</A>
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+If you specify an attribute using the drop down lists, you need to click on the
+<b>Add</b> button to register the attribute.
+If you do not click on 
+<b>Add</b> button, the attribute that you entered will not be 
+added to the large box, hence will not be processed.
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>As an
+example, assume that we would like to have a graph drawn 
+with a green background.
+First, click on the scope list and select <b>graph</b>; 
+then click on the name list and
+select <b>bgcolor</b>; and then type <tt>green</tt> to the value box. 
+Finally, click on the <b>Add</b> button to send the attribute to large box. 
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+Belowe the <b>Add</b> button is a <b>Help</b> button. Clicking on this
+will open a browser window on the Graphviz page describing the supported
+attributes.
+</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>
+Under the large box, there are 3 small buttons, plus 
+<b>Cancel</b> and <b>OK</b> buttons. The first button is used to
+clear the attributes box; 
+the second one is used to load an existing text file into the attributes box;
+and the last one is used to save the attributes to a text file for later use. 
+The <b>Cancel</b> button closes the window without processing anything; 
+the <b>OK</b> button processes the
+active document file with the settings on the screen and closes the settings
+window. If you check the preview check box, you will see the preview of the
+graph layout on the screen.</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal align=center style='text-align:center'><b><u><span
+style='color:black'>Console window</span></u></b></p>
+
+<p class=MsoNormalstyle='text-indent:.5in'><span style='color:black'>
+At the bottom of the
+main window, there is a console window where you can see the results of your
+actions. This provides a trace of your layout actions, showing the
+Graphviz command corresponding to the active graph's settings. It also
+displays warnings from GVedit, as well as the output of the 
+executed Graphviz programs. 
+By right clicking on the console window, you will get a menu providing some
+additional functions, such as clearing or saving the console logs.</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal style='text-indent:.5in'><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+<p class=MsoNormal><span style='color:black'> </span></p>
+
+<p class=MsoNormal><span style='color:black'>&nbsp;</span></p>
+
+</div>
+
+</body>
+
+</html>
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/Graphviz.ini
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/Graphviz.ini	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/Graphviz.ini	(revision 12781)
@@ -0,0 +1,2 @@
+[Graphviz]
+Version=XXX
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/Settings.ini
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/Settings.ini	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/Settings.ini	(revision 12781)
@@ -0,0 +1,8 @@
+[Settings]
+Layout=0
+Output=9
+Preview=1
+InitialDir1=
+InitialDir2=
+InitialDir3=
+binPath=C:\Program Files\Graphviz2.24\bin\
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/config6
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/config6	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/config6	(revision 12781)
@@ -0,0 +1,273 @@
+# This file was generated by "dot -c" at time of install.
+
+# You may temporarily disable a plugin by removing or commenting out
+# a line in this file, or you can modify its "quality" value to affect
+# default plugin selection.
+
+# Manual edits to this file **will be lost** on upgrade.
+
+gvplugin_core.dll core {
+	device {
+		dot:dot 1
+		gv:dot 1
+		canon:dot 1
+		plain:dot 1
+		plain-ext:dot 1
+		xdot:xdot 1
+		xdot1.2:xdot 1
+		xdot1.4:xdot 1
+	}
+	device {
+		fig:fig 1
+	}
+	device {
+		ismap:map 1
+		cmap:map 1
+		imap:map 1
+		cmapx:map 1
+		imap_np:map 1
+		cmapx_np:map 1
+	}
+	device {
+		ps:ps 1
+		ps2:ps 1
+		eps:ps 1
+	}
+	device {
+		svg:svg 1
+		svgz:svg 1
+	}
+	device {
+		tk:tk 1
+	}
+	device {
+		vml:vml 1
+		vmlz:vml 1
+	}
+	device {
+		pic:pic -1
+	}
+	device {
+		pov:pov 1
+	}
+	render {
+		dot 1
+		xdot 1
+	}
+	render {
+		fig 1
+	}
+	render {
+		map 1
+	}
+	render {
+		ps 1
+	}
+	render {
+		svg 1
+	}
+	render {
+		tk 1
+	}
+	render {
+		vml 1
+	}
+	render {
+		pic -1
+	}
+	render {
+		pov 1
+	}
+	loadimage {
+		png:svg 1
+		gif:svg 1
+		jpeg:svg 1
+		jpe:svg 1
+		jpg:svg 1
+		png:fig 1
+		gif:fig 1
+		jpeg:fig 1
+		jpe:fig 1
+		jpg:fig 1
+		png:vrml 1
+		gif:vrml 1
+		jpeg:vrml 1
+		jpe:vrml 1
+		jpg:vrml 1
+		eps:ps 1
+		ps:ps 1
+		(lib):ps 1
+		png:map 1
+		gif:map 1
+		jpeg:map 1
+		jpe:map 1
+		jpg:map 1
+		ps:map 1
+		eps:map 1
+		svg:map 1
+		png:dot 1
+		gif:dot 1
+		jpeg:dot 1
+		jpe:dot 1
+		jpg:dot 1
+		ps:dot 1
+		eps:dot 1
+		svg:dot 1
+		png:xdot 1
+		gif:xdot 1
+		jpeg:xdot 1
+		jpe:xdot 1
+		jpg:xdot 1
+		ps:xdot 1
+		eps:xdot 1
+		svg:xdot 1
+		svg:svg 1
+		png:vml 1
+		gif:vml 1
+		jpeg:vml 1
+		jpe:vml 1
+		jpg:vml 1
+		gif:tk 1
+	}
+}
+gvplugin_dot_layout.dll dot_layout {
+	layout {
+		dot 0
+	}
+}
+gvplugin_gd.dll gd {
+	render {
+		gd 1
+	}
+	render {
+		vrml 1
+	}
+	textlayout {
+		textlayout 2
+	}
+	loadimage {
+		gd:gd 1
+		gd2:gd 1
+		gif:gd 1
+		jpeg:gd 1
+		jpe:gd 1
+		jpg:gd 1
+		png:gd 1
+		gd:ps 1
+#FAILS		gd:lasi 1
+		gd2:ps 1
+#FAILS		gd2:lasi 1
+		gif:ps 1
+#FAILS		gif:lasi 1
+		jpeg:ps 1
+		jpg:ps 1
+		jpe:ps 1
+#FAILS		jpeg:lasi 1
+#FAILS		jpg:lasi 1
+#FAILS		jpe:lasi 1
+		png:ps 1
+#FAILS		png:lasi 1
+		gd:cairo 1
+		gd2:cairo 1
+		gif:cairo 1
+		jpeg:cairo 1
+		jpg:cairo 1
+		jpe:cairo 1
+		png:cairo -1
+	}
+	device {
+		gif:cairo 10
+		wbmp:cairo 5
+		jpe:cairo 5
+		jpeg:cairo 5
+		jpg:cairo 5
+		png:cairo 5
+		gd:cairo 5
+		gd2:cairo 5
+	}
+	device {
+		gif:gd 1
+		wbmp:gd 1
+		jpe:gd 1
+		jpeg:gd 1
+		jpg:gd 1
+		png:gd 1
+		gd:gd 1
+		gd2:gd 1
+	}
+	device {
+		vrml:vrml 1
+	}
+}
+gvplugin_gdiplus.dll gdiplus {
+	render {
+		gdiplus 1
+	}
+	textlayout {
+		textlayout 8
+	}
+	loadimage {
+		bmp:gdiplus 8
+		gif:gdiplus 8
+		jpe:gdiplus 8
+		jpeg:gdiplus 8
+		jpg:gdiplus 8
+		png:gdiplus 8
+	}
+	device {
+		metafile:gdiplus 8
+		bmp:gdiplus 8
+		emf:gdiplus 8
+		emfplus:gdiplus 8
+		gif:gdiplus 8
+		jpe:gdiplus 8
+		jpeg:gdiplus 8
+		jpg:gdiplus 8
+		png:gdiplus 8
+		tif:gdiplus 8
+		tiff:gdiplus 8
+	}
+	device {
+		bmp:cairo 8
+		gif:cairo 8
+		jpe:cairo 8
+		jpeg:cairo 8
+		jpg:cairo 8
+		png:cairo 8
+		tif:cairo 8
+		tiff:cairo 8
+	}
+}
+gvplugin_neato_layout.dll neato_layout {
+	layout {
+		neato 0
+		fdp 0
+		sfdp 0
+		twopi 0
+		circo 0
+		patchwork 0
+		osage 0
+		nop 0
+		nop1 0
+		nop2 0
+	}
+}
+gvplugin_pango.dll cairo {
+	render {
+		cairo 10
+	}
+	textlayout {
+		textlayout 10
+	}
+	loadimage {
+		png:cairo 1
+#FAILS		png:lasi 2
+		png:ps 2
+	}
+	device {
+		png:cairo 10
+		ps:cairo -10
+		pdf:cairo 10
+		svg:cairo -10
+	}
+}
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/exparse.h
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/exparse.h	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/exparse.h	(revision 12781)
@@ -0,0 +1,237 @@
+#ifndef _EXPARSE_H
+#define _EXPARSE_H
+
+/* A Bison parser, made by GNU Bison 2.4.1.  */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+   
+   This program 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.
+   
+   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+   
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+
+/* Tokens.  */
+#ifndef EXTOKENTYPE
+# define EXTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum extokentype {
+     MINTOKEN = 258,
+     INTEGER = 259,
+     UNSIGNED = 260,
+     CHARACTER = 261,
+     FLOATING = 262,
+     STRING = 263,
+     VOIDTYPE = 264,
+     ADDRESS = 265,
+     ARRAY = 266,
+     BREAK = 267,
+     CALL = 268,
+     CASE = 269,
+     CONSTANT = 270,
+     CONTINUE = 271,
+     DECLARE = 272,
+     DEFAULT = 273,
+     DYNAMIC = 274,
+     ELSE = 275,
+     EXIT = 276,
+     FOR = 277,
+     FUNCTION = 278,
+     GSUB = 279,
+     ITERATE = 280,
+     ITERATER = 281,
+     ID = 282,
+     IF = 283,
+     LABEL = 284,
+     MEMBER = 285,
+     NAME = 286,
+     POS = 287,
+     PRAGMA = 288,
+     PRE = 289,
+     PRINT = 290,
+     PRINTF = 291,
+     PROCEDURE = 292,
+     QUERY = 293,
+     RAND = 294,
+     RETURN = 295,
+     SCANF = 296,
+     SPLIT = 297,
+     SPRINTF = 298,
+     SRAND = 299,
+     SSCANF = 300,
+     SUB = 301,
+     SUBSTR = 302,
+     SWITCH = 303,
+     TOKENS = 304,
+     UNSET = 305,
+     WHILE = 306,
+     F2I = 307,
+     F2S = 308,
+     I2F = 309,
+     I2S = 310,
+     S2B = 311,
+     S2F = 312,
+     S2I = 313,
+     F2X = 314,
+     I2X = 315,
+     S2X = 316,
+     X2F = 317,
+     X2I = 318,
+     X2S = 319,
+     X2X = 320,
+     XPRINT = 321,
+     OR = 322,
+     AND = 323,
+     NE = 324,
+     EQ = 325,
+     GE = 326,
+     LE = 327,
+     RS = 328,
+     LS = 329,
+//     IN = 330,
+     UNARY = 331,
+     DEC = 332,
+     INC = 333,
+     CAST = 334,
+     MAXTOKEN = 335
+   };
+#endif
+/* Tokens.  */
+#define MINTOKEN 258
+#define INTEGER 259
+#define UNSIGNED 260
+#define CHARACTER 261
+#define FLOATING 262
+#define STRING 263
+#define VOIDTYPE 264
+#define ADDRESS 265
+#define ARRAY 266
+#define BREAK 267
+#define CALL 268
+#define CASE 269
+#define CONSTANT 270
+#define CONTINUE 271
+#define DECLARE 272
+#define DEFAULT 273
+#define DYNAMIC 274
+#define ELSE 275
+#define EXIT 276
+#define FOR 277
+#define FUNCTION 278
+#define GSUB 279
+#define ITERATE 280
+#define ITERATER 281
+#define ID 282
+#define IF 283
+#define LABEL 284
+#define MEMBER 285
+#define NAME 286
+#define POS 287
+#define PRAGMA 288
+#define PRE 289
+#define PRINT 290
+#define PRINTF 291
+#define PROCEDURE 292
+#define QUERY 293
+#define RAND 294
+#define RETURN 295
+#define SCANF 296
+#define SPLIT 297
+#define SPRINTF 298
+#define SRAND 299
+#define SSCANF 300
+#define SUB 301
+#define SUBSTR 302
+#define SWITCH 303
+#define TOKENS 304
+#define UNSET 305
+#define WHILE 306
+#define F2I 307
+#define F2S 308
+#define I2F 309
+#define I2S 310
+#define S2B 311
+#define S2F 312
+#define S2I 313
+#define F2X 314
+#define I2X 315
+#define S2X 316
+#define X2F 317
+#define X2I 318
+#define X2S 319
+#define X2X 320
+#define XPRINT 321
+#define OR 322
+#define AND 323
+#define NE 324
+#define EQ 325
+#define GE 326
+#define LE 327
+#define RS 328
+#define LS 329
+#define IN 330
+#define UNARY 331
+#define DEC 332
+#define INC 333
+#define CAST 334
+#define MAXTOKEN 335
+
+
+
+
+#if ! defined EXSTYPE && ! defined EXSTYPE_IS_DECLARED
+typedef union EXSTYPE
+{
+
+/* Line 1676 of yacc.c  */
+#line 45 "../../lib/expr/exparse.y"
+
+	struct Exnode_s*expr;
+	double		floating;
+	struct Exref_s*	reference;
+	struct Exid_s*	id;
+	Sflong_t	integer;
+	int		op;
+	char*		string;
+	void*		user;
+	struct Exbuf_s*	buffer;
+
+
+
+/* Line 1676 of yacc.c  */
+#line 226 "y.tab.h"
+} EXSTYPE;
+# define EXSTYPE_IS_TRIVIAL 1
+# define exstype EXSTYPE /* obsolescent; will be withdrawn */
+# define EXSTYPE_IS_DECLARED 1
+#endif
+
+extern EXSTYPE exlval;
+
+
+#endif /* _EXPARSE_H */
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/getopt.h
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/getopt.h	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/getopt.h	(revision 12781)
@@ -0,0 +1,37 @@
+/* $Id: getopt.h,v 1.1 2005/01/20 19:57:38 erg Exp $ $Revision: 1.1 $ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef GETOPT_H
+#define GETOPT_H
+
+/* On most systems, these are defined in unistd.h or stdlib.h,
+ * but some systems have no external definitions (UTS, SunOS 4.1),
+ * so we provide a declaration if needed.
+ */
+
+    extern int getopt(int, char *const *, const char *);
+    extern char *optarg;
+    extern int opterr, optind, optopt;
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/props.txt
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/props.txt	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/Graphviz2.38/bin/props.txt	(revision 12781)
@@ -0,0 +1,97 @@
+"Damping", "0.99", GRAPH, NEATO
+"Epsilon", "", GRAPH, NEATO
+"URL", "", ANY_ELEMENT, ALL_ENGINES
+"arrowhead", "normal", EDGE, ALL_ENGINES
+"arrowsize", "1.0", EDGE, ALL_ENGINES
+"arrowtail", "normal", EDGE, ALL_ENGINES
+"bb", "", GRAPH, ALL_ENGINES
+"bgcolor", "", GRAPH Or CLUSTER, ALL_ENGINES
+"bottomlabel", "", NODE, ALL_ENGINES
+"center", "false", GRAPH, ALL_ENGINES
+"clusterrank", "local", GRAPH, DOT
+"color", "black", EDGE Or NODE Or CLUSTER, ALL_ENGINES
+"comment", "", EDGE Or NODE Or GRAPH, ALL_ENGINES
+"compound", "false", GRAPH, DOT
+"concentrate", "false", GRAPH, DOT
+"constraint", "true", EDGE, DOT
+"decorate", "false", EDGE, ALL_ENGINES
+"dir", "forward", EDGE, ALL_ENGINES
+"distortion", "0.0", NODE, ALL_ENGINES
+"fillcolor", "lightgrey", NODE Or CLUSTER, ALL_ENGINES
+"fixedsize", "false", NODE, ALL_ENGINES
+"fontcolor", "black", EDGE Or NODE Or GRAPH Or CLUSTER, ALL_ENGINES
+"fontname", "Times-Roman", EDGE Or NODE Or GRAPH Or CLUSTER, ALL_ENGINES
+"fontpath", "", GRAPH, ALL_ENGINES
+"fontsize", "14.0", EDGE Or NODE Or GRAPH Or CLUSTER, ALL_ENGINES
+"group", "", NODE, DOT
+"headURL", "", EDGE, ALL_ENGINES
+"headlabel", "", EDGE, ALL_ENGINES
+"headport", "center", EDGE, ALL_ENGINES
+"height", "0.5", NODE, ALL_ENGINES
+"label", "", EDGE Or NODE Or GRAPH Or CLUSTER, ALL_ENGINES
+"labelangle", "-25.0", EDGE, ALL_ENGINES
+"labeldistance", "1.0", EDGE, ALL_ENGINES
+"labelfloat", "false", EDGE, ALL_ENGINES
+"labelfontcolor", "black", EDGE, ALL_ENGINES
+"labelfontname", "Times-Roman", EDGE, ALL_ENGINES
+"labelfontsize", "11.0", EDGE, ALL_ENGINES
+"labeljust", "", ANY_ELEMENT, DOT
+"labelloc", "t", GRAPH Or CLUSTER, DOT
+"layer", "", EDGE Or NODE, ALL_ENGINES
+"layers", "", GRAPH, ALL_ENGINES
+"len", "1.0", EDGE, NEATO
+"lhead", "", EDGE, DOT
+"lp", "", EDGE Or GRAPH Or CLUSTER, ALL_ENGINES
+"ltail", "", EDGE, DOT
+"margin", "", GRAPH, ALL_ENGINES
+"maxiter", "", GRAPH, NEATO
+"mclimit", "1.0", GRAPH, DOT
+"minlen", "1", EDGE, DOT
+"model", "", GRAPH, NEATO
+"nodesep", "0.25", GRAPH, DOT
+"normalize", "false", GRAPH, NEATO
+"nslimit", "", GRAPH, DOT
+"ordering", "", GRAPH, DOT
+"orientation", "0.0", NODE, ALL_ENGINES
+"orientation", "", GRAPH, ALL_ENGINES
+"overlap", "", GRAPH, NEATO
+"pack", "false", GRAPH, NEATO
+"page", "", GRAPH, ALL_ENGINES
+"pagedir", "", GRAPH, ALL_ENGINES
+"pencolor", "black", CLUSTER, ALL_ENGINES
+"peripheries", "0", NODE, ALL_ENGINES
+"pin", "false", NODE, NEATO
+"pos", "", EDGE Or NODE, ALL_ENGINES
+"quantum", "0.0", GRAPH, ALL_ENGINES
+"rank", "", SUBGRAPH, DOT
+"rankdir", "", GRAPH, DOT
+"ranksep", "", GRAPH, ALL_ENGINES
+"ratio", "", GRAPH, ALL_ENGINES
+"rects", "", NODE, ALL_ENGINES
+"regular", "false", NODE, ALL_ENGINES
+"remincross", "false", GRAPH, DOT
+"rotate", "0", GRAPH, ALL_ENGINES
+"samehead", "", EDGE, DOT
+"sametail", "", EDGE, DOT
+"samplepoints", "8", GRAPH, ALL_ENGINES
+"searchsize", "30", GRAPH, DOT
+"sep", "0.01", GRAPH, NEATO
+"shape", "ellipse", NODE, ALL_ENGINES
+"shapefile", "", NODE, ALL_ENGINES
+"showboxes", "0", EDGE Or NODE Or GRAPH, DOT
+"sides", "4", NODE, ALL_ENGINES
+"size", "", GRAPH, ALL_ENGINES
+"skew", "0.0", NODE, ALL_ENGINES
+"splines", "false", GRAPH, NEATO
+"start", "", GRAPH, ALL_ENGINES
+"style", "", EDGE Or NODE, ALL_ENGINES
+"stylesheet", "", GRAPH, ALL_ENGINES
+"tailURL", "", EDGE, ALL_ENGINES
+"taillabel", "", EDGE, ALL_ENGINES
+"tailport", "center", EDGE, ALL_ENGINES
+"toplabel", "", NODE, ALL_ENGINES
+"vertices", "", NODE, ALL_ENGINES
+"voro_margin", "0.05", GRAPH, NEATO
+"weight", "", EDGE, DOT Or NEATO
+"width", "0.75", NODE, ALL_ENGINES
+"z", "0.0", NODE, ALL_ENGINES
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/ISolver.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/ISolver.cs	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/ISolver.cs	(revision 12781)
@@ -1,7 +1,3 @@
 ﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace HeuristicLab.Algorithms.GrammaticalOptimization {
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeInfos.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeInfos.cs	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/Base/TreeInfos.cs	(revision 12781)
@@ -13,6 +13,5 @@
             
         }
-        public TreeInfos(int totalNodes, int unexpandedNodes, int expandedNodes, int leaveNodes, int deepestLevel,
-            double averageLevel, double averageChildren)
+        public TreeInfos(int totalNodes, int unexpandedNodes, int expandedNodes, int leaveNodes, int deepestLevel)
         {
             TotalNodes = totalNodes;
@@ -21,6 +20,4 @@
             LeaveNodes = leaveNodes;
             DeepestLevel = deepestLevel;
-            AverageLevel = averageLevel;
-            AverageChildren = averageChildren;
         }
 
@@ -30,6 +27,4 @@
         public int LeaveNodes { get; set; }
         public int DeepestLevel { get; set; }
-        public double AverageLevel { get; set; }
-        public double AverageChildren { get; set; }
     }
 }
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/HeuristicLab.Algorithms.MonteCarloTreeSearch.csproj
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/HeuristicLab.Algorithms.MonteCarloTreeSearch.csproj	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/HeuristicLab.Algorithms.MonteCarloTreeSearch.csproj	(revision 12781)
@@ -42,6 +42,7 @@
   <ItemGroup>
     <Compile Include="Base\TreeInfos.cs" />
+    <Compile Include="MonteCarloTreeSearch.cs" />
     <Compile Include="Simulation\ISimulation.cs" />
-    <Compile Include="MonteCarloTreeSearch.cs" />
+    <Compile Include="MonteCarloTreeSearch_PruneLeaves.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Base\TreeNode.cs" />
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch.cs	(revision 12763)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch.cs	(revision 12781)
@@ -20,13 +20,13 @@
     public class MonteCarloTreeSearch : SolverBase
     {
-        private readonly int maxLen;
-        private readonly IProblem problem;
-        private readonly IGrammar grammar;
-        private readonly Random random;
-        private readonly IBanditPolicy behaviourPolicy;
-        private readonly ISimulation simulation;
-        private TreeNode rootNode;
-        private bool isPaused = false;
-        private object pauseLock = new object();
+        protected readonly int maxLen;
+        protected readonly IProblem problem;
+        protected readonly IGrammar grammar;
+        protected readonly Random random;
+        protected readonly IBanditPolicy behaviourPolicy;
+        protected readonly ISimulation simulation;
+        protected TreeNode rootNode;
+        protected bool isPaused = false;
+        protected object pauseLock = new object();
 
         public MonteCarloTreeSearch(IProblem problem, int maxLen, Random random, IBanditPolicy behaviourPolicy,
@@ -71,26 +71,10 @@
                 string phrase = currentNode.phrase;
 
-                if (phrase.Length <= maxLen)
-                {
-                    // Version 2:
-                    if (currentNode.children != null && !currentNode.children.Any())
-                    {
-                        // already removed all child nodes so remove it too..
-                        currentNode.parent.children.Remove(currentNode);
-                        continue;
-                    }
+                if (!grammar.IsTerminal(phrase) && phrase.Length <= maxLen)
+                {
                     ExpandTreeNode(currentNode);
-                    if (currentNode.children.Any())
-                    {
-                        currentNode =
-                            currentNode.children[behaviourPolicy.SelectAction(random, currentNode.GetChildActionInfos())
-                                ];
-                    }
-                    else
-                    {
-                        // Version 2:
-                        // remove currentNode from tree..
-                        currentNode.parent.children.Remove(currentNode);
-                    }
+                    currentNode =
+                        currentNode.children[behaviourPolicy.SelectAction(random, currentNode.GetChildActionInfos())
+                            ];
                 }
                 if (currentNode.phrase.Length <= maxLen)
@@ -101,23 +85,9 @@
 
                     Propagate(currentNode, quality);
-
-                }
-            }
-        }
-
-        private bool HasNonTerminal(string phrase)
-        {
-            foreach (char symbol in phrase)
-            {
-                if (grammar.IsNonTerminal(symbol))
-                {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-
-        private void ExpandTreeNode(TreeNode treeNode)
+                }
+            }
+        }
+
+        protected void ExpandTreeNode(TreeNode treeNode)
         {
             // create children on the first visit
@@ -150,5 +120,5 @@
         }
 
-        private void Reset()
+        protected void Reset()
         {
             StopRequested = false;
@@ -157,5 +127,5 @@
         }
 
-        private void Propagate(TreeNode node, double quality)
+        protected void Propagate(TreeNode node, double quality)
         {
             var currentNode = node;
@@ -167,144 +137,158 @@
         }
 
+        private void GetTreeInfosRek(TreeInfos treeInfos, List<TreeNode> children)
+        {
+            treeInfos.TotalNodes += children.Count;
+            foreach (TreeNode child in children)
+            {
+                if (child.children != null)
+                {
+                    treeInfos.ExpandedNodes++;
+                    if (treeInfos.DeepestLevel <= child.level)
+                    {
+                        treeInfos.DeepestLevel = child.level + 1;
+                    }
+                    GetTreeInfosRek(treeInfos, child.children);
+                }
+                else
+                {
+                    if (grammar.IsTerminal(child.phrase))
+                    {
+                        treeInfos.LeaveNodes++;
+                    }
+                    else
+                    {
+                        treeInfos.UnexpandedNodes++;
+                    }
+                }
+            }
+        }
+
         public TreeInfos GetTreeInfos()
         {
-            int totalNodes = 0;
-            int unexpandedNodes = 0;
-            int expandedNodes = 0;
-            int leaveNodes = 0;
-            int deepestLevel = 0;
-            int totalLevel = 0;
-            int totalChildren = 0;
-
-            List<TreeNode> toDoNodes = new List<TreeNode>();
+            TreeInfos treeInfos = new TreeInfos();
+
             if (rootNode != null)
             {
-                toDoNodes.Add(rootNode);
-            }
-            while (toDoNodes.Any())
-            {
-                TreeNode currentNode = toDoNodes[0];
-                toDoNodes.RemoveAt(0);
-                totalNodes++;
-                if (currentNode.level > deepestLevel)
-                {
-                    deepestLevel = currentNode.level;
-                }
-                totalLevel += currentNode.level;
-
-                if (currentNode.children != null)
-                {
-                    totalChildren += currentNode.children.Count;
-                    toDoNodes.AddRange(currentNode.children);
-                    expandedNodes++;
+                treeInfos.TotalNodes++;
+                if (rootNode.children != null)
+                {
+                    treeInfos.ExpandedNodes++;
+                    treeInfos.DeepestLevel = rootNode.level + 1;
+                    GetTreeInfosRek(treeInfos, rootNode.children);
                 }
                 else
                 {
-                    if (!HasNonTerminal(currentNode.phrase))
-                    {
-                        leaveNodes++;
+                    treeInfos.DeepestLevel = rootNode.level;
+                    if (grammar.IsTerminal(rootNode.phrase))
+                    {
+                        treeInfos.LeaveNodes++;
                     }
                     else
                     {
-                        unexpandedNodes++;
-                    }
-                }
-            }
-            return new TreeInfos(totalNodes, unexpandedNodes, expandedNodes, leaveNodes, deepestLevel,
-                totalLevel / totalNodes, totalChildren / expandedNodes);
+                        treeInfos.UnexpandedNodes++;
+                    }
+                }
+            }
+            return treeInfos;
         }
 
         public byte[] GenerateSvg()
         {
-            IGetStartProcessQuery getStartProcessQuery = new GetStartProcessQuery();
-            IGetProcessStartInfoQuery getProcessStartInfoQuery = new GetProcessStartInfoQuery();
-            IRegisterLayoutPluginCommand registerLayoutPluginCommand =
-                new RegisterLayoutPluginCommand(getProcessStartInfoQuery, getStartProcessQuery);
-
-            GraphGeneration wrapper = new GraphGeneration(getStartProcessQuery,
-                getProcessStartInfoQuery,
-                registerLayoutPluginCommand);
-            wrapper.GraphvizPath = @"../../../Graphviz2.38/bin";
-            StringBuilder dotFile = new StringBuilder("digraph {");
-            dotFile.AppendLine();
-            dotFile.AppendLine("splines=ortho;");
-            dotFile.AppendLine("concentrate=true;");
-            dotFile.AppendLine("ranksep=1.2;");
-
-            List<TreeNode> toDoNodes = new List<TreeNode>();
-            if (rootNode != null)
-            {
-                toDoNodes.Add(rootNode);
-                // declare node
-                string hexColor = GetHexNodeColor(Color.White, Color.OrangeRed, rootNode.actionInfo.Value);
-
-                dotFile.AppendLine(string.Format("{0} [label=\"{1}\\n{2:0.00}/{3}\", style=filled, fillcolor=\"{4}\"]",
-                    rootNode.GetHashCode(),
-                    rootNode.phrase, rootNode.actionInfo.Value, rootNode.actionInfo.Tries, hexColor));
-            }
-
-            // to put nodes on the same level in graph
-            Dictionary<int, List<TreeNode>> levelMap = new Dictionary<int, List<TreeNode>>();
-
-            List<TreeNode> sameLevelNodes;
-
-            while (toDoNodes.Any())
-            {
-                TreeNode currentNode = toDoNodes[0];
-                toDoNodes.RemoveAt(0);
-                // put currentNode into levelMap
-                if (levelMap.TryGetValue(currentNode.level, out sameLevelNodes))
-                {
-                    sameLevelNodes.Add(currentNode);
-                }
-                else
-                {
-                    sameLevelNodes = new List<TreeNode>();
-                    sameLevelNodes.Add(currentNode);
-                    levelMap.Add(currentNode.level, sameLevelNodes);
-                }
-
-                // draw line from current node to all its children
-                if (currentNode.children != null)
-                {
-                    foreach (TreeNode childNode in currentNode.children)
-                    {
-                        toDoNodes.Add(childNode);
-                        // declare node
-
-                        string hexColor = GetHexNodeColor(Color.White, Color.OrangeRed, childNode.actionInfo.Value);
-                        dotFile.AppendLine(
-                            string.Format("{0} [label=\"{1}\\n{2:0.00}/{3}\", style=filled, fillcolor=\"{4}\"]",
-                                childNode.GetHashCode(),
-                                childNode.phrase, childNode.actionInfo.Value, childNode.actionInfo.Tries, hexColor));
-                        // add edge
-                        dotFile.AppendLine(string.Format("{0} -> {1}", currentNode.GetHashCode(),
-                            childNode.GetHashCode()));
-                    }
-                }
-            }
-
-            // set same level ranks..
-            foreach (KeyValuePair<int, List<TreeNode>> entry in levelMap)
-            {
-                dotFile.Append("{rank = same;");
-                foreach (TreeNode node in entry.Value)
-                {
-                    dotFile.Append(string.Format(" {0};", node.GetHashCode()));
-                }
-                dotFile.AppendLine("}");
-            }
-
-            dotFile.Append(" }");
-            byte[] output = wrapper.GenerateGraph(dotFile.ToString(), Enums.GraphReturnType.Svg);
-            return output;
-        }
-
-        private String HexConverter(Color c)
+            if (GetTreeInfos().TotalNodes < 1000)
+            {
+                IGetStartProcessQuery getStartProcessQuery = new GetStartProcessQuery();
+                IGetProcessStartInfoQuery getProcessStartInfoQuery = new GetProcessStartInfoQuery();
+                IRegisterLayoutPluginCommand registerLayoutPluginCommand =
+                    new RegisterLayoutPluginCommand(getProcessStartInfoQuery, getStartProcessQuery);
+
+                GraphGeneration wrapper = new GraphGeneration(getStartProcessQuery,
+                    getProcessStartInfoQuery,
+                    registerLayoutPluginCommand);
+                wrapper.GraphvizPath = @"../../../Graphviz2.38/bin";
+                StringBuilder dotFile = new StringBuilder("digraph {");
+                dotFile.AppendLine();
+                dotFile.AppendLine("splines=ortho;");
+                dotFile.AppendLine("concentrate=true;");
+                dotFile.AppendLine("ranksep=1.2;");
+
+                List<TreeNode> toDoNodes = new List<TreeNode>();
+                if (rootNode != null)
+                {
+                    toDoNodes.Add(rootNode);
+                    // declare node
+                    string hexColor = GetHexNodeColor(Color.White, Color.OrangeRed, rootNode.actionInfo.Value);
+
+                    dotFile.AppendLine(
+                        string.Format("{0} [label=\"{1}\\n{2:0.00}/{3}\", style=filled, fillcolor=\"{4}\"]",
+                            rootNode.GetHashCode(),
+                            rootNode.phrase, rootNode.actionInfo.Value, rootNode.actionInfo.Tries, hexColor));
+                }
+
+                // to put nodes on the same level in graph
+                Dictionary<int, List<TreeNode>> levelMap = new Dictionary<int, List<TreeNode>>();
+
+                List<TreeNode> sameLevelNodes;
+
+                while (toDoNodes.Any())
+                {
+                    TreeNode currentNode = toDoNodes[0];
+                    toDoNodes.RemoveAt(0);
+                    // put currentNode into levelMap
+                    if (levelMap.TryGetValue(currentNode.level, out sameLevelNodes))
+                    {
+                        sameLevelNodes.Add(currentNode);
+                    }
+                    else
+                    {
+                        sameLevelNodes = new List<TreeNode>();
+                        sameLevelNodes.Add(currentNode);
+                        levelMap.Add(currentNode.level, sameLevelNodes);
+                    }
+
+                    // draw line from current node to all its children
+                    if (currentNode.children != null)
+                    {
+                        foreach (TreeNode childNode in currentNode.children)
+                        {
+                            toDoNodes.Add(childNode);
+                            // declare node
+
+                            string hexColor = GetHexNodeColor(Color.White, Color.OrangeRed, childNode.actionInfo.Value);
+                            dotFile.AppendLine(
+                                string.Format("{0} [label=\"{1}\\n{2:0.00}/{3}\", style=filled, fillcolor=\"{4}\"]",
+                                    childNode.GetHashCode(),
+                                    childNode.phrase, childNode.actionInfo.Value, childNode.actionInfo.Tries, hexColor));
+                            // add edge
+                            dotFile.AppendLine(string.Format("{0} -> {1}", currentNode.GetHashCode(),
+                                childNode.GetHashCode()));
+                        }
+                    }
+                }
+
+                // set same level ranks..
+                foreach (KeyValuePair<int, List<TreeNode>> entry in levelMap)
+                {
+                    dotFile.Append("{rank = same;");
+                    foreach (TreeNode node in entry.Value)
+                    {
+                        dotFile.Append(string.Format(" {0};", node.GetHashCode()));
+                    }
+                    dotFile.AppendLine("}");
+                }
+
+                dotFile.Append(" }");
+                byte[] output = wrapper.GenerateGraph(dotFile.ToString(), Enums.GraphReturnType.Svg);
+                return output;
+            }
+            return null;
+        }
+
+        protected String HexConverter(Color c)
         {
             return "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
         }
 
-        private String GetHexNodeColor(Color weakColor, Color strongColor, double quality)
+        protected String GetHexNodeColor(Color weakColor, Color strongColor, double quality)
         {
             // convert quality to value between 0 and 1
Index: branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch_PruneLeaves.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch_PruneLeaves.cs	(revision 12781)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.MonteCarloTreeSearch/MonteCarloTreeSearch_PruneLeaves.cs	(revision 12781)
@@ -0,0 +1,76 @@
+﻿using HeuristicLab.Algorithms.Bandits;
+using HeuristicLab.Algorithms.MonteCarloTreeSearch.Base;
+using HeuristicLab.Algorithms.MonteCarloTreeSearch.Simulation;
+using HeuristicLab.Problems.GrammaticalOptimization;
+using System;
+using System.Linq;
+using System.Threading;
+
+namespace HeuristicLab.Algorithms.MonteCarloTreeSearch
+{
+    public class MonteCarloTreeSearch_PruneLeaves : MonteCarloTreeSearch
+    {
+        public MonteCarloTreeSearch_PruneLeaves(IProblem problem, int maxLen, Random random, IBanditPolicy behaviourPolicy,
+            ISimulation simulationPolicy):base(problem,maxLen,random,behaviourPolicy,simulationPolicy)
+        {
+        }
+
+        public override void Run(int maxIterations)
+        {
+            Reset();
+            for (int i = 0; !StopRequested && i < maxIterations; i++)
+            {
+                lock (pauseLock)
+                {
+                    if (isPaused)
+                    {
+                        Monitor.Wait(pauseLock);
+                    }
+                }
+                TreeNode currentNode = rootNode;
+
+                while (!currentNode.IsLeaf())
+                {
+                    int currentActionIndex = behaviourPolicy.SelectAction(random,
+                        currentNode.GetChildActionInfos());
+                    currentNode = currentNode.children[currentActionIndex];
+                }
+
+                string phrase = currentNode.phrase;
+
+                if (phrase.Length <= maxLen)
+                {
+                    // Version 2:
+                    if (currentNode.children != null && !currentNode.children.Any())
+                    {
+                        // already removed all child nodes so remove it too..
+                        currentNode.parent.children.Remove(currentNode);
+                        continue;
+                    }
+                    ExpandTreeNode(currentNode);
+                    if (currentNode.children.Any())
+                    {
+                        currentNode =
+                            currentNode.children[behaviourPolicy.SelectAction(random, currentNode.GetChildActionInfos())
+                                ];
+                    }
+                    else
+                    {
+                        // Version 2:
+                        // remove currentNode from tree..
+                        currentNode.parent.children.Remove(currentNode);
+                    }
+                }
+                if (currentNode.phrase.Length <= maxLen)
+                {
+                    string simulatedPhrase;
+                    double quality = simulation.Simulate(currentNode, out simulatedPhrase);
+                    OnSolutionEvaluated(simulatedPhrase, quality);
+
+                    Propagate(currentNode, quality);
+
+                }
+            }
+        }
+    }
+}
