Changeset 10280 for branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers
- Timestamp:
- 01/05/14 12:53:58 (11 years ago)
- Location:
- branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/BreathFirstMapper.cs
r10277 r10280 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Random;30 29 31 30 namespace HeuristicLab.Problems.GrammaticalEvolution { … … 51 50 /// Breath-first approach. 52 51 /// </summary> 52 /// <param name="random">random number generator</param> 53 53 /// <param name="grammar">grammar definition</param> 54 54 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 55 55 /// <returns>phenotype (a symbolic expression tree)</returns> 56 public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar, 56 public override SymbolicExpressionTree Map(IRandom random, 57 ISymbolicExpressionGrammar grammar, 57 58 IntegerVector genotype) { 58 59 … … 64 65 65 66 MapBreathFirstIteratively(startNode, genotype, grammar, 66 genotype.Length, new MersenneTwister());67 genotype.Length, random); 67 68 68 69 return tree; -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/DepthFirstMapper.cs
r10277 r10280 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Random;30 29 31 30 namespace HeuristicLab.Problems.GrammaticalEvolution { … … 51 50 /// Depth-first approach. 52 51 /// </summary> 52 /// <param name="random">random number generator</param> 53 53 /// <param name="grammar">grammar definition</param> 54 54 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 55 55 /// <returns>phenotype (a symbolic expression tree)</returns> 56 public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar, 56 public override SymbolicExpressionTree Map(IRandom random, 57 ISymbolicExpressionGrammar grammar, 57 58 IntegerVector genotype) { 58 59 59 60 SymbolicExpressionTree tree = new SymbolicExpressionTree(); 60 61 var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode(); 61 if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters( new MersenneTwister());62 if (rootNode.HasLocalParameters) rootNode.ResetLocalParameters(random); 62 63 var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode(); 63 if (startNode.HasLocalParameters) startNode.ResetLocalParameters( new MersenneTwister());64 if (startNode.HasLocalParameters) startNode.ResetLocalParameters(random); 64 65 rootNode.AddSubtree(startNode); 65 66 tree.Root = rootNode; 66 67 67 68 MapDepthFirstIteratively(startNode, genotype, grammar, 68 genotype.Length, new MersenneTwister());69 genotype.Length, random); 69 70 return tree; 70 71 } -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/GenotypeToPhenotypeMapper.cs
r10277 r10280 40 40 protected GenotypeToPhenotypeMapper() : base() { } 41 41 42 public abstract SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar, 42 public abstract SymbolicExpressionTree Map(IRandom random, 43 ISymbolicExpressionGrammar grammar, 43 44 IntegerVector genotype); 44 45 -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/IGenotypeToPhenotypeMapper.cs
r10068 r10280 20 20 #endregion 21 21 22 using HeuristicLab.Core; 22 23 using HeuristicLab.Encodings.IntegerVectorEncoding; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 28 29 /// </summary> 29 30 public interface IGenotypeToPhenotypeMapper : IIntegerVectorOperator { 30 SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar, 31 SymbolicExpressionTree Map(IRandom random, 32 ISymbolicExpressionGrammar grammar, 31 33 IntegerVector genotype); 32 34 } -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/PIGEMapper.cs
r10068 r10280 48 48 /// PIGE approach. 49 49 /// </summary> 50 /// <param name="random">random number generator</param> 50 51 /// <param name="grammar">grammar definition</param> 51 52 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 52 53 /// <returns>phenotype (a symbolic expression tree)</returns> 53 public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar, 54 public override SymbolicExpressionTree Map(IRandom random, 55 ISymbolicExpressionGrammar grammar, 54 56 IntegerVector genotype) { 55 57 -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/RandomMapper.cs
r10068 r10280 48 48 /// Random approach. 49 49 /// </summary> 50 /// <param name="random">random number generator</param> 50 51 /// <param name="grammar">grammar definition</param> 51 52 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 52 53 /// <returns>phenotype (a symbolic expression tree)</returns> 53 public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar, 54 public override SymbolicExpressionTree Map(IRandom random, 55 ISymbolicExpressionGrammar grammar, 54 56 IntegerVector genotype) { 55 57
Note: See TracChangeset
for help on using the changeset viewer.