Changeset 14029 for branches/crossvalidation-2434/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt
- Timestamp:
- 07/08/16 14:40:02 (8 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.GrammaticalEvolution
- Property svn:mergeinfo changed
/stable/HeuristicLab.Problems.GrammaticalEvolution merged: 13316 /trunk/sources/HeuristicLab.Problems.GrammaticalEvolution merged: 13233,13238-13239,13243,13321,13395,13397,13670
- Property svn:mergeinfo changed
-
branches/crossvalidation-2434/HeuristicLab.Problems.GrammaticalEvolution/3.4/ArtificialAnt/GEArtificialAntProblem.cs
r12915 r14029 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 { 37 [Item("Grammatical Evolution Artificial Ant Problem ", "Represents the Artificial Ant problem, implemented in Grammatical Evolution.")]37 [Item("Grammatical Evolution Artificial Ant Problem (GE)", "Represents the Artificial Ant problem, implemented in Grammatical Evolution.")] 38 38 [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 170)] 39 39 [StorableClass] 40 40 public sealed class GEArtificialAntProblem : SingleObjectiveBasicProblem<IntegerVectorEncoding>, IStorableContent { 41 public string Filename { get; set; }42 41 43 42 #region Parameter Properties … … 98 97 } 99 98 99 private readonly object syncRoot = new object(); 100 100 public override double Evaluate(Individual individual, IRandom random) { 101 101 var vector = individual.IntegerVector(); … … 106 106 var mapper = GenotypeToPhenotypeMapperParameter.Value; 107 107 108 var tree = mapper.Map(random, bounds, len, grammar, vector); 108 // Evaluate might be called concurrently therefore access to random has to be synchronized. 109 // However, results depend on the order of execution. Therefore, results might be different for the same seed when using the parallel engine. 110 IRandom fastRand; 111 lock (syncRoot) { 112 fastRand = new FastRandom(random.Next()); 113 } 114 var tree = mapper.Map(fastRand, bounds, len, grammar, vector); 109 115 110 116 Interpreter interpreter = new Interpreter(tree, World, MaxTimeSteps);
Note: See TracChangeset
for help on using the changeset viewer.