Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/ArgumentCreaterTest.cs @ 3338

Last change on this file since 3338 was 3338, checked in by gkronber, 14 years ago

Fixed bugs related to dynamic symbol constraints with ADFs. #290 (Implement ADFs)

File size: 1.9 KB
Line 
1using System;
2using System.Text;
3using System.Collections.Generic;
4using System.Linq;
5using Microsoft.VisualStudio.TestTools.UnitTesting;
6using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
7using HeuristicLab.Random;
8using System.Diagnostics;
9using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureAlteringOperators;
10
11namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._3.Tests {
12  [TestClass]
13  public class ArgumentCreaterTest {
14    private const int POPULATION_SIZE = 1000;
15    private const int MAX_TREE_SIZE = 100;
16    private const int MAX_TREE_HEIGHT = 10;
17    private TestContext testContextInstance;
18
19    /// <summary>
20    ///Gets or sets the test context which provides
21    ///information about and functionality for the current test run.
22    ///</summary>
23    public TestContext TestContext {
24      get {
25        return testContextInstance;
26      }
27      set {
28        testContextInstance = value;
29      }
30    }
31
32    [TestMethod()]
33    public void ArgumentCreaterDistributionsTest() {
34      var trees = new List<SymbolicExpressionTree>();
35      var grammar = Grammars.CreateArithmeticAndAdfGrammar();
36      var random = new MersenneTwister();
37      for (int i = 0; i < POPULATION_SIZE; i++) {
38        var tree = ProbabilisticTreeCreator.Create(random, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
39        ArgumentCreater.CreateNewArgument(random, tree, grammar, MAX_TREE_SIZE, MAX_TREE_HEIGHT, 3, 3);
40        Assert.IsTrue(tree.IsValidExpression());
41        trees.Add(tree);
42      }
43      Assert.Inconclusive("ArgumentCreator: " + Environment.NewLine +
44        Util.GetSizeDistributionString(trees, 105, 5) + Environment.NewLine +
45        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
46        Util.GetNumberOfSubTreesDistributionString(trees) + Environment.NewLine +
47        Util.GetTerminalDistributionString(trees) + Environment.NewLine
48        );
49    }
50  }
51}
Note: See TracBrowser for help on using the repository browser.