- Timestamp:
- 02/11/15 03:01:59 (10 years ago)
- Location:
- branches/HeuristicLab.Problems.GrammaticalOptimization/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/Main/Main.csproj
r11849 r11977 56 56 <Name>HeuristicLab.Algorithms.GrammaticalOptimization</Name> 57 57 </ProjectReference> 58 <ProjectReference Include="..\HeuristicLab.Common\HeuristicLab.Common.csproj"> 59 <Project>{3A2FBBCB-F9DF-4970-87F3-F13337D941AD}</Project> 60 <Name>HeuristicLab.Common</Name> 61 </ProjectReference> 58 62 <ProjectReference Include="..\HeuristicLab.Distributions\HeuristicLab.Distributions.csproj"> 59 63 <Project>{31171165-E16F-4A1A-A8AB-25C6AB3A71B9}</Project> -
branches/HeuristicLab.Problems.GrammaticalOptimization/Main/Program.cs
r11976 r11977 13 13 using HeuristicLab.Algorithms.GeneticProgramming; 14 14 using HeuristicLab.Algorithms.GrammaticalOptimization; 15 using HeuristicLab.Common; 15 16 using HeuristicLab.Problems.GrammaticalOptimization; 16 17 using HeuristicLab.Problems.GrammaticalOptimization.SymbReg; … … 30 31 // RunGridTest(); 31 32 //RunGpGridTest(); 32 RunFunApproxTest();33 RunFunApproxTest(); 33 34 } 34 35 … … 308 309 309 310 private static void RunFunApproxTest() { 310 const int nReps = 20;311 const int nReps = 30; 311 312 const int seed = 31415; 312 313 //const int maxIters = 50000; … … 314 315 var problemFactories = new Func<Tuple<int, int, ISymbolicExpressionTreeProblem>>[] 315 316 { 316 //() => Tuple.Create(100000, 23, (ISymbolicExpressionTreeProblem)new SymbolicRegressionPoly10Problem()),317 () => Tuple.Create(100000, 23, (ISymbolicExpressionTreeProblem)new SymbolicRegressionPoly10Problem()), 317 318 () => Tuple.Create(100000, 17, (ISymbolicExpressionTreeProblem)new SantaFeAntProblem()), 318 319 //() => Tuple.Create(50000, 32,(ISymbolicExpressionTreeProblem)new RoyalSymbolProblem()), … … 330 331 331 332 // skip experiments that are already done 332 for each (var problemFactory in problemFactories) {333 for (int i = 0; i < nReps; i++) {333 for (int i = 0; i < nReps; i++) { 334 foreach (var problemFactory in problemFactories) { 334 335 { 335 336 var solverSeed = rand.Next(); … … 343 344 344 345 int iterations = 0; 346 double bestQuality = double.NegativeInfinity; 345 347 var globalStatistics = new SentenceSetStatistics(prob.BestKnownQuality(maxSize)); 346 348 var algName = alg.GetType().Name; 347 349 var probName = prob.GetType().Name; 348 350 alg.SolutionEvaluated += (sentence, quality) => { 351 bestQuality = Math.Max(bestQuality, quality); 349 352 iterations++; 350 353 globalStatistics.AddSentence(sentence, quality); … … 357 360 if (iterations % 200 == 0) { 358 361 Console.WriteLine("\"{0,25}\" {1} \"{2,25}\" {3}", algName, maxSize, probName, globalStatistics); 362 if (bestQuality.IsAlmost(1.0)) { 363 alg.StopRequested = true; 364 } 359 365 } 360 366 };
Note: See TracChangeset
for help on using the changeset viewer.