Changeset 10394
- Timestamp:
- 01/24/14 20:07:33 (11 years ago)
- Location:
- branches/HeuristicLab.Problems.GPDL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GPDL/CodeGenerator/BruteForceCodeGen.cs
r10393 r10394 106 106 if (problem.IsBetter(f, bestF)) { 107 107 bestF = f; 108 t.PrintTree(0); Console.WriteLine(); 108 109 Console.WriteLine(""{0}\t{1}\t(size={2}, depth={3})"", n, bestF, size, depth); 109 110 } … … 153 154 sb.AppendFormat("t = new {0}Tree();", terminal.Ident).AppendLine(); 154 155 155 foreach (var constr in terminal.Constraints.Reverse()) { 156 sb.AppendFormat("t.{0} = {0};", constr.Ident).EndBlock(); 157 sb.AppendLine("}"); 156 foreach (var constr in terminal.Constraints) { 157 sb.AppendFormat("t.{0} = {0};", constr.Ident); 158 } 159 sb.AppendLine("yield return t; "); 160 161 foreach (var _ in terminal.Constraints) { 162 sb.AppendLine("}").EndBlock(); 158 163 } 159 164 160 sb.AppendLine("yield return t; ").EndBlock();161 165 162 166 sb.AppendLine(" break; }"); -
branches/HeuristicLab.Problems.GPDL/CodeGenerator/ProblemCodeGen.cs
r10393 r10394 76 76 else return 1 + subtrees.Max(t=>t.GetDepth()); 77 77 } 78 public v oid PrintTree(int curState) {78 public virtual void PrintTree(int curState) { 79 79 Console.Write(""{0} "", Grammar.symb[curState]); 80 80 if(subtrees != null) { … … 254 254 } 255 255 sb.AppendFormat(" public {0}Tree() : base() {{ }}", terminal.Ident).AppendLine(); 256 sb.AppendLine(@" 257 public override void PrintTree(int curState) { 258 Console.Write(""{0} "", Grammar.symb[curState]);"); 259 foreach (var att in terminal.FieldDefinitions) { 260 sb.AppendFormat("Console.Write(\"{{0}} \", {0});", att.Identifier).AppendLine(); 261 } 262 263 sb.AppendLine("}"); 264 256 265 sb.AppendLine("}"); 257 266 } -
branches/HeuristicLab.Problems.GPDL/Examples/symbreg Koza.txt
r10392 r10394 57 57 int n = 500; 58 58 variableNames = new string[] {"x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10" }; 59 var rand = new System.Random( );59 var rand = new System.Random(31415); 60 60 x = new double[n, 10]; 61 61 y = new double[n]; -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.sln
r10392 r10394 116 116 {E2060931-6700-464B-9E82-50846D7AE4E9} = {3768D612-38EB-47D8-9E79-75D8E5AB00A8} 117 117 EndGlobalSection 118 GlobalSection(Performance) = preSolution119 HasPerformanceSessions = true120 EndGlobalSection121 118 EndGlobal
Note: See TracChangeset
for help on using the changeset viewer.