Changeset 10400
- Timestamp:
- 01/26/14 14:37:40 (11 years ago)
- Location:
- branches/HeuristicLab.Problems.GPDL/CodeGenerator
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GPDL/CodeGenerator/BruteForceCodeGen.cs
r10394 r10400 98 98 foreach(var t in GenerateTrees(0, depth)) { 99 99 var f = problem.Evaluate(t); 100 // t.PrintTree(0); Console.WriteLine();101 100 var size = t.GetSize(); 102 101 sumSize += size; … … 105 104 sumF += f; 106 105 if (problem.IsBetter(f, bestF)) { 106 t.PrintTree(0); Console.WriteLine(); 107 107 bestF = f; 108 108 t.PrintTree(0); Console.WriteLine(); -
branches/HeuristicLab.Problems.GPDL/CodeGenerator/CodeGenerator.csproj
r10388 r10400 37 37 <ItemGroup> 38 38 <Compile Include="BruteForceCodeGen.cs" /> 39 <Compile Include="MonteCarloTreeSearchCodeGen.cs" /> 39 40 <Compile Include="ProblemCodeGen.cs" /> 40 41 <Compile Include="SourceBuilder.cs" /> -
branches/HeuristicLab.Problems.GPDL/CodeGenerator/ProblemCodeGen.cs
r10394 r10400 149 149 private void GenerateSolvers(GPDefNode ast, SourceBuilder solverSourceCode) { 150 150 var grammar = CreateGrammarFromAst(ast); 151 //var randomSearchCodeGen = new RandomSearchCodeGen(); 152 //randomSearchCodeGen.Generate(grammar, ast.Terminals.OfType<TerminalNode>(), ast.FitnessFunctionNode.Maximization, solverSourceCode); 153 var bruteForceSearchCodeGen = new BruteForceCodeGen(); 154 bruteForceSearchCodeGen.Generate(grammar, ast.Terminals.OfType<TerminalNode>(), ast.FitnessFunctionNode.Maximization, solverSourceCode); 151 // var randomSearchCodeGen = new RandomSearchCodeGen(); 152 // randomSearchCodeGen.Generate(grammar, ast.Terminals.OfType<TerminalNode>(), ast.FitnessFunctionNode.Maximization, solverSourceCode); 153 //var bruteForceSearchCodeGen = new BruteForceCodeGen(); 154 //bruteForceSearchCodeGen.Generate(grammar, ast.Terminals.OfType<TerminalNode>(), ast.FitnessFunctionNode.Maximization, solverSourceCode); 155 var mctsCodeGen = new MonteCarloTreeSearchCodeGen(); 156 mctsCodeGen.Generate(grammar, ast.Terminals.OfType<TerminalNode>(), ast.FitnessFunctionNode.Maximization, solverSourceCode); 155 157 } 156 158 -
branches/HeuristicLab.Problems.GPDL/CodeGenerator/RandomSearchCodeGen.cs
r10388 r10400 124 124 var sw = new System.Diagnostics.Stopwatch(); 125 125 sw.Start(); 126 while ( n <= 10000) {126 while (true) { 127 127 128 128 int steps, depth; … … 136 136 if (problem.IsBetter(f, bestF)) { 137 137 bestF = f; 138 _t.PrintTree(0); Console.WriteLine(); 138 139 Console.WriteLine(""{0}\t{1}\t(size={2}, depth={3})"", n, bestF, steps, depth); 139 140 }
Note: See TracChangeset
for help on using the changeset viewer.