Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/02/15 20:41:11 (10 years ago)
Author:
gkronber
Message:

#2283: implemented royal tree problem and grid test for tree-based gp variants

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Test/TestInstances.cs

    r11747 r11865  
    146146      Assert.AreEqual(89, p.Evaluate("?(m)(ll?(m)(r))mr"));
    147147    }
    148     [TestMethod]
    149     public void TestRoyalTreeProblem() {
    150       var p = new RoyalTreeProblem();
    151       Console.WriteLine(p.Grammar);
    152 
    153     }
     148
    154149    [TestMethod]
    155150    public void TestRoyalRoadProblem() {
     
    261256      Assert.AreEqual(1.0, p.Evaluate("a*b+c*d+e*f+a*g*i+c*f*j"), 1.0E-7);
    262257    }
     258
     259    [TestMethod]
     260    public void TestRoyalTreeProblem() {
     261      var p = new RoyalTreeProblem(7);
     262      Console.WriteLine(p.Grammar);
     263
     264      // examples from The Royal Tree Problem, a Benchmark for Single and Multi-population Genetic Programming (Punch, Zongker, Goodman)
     265      Assert.AreEqual(4, p.Evaluate("ax"), 1.0E-7);
     266      Assert.AreEqual(384.0, p.Evaluate("cbaxaxbaxaxbaxax"), 1.0E-7);
     267      Assert.AreEqual(128.66, p.Evaluate("cbaxaxbaxaxbxx"), 1.0E-7);
     268      Assert.AreEqual(64.66, p.Evaluate("cbaxaxxx"), 1.0E-7);
     269
     270    }
    263271  }
    264272}
Note: See TracChangeset for help on using the changeset viewer.