Changeset 5549 for branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubtreeCrossoverTest.cs
- Timestamp:
- 02/22/11 19:04:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/SubtreeCrossoverTest.cs
r5445 r5549 24 24 using System.Diagnostics; 25 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Crossovers;28 26 using HeuristicLab.Random; 29 27 using Microsoft.VisualStudio.TestTools.UnitTesting; 30 28 31 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._ 3.Tests {29 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests { 32 30 [TestClass] 33 31 public class SubtreeCrossoverTest { … … 51 49 public void SubtreeCrossoverDistributionsTest() { 52 50 int generations = 5; 53 var trees = new List< SymbolicExpressionTree>();51 var trees = new List<ISymbolicExpressionTree>(); 54 52 var grammar = Grammars.CreateArithmeticAndAdfGrammar(); 55 53 var random = new MersenneTwister(31415); 56 List< SymbolicExpressionTree> crossoverTrees;54 List<ISymbolicExpressionTree> crossoverTrees; 57 55 double msPerCrossoverEvent; 58 56 … … 63 61 stopwatch.Start(); 64 62 for (int gCount = 0; gCount < generations; gCount++) { 65 var newPopulation = new List< SymbolicExpressionTree>();63 var newPopulation = new List<ISymbolicExpressionTree>(); 66 64 for (int i = 0; i < POPULATION_SIZE; i++) { 67 65 var par0 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone(); 68 66 var par1 = (SymbolicExpressionTree)trees.SelectRandom(random).Clone(); 69 bool success; 70 newPopulation.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, 100, 10, out success)); 71 Assert.IsTrue(success); 67 newPopulation.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, 100, 10)); 72 68 } 73 69 crossoverTrees = newPopulation;
Note: See TracChangeset
for help on using the changeset viewer.