- Timestamp:
- 11/19/15 11:43:07 (9 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13233,13243
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.GrammaticalEvolution
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.GrammaticalEvolution merged: 13233,13243
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntProblem.cs
r12915 r13281 22 22 #endregion 23 23 24 using System.Diagnostics.Contracts;25 24 using System.Linq; 26 25 using HeuristicLab.Common; … … 33 32 using HeuristicLab.Problems.GeneticProgramming.ArtificialAnt; 34 33 using HeuristicLab.Problems.GrammaticalEvolution.Mappers; 34 using HeuristicLab.Random; 35 35 36 36 namespace HeuristicLab.Problems.GrammaticalEvolution { … … 98 98 } 99 99 100 private readonly object syncRoot = new object(); 100 101 public override double Evaluate(Individual individual, IRandom random) { 101 102 var vector = individual.IntegerVector(); … … 106 107 var mapper = GenotypeToPhenotypeMapperParameter.Value; 107 108 108 var tree = mapper.Map(random, bounds, len, grammar, vector); 109 // Evaluate might be called concurrently therefore access to random has to be synchronized. 110 // However, results depend on the order of execution. Therefore, results might be different for the same seed when using the parallel engine. 111 IRandom fastRand; 112 lock (syncRoot) { 113 fastRand = new FastRandom(random.Next()); 114 } 115 var tree = mapper.Map(fastRand, bounds, len, grammar, vector); 109 116 110 117 Interpreter interpreter = new Interpreter(tree, World, MaxTimeSteps);
Note: See TracChangeset
for help on using the changeset viewer.