Index: branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Main.csproj
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Main.csproj	(revision 12876)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Main.csproj	(revision 12893)
@@ -34,4 +34,5 @@
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
+    <UseVSHostingProcess>true</UseVSHostingProcess>
   </PropertyGroup>
   <ItemGroup>
Index: branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Program.cs
===================================================================
--- branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Program.cs	(revision 12876)
+++ branches/HeuristicLab.Problems.GrammaticalOptimization-gkr/Main/Program.cs	(revision 12893)
@@ -4,10 +4,8 @@
 using System.Globalization;
 using System.Linq;
-using System.Text.RegularExpressions;
+using HeuristicLab.Algorithms.Bandits;
 using HeuristicLab.Algorithms.Bandits.BanditPolicies;
 using HeuristicLab.Algorithms.Bandits.GrammarPolicies;
 using HeuristicLab.Algorithms.GrammaticalOptimization;
-using HeuristicLab.Algorithms.MonteCarloTreeSearch;
-using HeuristicLab.Algorithms.MonteCarloTreeSearch.Simulation;
 using HeuristicLab.Problems.GrammaticalOptimization;
 
@@ -23,4 +21,5 @@
 // TODO: constant optimization 
 using HeuristicLab.Problems.GrammaticalOptimization.SymbReg;
+using RandomPolicy = HeuristicLab.Algorithms.Bandits.GrammarPolicies.RandomPolicy;
 
 
@@ -30,39 +29,42 @@
       CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
 
-      RunDemo();
-    }
-
-
-    private static void RunDemo() {
+      foreach (var banditPolicy in new IBanditPolicy[]
+      {
+        //new HeuristicLab.Algorithms.Bandits.BanditPolicies.RandomPolicy(),
+        //new UCB1TunedPolicy(), 
+        //new UCB1Policy(), 
+        //new UCB1Policy(0.8), 
+        //new UCB1Policy(1), 
+        new UCB1Policy(0.5), 
+        //new ExtremeHunterPolicy(), 
+        //new ThresholdAscentPolicy(), 
+        //new BoltzmannExplorationPolicy(1), 
+        //new BoltzmannExplorationPolicy(0.5), 
+        //new BoltzmannExplorationPolicy(5), 
+        //new EpsGreedyPolicy(0.1), 
+        //new EpsGreedyPolicy(0.05), 
+      }) {
+        var problem = new SymbolicRegressionPoly10Problem(500);
+        var random = new Random();
+        //var problem = new SymbolicRegressionProblem(random, "Vladislavleva-1", useConstantOpt: true);
+        //var problem = new PrimePolynomialProblem();
+        //var problem = new SantaFeAntProblem();
+        var policy = new GenericGrammarPolicy(problem, banditPolicy);
+        // var policy = new GenericGrammarPolicy(problem, new UCB1Policy(0.5));
+        //var alg = new MonteCarloTreeSearch(problem, 23, random, new UCB1Policy(), new RandomSimulation(problem, random, 30));
+
+        RunDemo(problem, random, policy, banditPolicy.ToString());
+      }
+    }
+
+
+    private static void RunDemo(IProblem problem, Random random, GenericGrammarPolicy policy, string banditPolicyName) {
+
 
       for (int i = 0; i < 100; i++) {
-        int maxIterations = 2000000;
         int iterations = 0;
-
         var globalStatistics = new SentenceSetStatistics();
-        ResetAlleleStatistics();
-        var random = new Random();
-
-        var problem = new SymbolicRegressionPoly10Problem();
-        //var problem = new SantaFeAntProblem();              
-        //var problem = new RoyalPairProblem(25);
-        //var problem = new FindPhrasesProblem(random, 10, 5, 3, 5, 5, 1.0, 0.9, true);
-        //var problem = new PrimePolynomialProblem();
-        //var problem = new SymbolicRegressionProblem(random,
-        //  //@"C:\reps\HeuristicLab\branches\HeuristicLab.Problems.GrammaticalOptimization\HeuristicLab.Problems.GrammaticalOptimization.SymbReg\nht-train.csv",
-        //  @"C:\reps\fhooe-new\research\Datasets\Benchmark\kommenda-1.csv",
-        //  1.0,
-        //  true);
-        // //var problem = new PrimePolynomialProblem();
-        // var alg = new SequentialSearch(problem, 25, random, 0,
-        //   new HeuristicLab.Algorithms.Bandits.GrammarPolicies.GenericGrammarPolicy(problem, new UCB1TunedPolicy()));
-        //var policy = new GenericPolicy(problem);
-        //var policy = new GenericGrammarPolicy(problem, new ExtremeHunterPolicy());
-        //var policy = new GenericGrammarPolicy(problem, new UCB1Policy());
-        //var policy = new GenericGrammarPolicy(problem, new ActiveLearningPolicy(0.1));
-        var policy = new GenericGrammarPolicy(problem, new ExtremeHunterPolicy(1.0E-2, 1E-2, 1));
-        var alg = new SequentialSearch(problem, 23, random, 0,
-          policy);
-        //var alg = new MonteCarloTreeSearch(problem, 23, random, new UCB1Policy(), new RandomSimulation(problem, random, 30));
+
+        var alg = new SequentialSearch(problem, 23, random, 0, policy);
 
 
@@ -74,5 +76,5 @@
           iterations++;
           globalStatistics.AddSentence(sentence, quality);
-          UpdateAlleleStatistics(sentence);
+          //UpdateAlleleStatistics(sentence);
           // comment this if you don't want to see solver statistics
           if (iterations % 100 == 0) {
@@ -81,5 +83,5 @@
             }
             Console.SetCursorPosition(0, 0);
-            Console.WriteLine(iterations);
+            Console.WriteLine("{0} {1}", iterations, string.Join(" ", policy.OptimalPulls.Take(15).Select(p => string.Format("{0:F3}", p))));
             //WriteAlleleStatistics();
             Console.WriteLine(globalStatistics.BestSentenceQuality);
@@ -90,10 +92,45 @@
             //ResetAlleleStatistics();
           }
-          
+
           // uncomment this if you want to collect statistics of the generated sentences
-          //if (iterations % 100 == 0) {
-          //  Console.WriteLine("{0}", globalStatistics);
+          //if (iterations % 1000 == 0) {
+          //  Console.WriteLine("{0} {1} {2}", banditPolicyName, string.Join(" ", policy.OptimalPulls.Take(15).Select(p => string.Format("{0:F3}", p))), globalStatistics);
           //}
         };
