Changeset 10974 for branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers
- Timestamp:
- 06/11/14 12:07:15 (11 years ago)
- Location:
- branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/GenotypeToPhenotypeMapper.cs
r10968 r10974 34 34 namespace HeuristicLab.Problems.GrammaticalEvolution { 35 35 /// <summary> 36 /// GenotypeToPhenotypeMapper36 /// Abstract base class for GenotypeToPhenotypeMappers 37 37 /// </summary> 38 38 public abstract class GenotypeToPhenotypeMapper : IntegerVectorOperator, IGenotypeToPhenotypeMapper { … … 66 66 67 67 // no terminal node exists for the given parent node 68 if ( possibleSymbolsList.Count() < 1) return null;68 if (!possibleSymbolsList.Any()) return null; 69 69 70 70 var newNode = possibleSymbolsList.SelectRandom(random).CreateTreeNode(); -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/PIGEMapper.cs
r10968 r10974 71 71 public class PIGEMapper : GenotypeToPhenotypeMapper { 72 72 73 private object nontVectorLocker = new object(); 73 74 private IntegerVector nontVector; 74 75 … … 78 79 } 79 80 80 private IntegerVector GetNontVector(IRandom random, IntMatrix bounds, int length) {81 private static IntegerVector GetNontVector(IRandom random, IntMatrix bounds, int length) { 81 82 IntegerVector v = new IntegerVector(length); 82 83 v.Randomize(random, bounds); … … 114 115 tree.Root = rootNode; 115 116 116 if (NontVector == null) { 117 NontVector = GetNontVector(random, bounds, length); 117 // Map can be called simultaniously on multiple threads 118 lock (nontVectorLocker) { 119 if (NontVector == null) { 120 NontVector = GetNontVector(random, bounds, length); 121 } 118 122 } 119 123
Note: See TracChangeset
for help on using the changeset viewer.