1 | using System;
|
---|
2 | using System.Text;
|
---|
3 | using System.Collections.Generic;
|
---|
4 | using System.Linq;
|
---|
5 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
6 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
7 | using HeuristicLab.Random;
|
---|
8 | using System.Diagnostics;
|
---|
9 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.ArchitectureAlteringOperators;
|
---|
10 |
|
---|
11 | namespace 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 | }
|
---|