Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/21/17 11:33:53 (7 years ago)
Author:
pkimmesw
Message:

#2665 Testet Problems, Testet error functions, Small fixes, Created HL files

Location:
branches/PushGP/HeuristicLab.PushGP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP

    • Property svn:ignore
      •  

        old new  
        11*.user
         2packages
         3TestResults
  • branches/PushGP/HeuristicLab.PushGP/FeatureTests/Program.cs

    r15273 r15334  
    1212  using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool;
    1313  using HeuristicLab.Problems.ProgramSynthesis.Push.Expressions;
     14  using HeuristicLab.Problems.ProgramSynthesis.Push.Extensions;
    1415  using HeuristicLab.Problems.ProgramSynthesis.Push.Generators.CodeGenerator;
    1516  using HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter;
     
    2324    private const int ExampleCount = 200;
    2425    private const int InstanceCount = 1024;
    25     private const int PopulationCount = 100;
     26    private const int PopulationCount = 1000;
    2627
    2728    private static int TotalInstanceCount => PopulationCount * InstanceCount * ExampleCount;
    2829
    2930    static void Main(string[] args) {
     31      // object pooling
    3032      //Test1();
    31       //Test1_2();
     33      Test1_2();
    3234      //Test3();
    3335
     
    5355      //TestSplitLogic();
    5456      //TestStringBuilder();
    55       TestRandomReset();
     57      //TestRandomReset();
     58
     59      //TestRandomBiased(0, 4, 0.01);
     60      //TestRandomBiased(0, 4, 0.25);
     61      //TestRandomBiased(0, 4, 0.5);
     62      //TestRandomBiased(0, 4, 1);
     63      //TestRandomBiased(0, 4, 2);
     64      //TestRandomBiased(0, 4, 3);
     65      //TestRandomBiased(0, 4, 4);
     66
    5667
    5768      Console.WriteLine("\nPress any key to continue...");
    5869      Console.ReadKey(false);
     70    }
     71
     72    private static void TestRandomBiased(int min, int max, double bias) {
     73      var random = new MersenneTwister();
     74      var total = 100000;
     75
     76      var distribution = Enumerable
     77        .Range(0, total)
     78        .Select(_ => random.NextBiased(min, max, bias))
     79        .GroupBy(x => x)
     80        .OrderBy(g => g.Key)
     81        .ToDictionary(g => g.Key, g => g.Count() / (double)total * 100);
     82
     83      Console.WriteLine($@"{min}|{max}|{bias}");
     84
     85      foreach (var entry in distribution) {
     86        Console.WriteLine($@"{entry.Key}: {entry.Value}");
     87      }
     88
     89      Console.WriteLine();
    5990    }
    6091
     
    496527      var config = new PushConfiguration {
    497528        EvalPushLimit = 1024,
    498         MaxPointsInProgram = 1024
     529        MaxProgramLength = 1024
    499530      };
    500531
Note: See TracChangeset for help on using the changeset viewer.