+        int maxIterations = 300000;
+
+        // ResetAlleleStatistics();
+
+        //var problem = new SantaFeAntProblem();
+        //var problem = new RoyalPairProblem(10);
+        //var problem = new FindPhrasesProblem(random, 10, 5, 3, 5, 5, 1.0, 0.9, true);
+        //var problem = new PrimePolynomialProblem();
+        //var problem = new SymbolicRegressionProblem(random, "Tower");
+        // @"C:\reps\HeuristicLab\branches\HeuristicLab.Problems.GrammaticalOptimization\HeuristicLab.Problems.GrammaticalOptimization.SymbReg\nht-train.csv",
+        //  @"C:\reps\fhooe-new\research\Datasets\Benchmark\kommenda-1.csv",
+        //  1.0,
+        //  true);
+        // //var problem = new PrimePolynomialProblem();
+        // var alg = new SequentialSearch(problem, 25, random, 0,
+        //var policy = new HeuristicLab.Algorithms.Bandits.GrammarPolicies.GenericGrammarPolicy(problem, new UCB1TunedPolicy());
+        //var policy = new GenericPolicy(problem);
+        //var policy = new GenericGrammarPolicy(problem, new ExtremeHunterPolicy());
+        //var policy = new GenericGrammarPolicy(problem, new UCB1Policy(0.5));
+        //var policy = new GenericGrammarPolicy(problem, new ActiveLearningPolicy(3));
+        //var policy = new GenericGrammarPolicy(problem, new IntervalEstimationPolicy());
+        //var policy = new GenericGrammarPolicy(problem, new ChernoffIntervalEstimationPolicy());
+
+        //var policy = new GenericGrammarPolicy(problem, new EpsGreedyPolicy(0.1));
+        //var policy = new GenericGrammarPolicy(problem, new ExtremeHunterPolicy(0.001, 0.001, 1, 100000, minPulls: 100));
+        //var policy = new GenericGrammarPolicy(problem, new ThresholdAscentPolicy(s: 1000, delta: 1));
+        //var policy = new GenericGrammarPolicy(problem, new HeuristicLab.Algorithms.Bandits.BanditPolicies.UCB1TunedPolicy());
+        //var policy = new GenericGrammarPolicy(problem, new HeuristicLab.Algorithms.Bandits.BanditPolicies.BoltzmannExplorationPolicy(1));
+        //var policy = new GenericGrammarPolicy(problem, new HeuristicLab.Algorithms.Bandits.BanditPolicies.ThresholdAscentPolicy(500, 0.01)); // santa fe ant
+
+
+        //var policy = new GenericGrammarPolicy(problem, new HeuristicLab.Algorithms.Bandits.BanditPolicies.BoltzmannExplorationWithCoolingPolicy(0.01));
+
+
+
 
         var sw = new Stopwatch();
@@ -102,10 +139,10 @@
         sw.Stop();
 
-        Console.WriteLine(globalStatistics);
-
-        Console.WriteLine("{0:F2} sec {1,10:F1} sols/sec {2,10:F1} ns/sol",
-          sw.Elapsed.TotalSeconds,
-          maxIterations / (double)sw.Elapsed.TotalSeconds,
-          (double)sw.ElapsedMilliseconds * 1000 / maxIterations);
+        //Console.WriteLine(globalStatistics);
+        //
+        //Console.WriteLine("{0:F2} sec {1,10:F1} sols/sec {2,10:F1} ns/sol",
+        //  sw.Elapsed.TotalSeconds,
+        //  maxIterations / (double)sw.Elapsed.TotalSeconds,
+        //  (double)sw.ElapsedMilliseconds * 1000 / maxIterations);
       }
     }
@@ -116,9 +153,9 @@
         if (alleleStatistics.ContainsKey(allele)) alleleStatistics[allele]++;
       }
-      for (int i = 0; i < sentence.Length - 2; i+=2) {
+      for (int i = 0; i < sentence.Length - 2; i += 2) {
         var allele = sentence.Substring(i, 3);
         if (alleleStatistics.ContainsKey(allele)) alleleStatistics[allele]++;
       }
-      for (int i = 0; i < sentence.Length - 4; i+=2) {
+      for (int i = 0; i < sentence.Length - 4; i += 2) {
         var allele = sentence.Substring(i, 5);
         if (alleleStatistics.ContainsKey(allele)) alleleStatistics[allele]++;
@@ -166,5 +203,5 @@
     private static void WriteAlleleStatistics() {
       double count = alleleStatistics.Sum(e => e.Value);
-      foreach (var entry in alleleStatistics.OrderByDescending(e=>e.Value)) {
+      foreach (var entry in alleleStatistics.OrderByDescending(e => e.Value)) {
         Console.WriteLine("{0,-10} {1,-10}", entry.Key, entry.Value);
       }
