Changeset 2447


Ignore:
Timestamp:
10/27/09 09:47:03 (13 years ago)
Author:
gkronber
Message:

Added until test project for HeuristicLab.GP plugins. #791 (Tests for GP operators and structure identification evaluators)

Location:
trunk/sources
Files:
9 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.Operators/3.3/Initialization/ProbabilisticTreeCreator.cs

    r2222 r2447  
    2727namespace HeuristicLab.GP.Operators {
    2828  public class ProbabilisticTreeCreator : OperatorBase {
    29     private int MAX_TRIES { get { return 100; } }
     29    private static int MAX_TRIES { get { return 100; } }
    3030
    3131    public override string Description {
     
    5050      int maxTreeHeight = GetVariableValue<IntData>("MaxTreeHeight", scope, true).Data;
    5151
    52       int treeSize = random.Next(minTreeSize, maxTreeSize + 1);
    53       IFunctionTree root;
    54       int tries = 0;
    55       TreeGardener gardener = new TreeGardener(random, funLibrary);
    56       do {
    57         root = gardener.PTC2(treeSize, maxTreeHeight);
    58         if (tries++ >= MAX_TRIES) {
    59           // try a different size
    60           treeSize = random.Next(minTreeSize, maxTreeSize + 1);
    61           tries = 0;
    62         }
    63       } while (root.GetSize() > maxTreeSize || root.GetHeight() > maxTreeHeight);
    64 
     52      IFunctionTree root = Create(random, funLibrary, minTreeSize, maxTreeSize, maxTreeHeight);
    6553      scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("FunctionTree"), new GeneticProgrammingModel(root)));
    6654      return Util.CreateInitializationOperation(TreeGardener.GetAllSubTrees(root), scope);
    6755    }
    6856
    69  }
     57
     58    public static IFunctionTree Create(IRandom random, FunctionLibrary funLib, int minSize, int maxSize, int maxHeight) {
     59      int treeSize = random.Next(minSize, maxSize + 1);
     60      IFunctionTree root;
     61      int tries = 0;
     62      TreeGardener gardener = new TreeGardener(random, funLib);
     63      do {
     64        root = gardener.PTC2(treeSize, maxHeight);
     65        if (tries++ >= MAX_TRIES) {
     66          // try a different size
     67          treeSize = random.Next(minSize, maxSize + 1);
     68          tries = 0;
     69        }
     70      } while (root.GetSize() > maxHeight || root.GetHeight() > maxHeight);
     71      return root;
     72    }
     73  }
    7074}
  • trunk/sources/HeuristicLab.sln

    r2441 r2447  
    252252Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ALGLIB", "ALGLIB\ALGLIB.csproj", "{44456535-5DB5-454A-BE2B-7426DA6700B6}"
    253253EndProject
    254 Global
     254Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.GP.Tests", "HeuristicLab.GP.Tests\HeuristicLab.GP.Tests.csproj", "{6EDEE199-61FC-48E1-AEDA-AF1C2E722063}"EndProjectGlobal
    255255  GlobalSection(SolutionConfigurationPlatforms) = preSolution
    256256    CEDMA Debug|Any CPU = CEDMA Debug|Any CPU
     
    40134013    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Modeling Debug|Any CPU.Build.0 = Debug|Any CPU
    40144014    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Modeling Debug|x64.ActiveCfg = Debug|Any CPU
    4015     {44456535-5DB5-454A-BE2B-7426DA6700B6}.Modeling Debug|x86.ActiveCfg = Debug|Any CPU
    4016     {44456535-5DB5-454A-BE2B-7426DA6700B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
     4015    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Modeling Debug|x86.ActiveCfg = Debug|x86
     4016    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Modeling Debug|x86.Build.0 = Debug|x86   {44456535-5DB5-454A-BE2B-7426DA6700B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
    40174017    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Release|Any CPU.Build.0 = Release|Any CPU
    40184018    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Release|x64.ActiveCfg = Release|x64
     
    40284028    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU
    40294029    {44456535-5DB5-454A-BE2B-7426DA6700B6}.Visualization Debug|x86.ActiveCfg = Debug|Any CPU
    4030   EndGlobalSection
     4030    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.CEDMA Debug|Any CPU.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Debug|Any CPU.Build.0 = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Debug|x64.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Debug|x86.ActiveCfg = Debug|x86    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Modeling Debug|Any CPU.ActiveCfg = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Modeling Debug|Any CPU.Build.0 = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Modeling Debug|x64.ActiveCfg = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Modeling Debug|x86.ActiveCfg = Debug|x86   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Release|Any CPU.ActiveCfg = Release|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Release|Any CPU.Build.0 = Release|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Release|x64.ActiveCfg = Release|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Release|x86.ActiveCfg = Release|x86    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.v3.2 Debug|Any CPU.ActiveCfg = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.v3.2 Debug|Any CPU.Build.0 = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.v3.2 Debug|x64.ActiveCfg = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.v3.2 Debug|x86.ActiveCfg = Debug|Any CPU   {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Visualization Debug|Any CPU.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Visualization Debug|Any CPU.Build.0 = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Visualization Debug|x64.ActiveCfg = Debug|Any CPU    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063}.Visualization Debug|x86.ActiveCfg = Debug|Any CPU  EndGlobalSection
    40314031  GlobalSection(SolutionProperties) = preSolution
    40324032    HideSolutionNode = FALSE
     
    41224122    {589BECAE-69B0-4EB1-8C06-C073531762B7} = {410732DB-725A-4824-896B-C298978343C0}
    41234123    {44456535-5DB5-454A-BE2B-7426DA6700B6} = {410732DB-725A-4824-896B-C298978343C0}
    4124     {A9E282EA-180F-4233-B809-AEDF0787545C} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
     4124    {6EDEE199-61FC-48E1-AEDA-AF1C2E722063} = {410732DB-725A-4824-896B-C298978343C0}   {A9E282EA-180F-4233-B809-AEDF0787545C} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
    41254125    {BF7D9494-A586-457B-8DF9-ED599F9E6A71} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
    41264126    {C36BD924-A541-4A00-AFA8-41701378DDC5} = {78982D7C-D63D-4A3D-AE1F-F58AC007603B}
Note: See TracChangeset for help on using the changeset viewer.