Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/09/15 09:48:30 (10 years ago)
Author:
gkronber
Message:

#2283 new experiments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Main/Program.cs

    r11966 r11972  
    2727
    2828      //RunDemo();
    29       // RunGpDemo();
    30       RunGridTest();
    31       //RunGpGridTest();
     29      //RunGpDemo();
     30      //RunGridTest();
     31      RunGpGridTest();
    3232    }
    3333
     
    229229      // - ant: UCB1Tuned with canonical states also works very well for the artificial ant! constistent solutions in less than 10k iters     
    230230
    231       var problem = new SymbolicRegressionPoly10Problem();
     231      //var problem = new SymbolicRegressionPoly10Problem();
    232232      //var problem = new SantaFeAntProblem();
    233       //var problem = new SymbolicRegressionProblem(random, "Tower");
     233      var problem = new SymbolicRegressionProblem(random, "Breiman");
    234234      //var problem = new PalindromeProblem();
    235235      //var problem = new HardPalindromeProblem();
     
    244244      //var alg = new SequentialSearch(problem, 23, random, 0,
    245245      //  new HeuristicLab.Algorithms.Bandits.GrammarPolicies.GenericContextualGrammarPolicy(problem, new GenericThompsonSamplingPolicy(new GaussianModel(0.5, 10, 1, 1)), true));
    246       var alg = new SequentialSearch(problem, 23, random, 0,
     246      var alg = new SequentialSearch(problem, 30, random, 0,
    247247        new HeuristicLab.Algorithms.Bandits.GrammarPolicies.GenericFunctionApproximationGrammarPolicy(problem, true));
    248248      //var alg = new MctsQLearningSampler(problem, sentenceLen, random, 0, null);
     
    265265        globalStatistics.AddSentence(sentence, quality);
    266266
    267         if (iterations % 1000 == 0) {
    268           if (iterations % 10000 == 0) Console.Clear();
    269           Console.SetCursorPosition(0, 0);
    270           alg.PrintStats();
     267        //if (iterations % 100 == 0) {
     268        //  if (iterations % 10000 == 0) Console.Clear();
     269        //  Console.SetCursorPosition(0, 0);
     270        //  alg.PrintStats();
     271        //}
     272
     273        //Console.WriteLine(sentence);
     274
     275        if (iterations % 100 == 0) {
     276          Console.WriteLine("{0}", globalStatistics);
    271277        }
    272 
    273         //Console.WriteLine(sentence);
    274 
    275         //if (iterations % 10000 == 0) {
    276         //  Console.WriteLine("{0}", globalStatistics);
    277         //}
    278278      };
    279279
     
    309309      const int nReps = 20;
    310310      const int seed = 31415;
    311       const int maxIters = 200000;
     311      //const int maxIters = 50000;
    312312      var rand = new Random(seed);
    313       var problemFactories = new Func<ISymbolicExpressionTreeProblem>[]
     313      var problemFactories = new Func<Tuple<int, int, ISymbolicExpressionTreeProblem>>[]
    314314      {
    315         () => new SymbolicRegressionPoly10Problem(),
    316         () => new SantaFeAntProblem(),
    317       };
    318       foreach (var popSize in new int[] { 50, 100, 250, 500, 1000, 2500, 5000, 10000 }) {
     315        () => Tuple.Create(50000, 32, (ISymbolicExpressionTreeProblem)new PermutationProblem()),
     316        () => Tuple.Create(50000, 32, (ISymbolicExpressionTreeProblem)new RoyalPairProblem()),
     317        () => Tuple.Create(50000, 32,(ISymbolicExpressionTreeProblem)new RoyalSymbolProblem()),
     318        () => Tuple.Create(50000, 64, (ISymbolicExpressionTreeProblem)new RoyalPairProblem()),
     319        () => Tuple.Create(50000, 64,(ISymbolicExpressionTreeProblem)new RoyalSymbolProblem()),
     320        () => Tuple.Create(50000, 128, (ISymbolicExpressionTreeProblem)new RoyalPairProblem()),
     321        () => Tuple.Create(50000, 128,(ISymbolicExpressionTreeProblem)new RoyalSymbolProblem()),
     322        () => Tuple.Create(50000, 256, (ISymbolicExpressionTreeProblem)new RoyalPairProblem()),
     323        () => Tuple.Create(50000, 256,(ISymbolicExpressionTreeProblem)new RoyalSymbolProblem()),
     324        //() => new RoyalPairProblem(),
     325        //() => new FindPhrasesProblem(rand, 20, 5, 3, 5, 0, 1, 0, true),
     326        //() => new FindPhrasesProblem(rand, 20, 5, 3, 5, 0, 1, 0, false),
     327        //() => new FindPhrasesProblem(rand, 20, 5, 3, 5, 50, 1, 0.8, false),
     328      };
     329
     330      foreach (var popSize in new int[] { 100 /*, 250, 500, 1000, 2500, 5000, 10000 */ }) {
    319331        foreach (var mutationRate in new double[] { /* 0.05, /* 0.10, */ 0.15, /* 0.25, 0.3 */}) {
    320           foreach (var maxSize in new int[] { 30, 50, 100, 150, 250 }) {
    321             // skip experiments that are already done
    322             if (popSize == 10000 || maxSize == 150 || maxSize == 250) {
    323               foreach (var problemFactory in problemFactories)
    324                 for (int i = 0; i < nReps; i++) {
    325                   var solverSeed = rand.Next();
    326                   {
    327                     var prob = problemFactory();
    328                     var sgp = new StandardGP(prob, new Random(solverSeed));
    329                     RunGP(sgp, prob, maxIters, popSize, mutationRate, maxSize);
    330                   }
    331                   // {
    332                   //   var prob = problemFactory();
    333                   //   var osgp = new OffspringSelectionGP(prob, new Random(solverSeed));
    334                   //   RunGP(osgp, prob, maxIters, popSize, mutationRate, maxSize);
    335                   // }
    336                 }
     332          // skip experiments that are already done
     333          foreach (var problemFactory in problemFactories) {
     334            for (int i = 0; i < nReps; i++) {
     335              {
     336                var solverSeed = rand.Next();
     337                var tupel = problemFactory();
     338                var maxIters = tupel.Item1;
     339                var maxSize = tupel.Item2;
     340                var prob = tupel.Item3;
     341                var sgp = new StandardGP(prob, new Random(solverSeed));
     342                RunGP(sgp, prob, maxIters, popSize, mutationRate, maxSize);
     343              }
     344              //{
     345              //  var prob = problemFactory();
     346              //  var osgp = new OffspringSelectionGP(prob, new Random(solverSeed));
     347              //  RunGP(osgp, prob, maxIters, popSize, mutationRate, maxSize);
     348              //}
    337349            }
    338350          }
    339351        }
     352
    340353      }
    341354    }
     
    350363        globalStatistics.AddSentence(sentence, quality);
    351364
    352         if (iterations % 1000 == 0) {
     365        if (iterations % 100 == 0) {
    353366          Console.WriteLine("\"{0,25}\" {1} {2:N2} {3} \"{4,25}\" {5}", gpName, popSize, mutationRate, maxSize, probName, globalStatistics);
    354367        }
Note: See TracChangeset for help on using the changeset viewer.