Changeset 11851 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming/OffspringSelectionGP.cs
- Timestamp:
- 02/01/15 20:30:44 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming/OffspringSelectionGP.cs
r11847 r11851 8 8 using HeuristicLab.Problems.GrammaticalOptimization; 9 9 using HeuristicLab.Selection; 10 using HeuristicLab.SequentialEngine;11 10 using HeuristicLab.Algorithms.GeneticAlgorithm; 12 11 … … 33 32 public override void Run(int maxEvaluations) { 34 33 var hlProblem = new GenericSymbExprProblem(problem); 35 hlProblem.Evaluator.SolutionEvaluated += OnSolutionEvaluated; // raise solution evaluated event for each GP solution, don't scale quality to 0..1 34 var onEvalLocker = new object(); 35 hlProblem.Evaluator.SolutionEvaluated += (sentence, quality) => { 36 // raise solution evaluated event for each GP solution, don't scale quality to 0..1 37 // need to synchronize in case we are using a parallel engine 38 lock (onEvalLocker) { 39 OnSolutionEvaluated(sentence, quality); 40 } 41 }; 36 42 hlProblem.MaximumSymbolicExpressionTreeLength.Value = MaxSolutionSize; 37 43 hlProblem.MaximumSymbolicExpressionTreeDepth.Value = MaxSolutionDepth;
Note: See TracChangeset
for help on using the changeset viewer.