Free cookie consent management tool by TermsFeed Policy Generator

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

#2283: solution reorganization

Location:
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming
Files:
3 edited

Legend:

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

    r11847 r11851  
    6767      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Selection-3.3.dll</HintPath>
    6868    </Reference>
    69     <Reference Include="HeuristicLab.SequentialEngine-3.3">
    70       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
    71     </Reference>
    7269    <Reference Include="System" />
    7370    <Reference Include="System.Core" />
    74     <Reference Include="System.Xml.Linq" />
    75     <Reference Include="System.Data.DataSetExtensions" />
    76     <Reference Include="Microsoft.CSharp" />
    77     <Reference Include="System.Data" />
    78     <Reference Include="System.Xml" />
    7971  </ItemGroup>
    8072  <ItemGroup>
  • 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;
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming/StandardGP.cs

    r11847 r11851  
    88using HeuristicLab.Problems.GrammaticalOptimization;
    99using HeuristicLab.Selection;
    10 using HeuristicLab.SequentialEngine;
    1110using HeuristicLab.Algorithms.GeneticAlgorithm;
    1211
     
    3534    public override void Run(int maxEvaluations) {
    3635      var hlProblem = new GenericSymbExprProblem(problem);
    37       hlProblem.Evaluator.SolutionEvaluated += OnSolutionEvaluated; // raise solution evaluated event for each GP solution, don't scale quality to 0..1
     36      var onEvalLocker = new object();
     37      hlProblem.Evaluator.SolutionEvaluated += (sentence, quality) => {
     38        // raise solution evaluated event for each GP solution, don't scale quality to 0..1
     39        // need to synchronize in case we are using a parallel engine
     40        lock (onEvalLocker) {
     41          OnSolutionEvaluated(sentence, quality);
     42        }
     43      };
    3844      hlProblem.MaximumSymbolicExpressionTreeLength.Value = MaxSolutionSize;
    3945      hlProblem.MaximumSymbolicExpressionTreeDepth.Value = MaxSolutionDepth;
Note: See TracChangeset for help on using the changeset viewer.