Changeset 11851 for branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming
- Timestamp:
- 02/01/15 20:30:44 (10 years ago)
- 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 67 67 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Selection-3.3.dll</HintPath> 68 68 </Reference> 69 <Reference Include="HeuristicLab.SequentialEngine-3.3">70 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath>71 </Reference>72 69 <Reference Include="System" /> 73 70 <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" />79 71 </ItemGroup> 80 72 <ItemGroup> -
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; -
branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GeneticProgramming/StandardGP.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 … … 35 34 public override void Run(int maxEvaluations) { 36 35 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 }; 38 44 hlProblem.MaximumSymbolicExpressionTreeLength.Value = MaxSolutionSize; 39 45 hlProblem.MaximumSymbolicExpressionTreeDepth.Value = MaxSolutionDepth;
Note: See TracChangeset
for help on using the changeset viewer.