Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/01/15 20:30:44 (9 years ago)
Author:
gkronber
Message:

#2283: solution reorganization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming/OffspringSelectionGP.cs

    r11847 r11851  
    88using HeuristicLab.Problems.GrammaticalOptimization;
    99using HeuristicLab.Selection;
    10 using HeuristicLab.SequentialEngine;
    1110using HeuristicLab.Algorithms.GeneticAlgorithm;
    1211
     
    3332    public override void Run(int maxEvaluations) {
    3433      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      };
    3642      hlProblem.MaximumSymbolicExpressionTreeLength.Value = MaxSolutionSize;
    3743      hlProblem.MaximumSymbolicExpressionTreeDepth.Value = MaxSolutionDepth;
Note: See TracChangeset for help on using the changeset viewer.