Changeset 10328 for branches/GrammaticalEvolution
- Timestamp:
- 01/12/14 20:00:02 (11 years ago)
- Location:
- branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/ArtificialAnt/GEArtificialAntEvaluator.cs
r10290 r10328 90 90 91 91 Parameters.Add(new LookupParameter<IntMatrix>("Bounds", "The integer number range in which the single genomes of a genotype are created.")); 92 Parameters.Add(new LookupParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant ."));92 Parameters.Add(new LookupParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant (genotype length).")); 93 93 } 94 94 -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/ArtificialAnt/GEArtificialAntProblem.cs
r10071 r10328 158 158 : base(new GEArtificialAntEvaluator(), new UniformRandomIntegerVectorCreator()) { 159 159 BoolMatrix world = new BoolMatrix(santaFeAntTrail); 160 Parameters.Add(new ValueParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant .", new IntValue(30)));160 Parameters.Add(new ValueParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant (genotype length).", new IntValue(30))); 161 161 Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("ArtificialAntExpressionGrammar", "The grammar that should be used for artificial ant expressions.", new ArtificialAntExpressionGrammar())); 162 162 Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world)); -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/BreathFirstMapper.cs
r10290 r10328 52 52 /// </summary> 53 53 /// <param name="random">random number generator</param> 54 /// <param name="bounds">only used for PIGEMapper (ignore here)</param> 55 /// <param name="length">only used for PIGEMapper (ignore here)</param> 54 56 /// <param name="grammar">grammar definition</param> 55 57 /// <param name="genotype">integer vector, which should be mapped to a tree</param> -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/DepthFirstMapper.cs
r10290 r10328 52 52 /// </summary> 53 53 /// <param name="random">random number generator</param> 54 /// <param name="bounds">only used for PIGEMapper (ignore here)</param> 55 /// <param name="length">only used for PIGEMapper (ignore here)</param> 54 56 /// <param name="grammar">grammar definition</param> 55 57 /// <param name="genotype">integer vector, which should be mapped to a tree</param> -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/GenotypeToPhenotypeMapper.cs
r10290 r10328 97 97 if (prodRuleCount < 1) return null; 98 98 99 // genotypeIndex % genotype.Length 99 // genotypeIndex % genotype.Length, if wrapping is allowed 100 100 int prodRuleIndex = genotype[genotypeIndex] % prodRuleCount; 101 101 -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/PIGEMapper.cs
r10290 r10328 97 97 /// </summary> 98 98 /// <param name="random">random number generator</param> 99 /// <param name="bounds">integer number range for genomes (codons) of the nont vector</param> 100 /// <param name="length">length of the nont vector to create</param> 99 101 /// <param name="grammar">grammar definition</param> 100 102 /// <param name="genotype">integer vector, which should be mapped to a tree</param> … … 121 123 122 124 125 /// <summary> 126 /// Genotype-to-Phenotype mapper (iterative 𝜋GE approach, using a list of not expanded nonTerminals). 127 /// </summary> 128 /// <param name="startNode">first node of the tree with arity 1</param> 129 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 130 /// <param name="grammar">grammar to determine the allowed child symbols for each node</param> 131 /// <param name="maxSubtreeCount">maximum allowed subtrees (= number of used genomes)</param> 132 /// <param name="random">random number generator</param> 123 133 private void MapPIGEIteratively(ISymbolicExpressionTreeNode startNode, 124 134 IntegerVector genotype, -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/RandomMapper.cs
r10290 r10328 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 31 32 /// RandomMapper 32 33 /// </summary> 33 [Item("RandomMapper", " ")]34 [Item("RandomMapper", "Randomly determines the next non-terminal symbol to expand.")] 34 35 [StorableClass] 35 36 public class RandomMapper : GenotypeToPhenotypeMapper { … … 50 51 /// </summary> 51 52 /// <param name="random">random number generator</param> 53 /// <param name="bounds">only used for PIGEMapper (ignore here)</param> 54 /// <param name="length">only used for PIGEMapper (ignore here)</param> 52 55 /// <param name="grammar">grammar definition</param> 53 56 /// <param name="genotype">integer vector, which should be mapped to a tree</param> … … 63 66 tree.Root = rootNode; 64 67 65 // TODO 68 MapRandomIteratively(startNode, genotype, grammar, 69 genotype.Length, random); 66 70 67 71 return tree; 68 72 } 73 74 75 /// <summary> 76 /// Genotype-to-Phenotype mapper (iterative random approach, where the next non-terminal 77 /// symbol to expand is randomly determined). 78 /// </summary> 79 /// <param name="startNode">first node of the tree with arity 1</param> 80 /// <param name="genotype">integer vector, which should be mapped to a tree</param> 81 /// <param name="grammar">grammar to determine the allowed child symbols for each node</param> 82 /// <param name="maxSubtreeCount">maximum allowed subtrees (= number of used genomes)</param> 83 /// <param name="random">random number generator</param> 84 private void MapRandomIteratively(ISymbolicExpressionTreeNode startNode, 85 IntegerVector genotype, 86 ISymbolicExpressionGrammar grammar, 87 int maxSubtreeCount, IRandom random) { 88 89 List<ISymbolicExpressionTreeNode> nonTerminals = new List<ISymbolicExpressionTreeNode>(); 90 91 int genotypeIndex = 0; 92 nonTerminals.Add(startNode); 93 94 while (nonTerminals.Count > 0) { 95 if (genotypeIndex >= maxSubtreeCount) { 96 // if all genomes were used, only add terminal nodes to the remaining subtrees 97 ISymbolicExpressionTreeNode current = nonTerminals[0]; 98 nonTerminals.RemoveAt(0); 99 current.AddSubtree(GetRandomTerminalNode(current, grammar, random)); 100 } else { 101 // similar to PIGEMapper, but here the current node is determined randomly ... 102 ISymbolicExpressionTreeNode current = nonTerminals.SelectRandom(random); 103 nonTerminals.Remove(current); 104 105 ISymbolicExpressionTreeNode newNode = GetNewChildNode(current, genotype, grammar, genotypeIndex, random); 106 int arity = SampleArity(random, newNode, grammar); 107 108 current.AddSubtree(newNode); 109 genotypeIndex++; 110 // new node has subtrees, so add "arity" number of copies of this node to the nonTerminals list 111 for (int i = 0; i < arity; ++i) { 112 nonTerminals.Add(newNode); 113 } 114 } 115 } 116 } 69 117 } 70 118 } -
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Symbolic/GESymbolicRegressionSingleObjectiveProblem.cs
r10276 r10328 38 38 IRegressionProblem { 39 39 private const double PunishmentFactor = 10; 40 private const int InitialMaximumTreeLength = 25;40 private const int InitialMaximumTreeLength = 30; 41 41 private const string EstimationLimitsParameterName = "EstimationLimits"; 42 42 private const string EstimationLimitsParameterDescription
Note: See TracChangeset
for help on using the changeset viewer.