Changeset 11730 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.Test/TestSolvers.cs
- Timestamp:
- 01/02/15 16:08:21 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.Test/TestSolvers.cs
r11727 r11730 36 36 // E -> V | V+E | V-E | V*E | V/E | (E) 37 37 // V -> a .. j 38 /* grammar has been change ... unit test not yet adapted 38 39 var prob = new SymbolicRegressionPoly10Problem(); 39 40 var comb = 10; 40 41 TestDFS(prob, 1, comb); 41 42 TestDFS(prob, 2, comb); 42 43 43 44 comb = comb + 10 * 4 * comb + comb; 44 45 TestDFS(prob, 3, comb); 45 46 TestDFS(prob, 4, comb); 46 47 47 48 comb = comb + 10 * 4 * comb + 10; // ((E)) 48 49 TestDFS(prob, 5, comb); 49 50 TestDFS(prob, 6, comb); 50 51 comb = comb + 10 * 4 * comb + 10; // (((E))) 51 52 comb = comb + 10 * 4 * comb + 10; // (((E))) */ 52 53 // takes too long 53 54 //TestDFS(prob, 7, comb); … … 96 97 // E -> V | V+E | V-E | V*E | V/E | (E) 97 98 // V -> a .. j 99 /* grammar has been change ... unit test not yet adapted 98 100 var prob = new SymbolicRegressionPoly10Problem(); 99 101 var comb = 10; … … 109 111 TestDFS(prob, 6, comb); 110 112 111 comb = comb + 10 * 4 * comb + 10; // (((E))) 113 comb = comb + 10 * 4 * comb + 10; // (((E))) */ 112 114 // takes too long 113 115 //TestDFS(prob, 7, comb); … … 117 119 118 120 private void TestDFS(IProblem prob, int len, int numExpectedSols) { 119 var solver = new ExhaustiveDepthFirstSearch( len);121 var solver = new ExhaustiveDepthFirstSearch(prob, len); 120 122 int numSols = 0; 121 123 122 solver.SolutionEvaluated += (s, d) => { numSols++; };124 solver.SolutionEvaluated += (s, d) => { numSols++; Console.WriteLine(s); }; 123 125 124 solver.Run( prob,int.MaxValue);126 solver.Run(int.MaxValue); 125 127 Assert.AreEqual(numExpectedSols, numSols); 126 128 }
Note: See TracChangeset
for help on using the changeset viewer.