Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/20/13 18:44:04 (10 years ago)
Author:
sawinkle
Message:

#2109:

  • Removed the parameters MaxFunctionDefinitions and MaxFunctionArguments from GEArtificialAntProblem.cs, because automatically defined functions (adf) won't be supported by the Grammatical Evolution implementation of the Artificial Ant problem.
  • Switched from SharpDevelop to Visual Studio 2012 and installed 'Productivity Power Tools 2012'. This extension includes the options 'Format Document on save' and 'Remove and Sort Usings on save', so that some usings were deleted, sorted and the formating changed slightly. Furthermore 'Visual Studio 2010 text editor settings.vssettings' were included.
  • Added new folders ArtificialAnt and Symbolic to separate the files for the ArtificialAnt problem and the Symbolic Regression problem (single objective).
Location:
branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/GEArtificialAntEvaluator.cs

    r10039 r10068  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
     25using HeuristicLab.Encodings.IntegerVectorEncoding;
    2526using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    26 using HeuristicLab.Problems.ArtificialAnt;
    2727using HeuristicLab.Operators;
    2828using HeuristicLab.Optimization;
    2929using HeuristicLab.Parameters;
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Encodings.IntegerVectorEncoding;
     31using HeuristicLab.Problems.ArtificialAnt;
    3232using HeuristicLab.Problems.GrammaticalEvolution.Mappers;
    3333
     
    3838    ISingleObjectiveEvaluator, ISymbolicExpressionTreeGrammarBasedOperator {
    3939
    40     #region Parameter Properties
     40    #region Parameter Properties
    4141    public ILookupParameter<DoubleValue> QualityParameter {
    4242      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
    4343    }
    44     // genotype:
    45     public ILookupParameter<IntegerVector> IntegerVectorParameter {
     44    // genotype:
     45    public ILookupParameter<IntegerVector> IntegerVectorParameter {
    4646      get { return (ILookupParameter<IntegerVector>)Parameters["IntegerVector"]; }
    4747    }
    48     // phenotype:
     48    // phenotype:
    4949    public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
    5050      get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; }
     
    5656      get { return (ILookupParameter<IntValue>)Parameters["MaxTimeSteps"]; }
    5757    }
    58     public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
     58    public IValueLookupParameter<ISymbolicExpressionGrammar> SymbolicExpressionTreeGrammarParameter {
    5959      get { return (IValueLookupParameter<ISymbolicExpressionGrammar>)Parameters["SymbolicExpressionTreeGrammar"]; }
    6060    }
    61     // genotype-to-phenotype-mapper:
    62     public ILookupParameter<IGenotypeToPhenotypeMapper> GenotypeToPhenotypeMapperParameter {
     61    // genotype-to-phenotype-mapper:
     62    public ILookupParameter<IGenotypeToPhenotypeMapper> GenotypeToPhenotypeMapperParameter {
    6363      get { return (ILookupParameter<IGenotypeToPhenotypeMapper>)Parameters["GenotypeToPhenotypeMapper"]; }
    6464    }
    65     #endregion
    66  
     65    #endregion
     66
    6767    [StorableConstructor]
    6868    protected GEArtificialAntEvaluator(bool deserializing) : base(deserializing) { }
     
    8181
    8282    public sealed override IOperation Apply() {
    83       SymbolicExpressionTree expression = GenotypeToPhenotypeMapperParameter.ActualValue.Map (
     83      SymbolicExpressionTree expression = GenotypeToPhenotypeMapperParameter.ActualValue.Map(
    8484        SymbolicExpressionTreeGrammarParameter.ActualValue,
    85         IntegerVectorParameter.ActualValue       
     85        IntegerVectorParameter.ActualValue
    8686      );
    8787      SymbolicExpressionTreeParameter.ActualValue = expression;
    8888      BoolMatrix world = WorldParameter.ActualValue;
    8989      IntValue maxTimeSteps = MaxTimeStepsParameter.ActualValue;
    90  
     90
    9191      AntInterpreter interpreter = new AntInterpreter();
    92       interpreter.MaxTimeSteps   = maxTimeSteps.Value;
    93       interpreter.World          = world;
    94       interpreter.Expression     = expression;
     92      interpreter.MaxTimeSteps = maxTimeSteps.Value;
     93      interpreter.World = world;
     94      interpreter.Expression = expression;
    9595      interpreter.Run();
    9696
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/GEArtificialAntProblem.cs

    r10039 r10068  
    4242  public sealed class GEArtificialAntProblem : SingleObjectiveHeuristicOptimizationProblem<GEArtificialAntEvaluator, IIntegerVectorCreator>, IStorableContent {
    4343    public string Filename { get; set; }
    44    
     44
    4545    #region constant for default world (Santa Fe)
    4646    private readonly bool[,] santaFeAntTrail = new bool[,] {
     
    8787      get { return (IValueParameter<IntValue>)Parameters["MaximumExpressionLength"]; }
    8888    }
    89     public IValueParameter<IntValue> MaxFunctionDefinitionsParameter {
    90       get { return (IValueParameter<IntValue>)Parameters["MaximumFunctionDefinitions"]; }
    91     }
    92     public IValueParameter<IntValue> MaxFunctionArgumentsParameter {
    93       get { return (ValueParameter<IntValue>)Parameters["MaximumFunctionArguments"]; }
    94     }
    9589    public IValueParameter<BoolMatrix> WorldParameter {
    9690      get { return (IValueParameter<BoolMatrix>)Parameters["World"]; }
     
    119113      get { return MaxExpressionLengthParameter.Value; }
    120114      set { MaxExpressionLengthParameter.Value = value; }
    121     }
    122     public IntValue MaxFunctionDefinitions {
    123       get { return MaxFunctionDefinitionsParameter.Value; }
    124       set { MaxFunctionDefinitionsParameter.Value = value; }
    125     }
    126     public IntValue MaxFunctionArguments {
    127       get { return MaxFunctionArgumentsParameter.Value; }
    128       set { MaxFunctionArgumentsParameter.Value = value; }
    129115    }
    130116    public ArtificialAntExpressionGrammar ArtificialAntExpressionGrammar {
     
    164150      RegisterEventHandlers();
    165151    }
     152
    166153    public override IDeepCloneable Clone(Cloner cloner) {
    167154      return new GEArtificialAntProblem(this, cloner);
    168155    }
     156
    169157    public GEArtificialAntProblem()
    170158      : base(new GEArtificialAntEvaluator(), new UniformRandomIntegerVectorCreator()) {
    171159      BoolMatrix world = new BoolMatrix(santaFeAntTrail);
    172160      Parameters.Add(new ValueParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant.", new IntValue(30)));
    173       Parameters.Add(new ValueParameter<IntValue>("MaximumFunctionDefinitions", "Maximal number of automatically defined functions in the expression to control the artificial ant.", new IntValue(3)));
    174       Parameters.Add(new ValueParameter<IntValue>("MaximumFunctionArguments", "Maximal number of arguments of automatically defined functions in the expression to control the artificial ant.", new IntValue(3)));
    175161      Parameters.Add(new ValueParameter<ISymbolicExpressionGrammar>("ArtificialAntExpressionGrammar", "The grammar that should be used for artificial ant expressions.", new ArtificialAntExpressionGrammar()));
    176162      Parameters.Add(new ValueParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items.", world));
    177163      Parameters.Add(new ValueParameter<IntValue>("MaximumTimeSteps", "The number of time steps the artificial ant has available to collect all food items.", new IntValue(600)));
    178       IntMatrix m = new IntMatrix(new int[,]{{0,100}});
     164      IntMatrix m = new IntMatrix(new int[,] { { 0, 100 } });
    179165      Parameters.Add(new ValueParameter<IntMatrix>("Bounds", "The integer number range in which the single genomes of a genotype are created.", m));
    180166      Parameters.Add(new ValueParameter<IGenotypeToPhenotypeMapper>("GenotypeToPhenotypeMapper", "Maps the genotype (an integer vector) to the phenotype (a symbolic expression tree).", new DepthFirstMapper()));
    181      
     167
    182168      Maximization.Value = true;
    183169      MaximizationParameter.Hidden = true;
    184170      BestKnownQuality = new DoubleValue(89);
    185      
     171
    186172      SolutionCreator.IntegerVectorParameter.ActualName = "AntTrailSolutionIntegerVector";
    187173      Evaluator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolutionTree";
    188174      Evaluator.SymbolicExpressionTreeGrammarParameter.ActualName = "ArtificialAntExpressionGrammar";
    189175      Evaluator.QualityParameter.ActualName = "FoodEaten";
    190      
     176
    191177      InitializeOperators();
    192178      RegisterEventHandlers();
     
    196182    protected override void OnSolutionCreatorChanged() {
    197183      base.OnSolutionCreatorChanged();
    198      
     184
    199185      SolutionCreator.IntegerVectorParameter.ActualName = "AntTrailSolutionIntegerVector";
    200186      SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
    201      
    202       ParameterizeAnalyzers();
    203       ParameterizeOperators();
    204     }
    205    
     187
     188      ParameterizeAnalyzers();
     189      ParameterizeOperators();
     190    }
     191
    206192    protected override void OnEvaluatorChanged() {
    207193      base.OnEvaluatorChanged();
    208      
     194
    209195      Evaluator.SymbolicExpressionTreeParameter.ActualName = "AntTrailSolutionTree";
    210196      Evaluator.SymbolicExpressionTreeGrammarParameter.ActualName = "ArtificialAntExpressionGrammar";
    211197      Evaluator.QualityParameter.ActualName = "FoodEaten";
    212      
     198
    213199      Evaluator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged);
    214200      Evaluator.SymbolicExpressionTreeGrammarParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeGrammarParameter_ActualNameChanged);
    215201      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    216      
    217       ParameterizeAnalyzers();
    218       ParameterizeOperators();
    219     }
    220    
     202
     203      ParameterizeAnalyzers();
     204      ParameterizeOperators();
     205    }
     206
    221207    private void SolutionCreator_IntegerVectorParameter_ActualNameChanged(object sender, EventArgs e) {
    222208      ParameterizeAnalyzers();
    223209      ParameterizeOperators();
    224210    }
    225    
     211
    226212    private void Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged(object sender, EventArgs e) {
    227213      ParameterizeAnalyzers();
    228214      ParameterizeOperators();
    229215    }
    230    
     216
    231217    private void Evaluator_SymbolicExpressionTreeGrammarParameter_ActualNameChanged(object sender, EventArgs e) {
    232218      ParameterizeAnalyzers();
    233219      ParameterizeOperators();
    234220    }
    235    
     221
    236222    private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    237223      ParameterizeAnalyzers();
     
    242228    #region Helpers
    243229    private void RegisterEventHandlers() {
    244       SolutionCreator.IntegerVectorParameter.ActualNameChanged           += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
    245       Evaluator.SymbolicExpressionTreeParameter.ActualNameChanged        += new EventHandler(Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged);
     230      SolutionCreator.IntegerVectorParameter.ActualNameChanged += new EventHandler(SolutionCreator_IntegerVectorParameter_ActualNameChanged);
     231      Evaluator.SymbolicExpressionTreeParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeParameter_ActualNameChanged);
    246232      Evaluator.SymbolicExpressionTreeGrammarParameter.ActualNameChanged += new EventHandler(Evaluator_SymbolicExpressionTreeGrammarParameter_ActualNameChanged);
    247233      Evaluator.QualityParameter.ActualNameChanged += new EventHandler(Evaluator_QualityParameter_ActualNameChanged);
    248       MaxFunctionArgumentsParameter.ValueChanged   += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged);
    249       MaxFunctionArguments.ValueChanged            += new EventHandler(MaxFunctionArgumentsParameter_ValueChanged);
    250       MaxFunctionDefinitionsParameter.ValueChanged += new EventHandler(MaxFunctionDefinitionsParameter_ValueChanged);
    251       MaxFunctionDefinitions.ValueChanged          += new EventHandler(MaxFunctionDefinitionsParameter_ValueChanged);
    252     }
    253 
    254     private void MaxFunctionDefinitionsParameter_ValueChanged(object sender, EventArgs e) {
    255       ArtificialAntExpressionGrammar.MaximumFunctionDefinitions = MaxFunctionDefinitions.Value;
    256       ParameterizeOperators();
    257       ParameterizeAnalyzers();
    258     }
    259     private void MaxFunctionArgumentsParameter_ValueChanged(object sender, EventArgs e) {
    260       ArtificialAntExpressionGrammar.MaximumFunctionArguments = MaxFunctionArguments.Value;
    261       ParameterizeOperators();
    262       ParameterizeAnalyzers();
    263234    }
    264235
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/BreathFirstMapper.cs

    r10039 r10068  
    2020#endregion
    2121
    22 using System;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    3433  [StorableClass]
    3534  public class BreathFirstMapper : GenotypeToPhenotypeMapper {
    36    
     35
    3736    [StorableConstructor]
    3837    protected BreathFirstMapper(bool deserializing) : base(deserializing) { }
     
    4342      return new BreathFirstMapper(this, cloner);
    4443    }
    45    
    46    
     44
     45
    4746    /// <summary>
    4847    /// Maps a genotype (an integer vector) to a phenotype (a symbolic expression tree).
     
    5453    public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar,
    5554                                               IntegerVector genotype) {
    56      
     55
    5756      SymbolicExpressionTree tree = new SymbolicExpressionTree();
    58       var rootNode  = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
     57      var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
    5958      var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
    6059      rootNode.AddSubtree(startNode);
    6160      tree.Root = rootNode;
    62      
     61
    6362      // TODO
    64      
     63
    6564      return tree;
    6665    }
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/DepthFirstMapper.cs

    r10039 r10068  
    2020#endregion
    2121
    22 using System;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    3433  [StorableClass]
    3534  public class DepthFirstMapper : GenotypeToPhenotypeMapper {
    36    
     35
    3736    [StorableConstructor]
    3837    protected DepthFirstMapper(bool deserializing) : base(deserializing) { }
     
    4342      return new DepthFirstMapper(this, cloner);
    4443    }
    45    
    46    
     44
     45
    4746    /// <summary>
    4847    /// Maps a genotype (an integer vector) to a phenotype (a symbolic expression tree).
     
    5453    public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar,
    5554                                               IntegerVector genotype) {
    56      
     55
    5756      SymbolicExpressionTree tree = new SymbolicExpressionTree();
    58       var rootNode  = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
     57      var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
    5958      var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
    6059      rootNode.AddSubtree(startNode);
    6160      tree.Root = rootNode;
    62      
    63       int genotypeIndex    = 0;
     61
     62      int genotypeIndex = 0;
    6463      int currSubtreeCount = 1;
    65      
     64
    6665      MapDepthFirstRecursively(startNode, genotype,
    6766                               grammar, genotype.Length,
    6867                               ref genotypeIndex, ref currSubtreeCount);
    69      
     68
    7069      return tree;
    7170    }
    72    
    73    
     71
     72
    7473    /// <summary>
    7574    /// Genotype-to-Phenotype mapper (recursive depth-first approach).
     
    9392                                          ref int genotypeIndex,
    9493                                          ref int currSubtreeCount) {
    95       if (currSubtreeCount < maxSubtreeCount) {
    96      
     94      if (currSubtreeCount < maxSubtreeCount) {
     95
    9796        var newNode = GetNewChildNode(currentNode, genotype, grammar, genotypeIndex);
    98        
     97
    9998        if ((currSubtreeCount + newNode.Symbol.MaximumArity) > maxSubtreeCount) {
    10099          // TODO: maybe check, if there is any node, which fits in the tree yet
     
    102101        } else {
    103102          currentNode.AddSubtree(newNode);
    104           genotypeIndex++;
    105           currSubtreeCount += newNode.Symbol.MaximumArity;
    106        
    107           while (newNode.Symbol.MaximumArity > newNode.SubtreeCount) {
    108             MapDepthFirstRecursively(newNode, genotype,
    109                                      grammar, maxSubtreeCount,
    110                                      ref genotypeIndex, ref currSubtreeCount);
    111           }
     103          genotypeIndex++;
     104          currSubtreeCount += newNode.Symbol.MaximumArity;
     105
     106          while (newNode.Symbol.MaximumArity > newNode.SubtreeCount) {
     107            MapDepthFirstRecursively(newNode, genotype,
     108                                     grammar, maxSubtreeCount,
     109                                     ref genotypeIndex, ref currSubtreeCount);
     110          }
    112111        }
    113        
     112
    114113      } else {
    115114        while (currentNode.Symbol.MaximumArity > currentNode.SubtreeCount) {
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/GenotypeToPhenotypeMapper.cs

    r10039 r10068  
    3434  /// </summary>
    3535  public abstract class GenotypeToPhenotypeMapper : IntegerVectorOperator, IGenotypeToPhenotypeMapper {
    36    
     36
    3737    [StorableConstructor]
    3838    protected GenotypeToPhenotypeMapper(bool deserializing) : base(deserializing) { }
    3939    protected GenotypeToPhenotypeMapper(GenotypeToPhenotypeMapper original, Cloner cloner) : base(original, cloner) { }
    4040    protected GenotypeToPhenotypeMapper() : base() { }
    41    
     41
    4242    public abstract SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar,
    4343                                               IntegerVector genotype);
    44    
     44
    4545    /// <summary>
    4646    /// Randomly returns a terminal node for the given <paramref name="parentNode"/>.
     
    5151    /// <returns>randomly chosen terminal node with arity 0</returns>
    5252    protected ISymbolicExpressionTreeNode GetRandomTerminalNode(ISymbolicExpressionTreeNode parentNode,
    53                                                               ISymbolicExpressionGrammar  grammar) {
    54       var possibleSymbolsList = from   s in grammar.GetAllowedChildSymbols(parentNode.Symbol)
    55                                 where  s.MaximumArity == 0
    56                                 where  s.MinimumArity == 0
     53                                                              ISymbolicExpressionGrammar grammar) {
     54      var possibleSymbolsList = from s in grammar.GetAllowedChildSymbols(parentNode.Symbol)
     55                                where s.MaximumArity == 0
     56                                where s.MinimumArity == 0
    5757                                select s;
    5858      // TODO: Check, if symbol list is empty (no terminal nodes found) - what should happen?
    5959      return possibleSymbolsList.SelectRandom(new MersenneTwister()).CreateTreeNode();
    6060    }
    61    
    62    
     61
     62
    6363    /// <summary>
    6464    /// Returns a randomly chosen child node for the given <paramref name="parentNode"/>.
     
    7373                                                          ISymbolicExpressionGrammar grammar,
    7474                                                          int genotypeIndex) {
    75      
     75
    7676      IEnumerable<ISymbol> symbolList = grammar.GetAllowedChildSymbols(parentNode.Symbol);
    7777      int prodRuleCount = symbolList.Count();
    7878      int prodRuleIndex = genotype[genotypeIndex % genotype.Length] % prodRuleCount;
    79      
     79
    8080      return symbolList.ElementAt(prodRuleIndex).CreateTreeNode();
    8181    }
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/IGenotypeToPhenotypeMapper.cs

    r10039 r10068  
    2020#endregion
    2121
    22 using System;
    2322using HeuristicLab.Encodings.IntegerVectorEncoding;
    2423using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/PIGEMapper.cs

    r10039 r10068  
    2020#endregion
    2121
    22 using System;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    2928namespace HeuristicLab.Problems.GrammaticalEvolution {
    3029  /// <summary>
    31   /// PIGEMapper
     30  /// Position Independent (PI) Grammatical Evolution Mapper
    3231  /// </summary>
    3332  [Item("PIGEMapper", "")]
    3433  [StorableClass]
    3534  public class PIGEMapper : GenotypeToPhenotypeMapper {
    36    
     35
    3736    [StorableConstructor]
    3837    protected PIGEMapper(bool deserializing) : base(deserializing) { }
     
    4342      return new PIGEMapper(this, cloner);
    4443    }
    45    
    46    
     44
     45
    4746    /// <summary>
    4847    /// Maps a genotype (an integer vector) to a phenotype (a symbolic expression tree).
     
    5453    public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar,
    5554                                               IntegerVector genotype) {
    56      
     55
    5756      SymbolicExpressionTree tree = new SymbolicExpressionTree();
    58       var rootNode  = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
     57      var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
    5958      var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
    6059      rootNode.AddSubtree(startNode);
    6160      tree.Root = rootNode;
    62      
     61
    6362      // TODO
    64      
     63
    6564      return tree;
    6665    }
  • branches/GrammaticalEvolution/HeuristicLab.Problems.GrammaticalEvolution/Mappers/RandomMapper.cs

    r10039 r10068  
    2020#endregion
    2121
    22 using System;
    2322using HeuristicLab.Common;
    2423using HeuristicLab.Core;
     
    3433  [StorableClass]
    3534  public class RandomMapper : GenotypeToPhenotypeMapper {
    36    
     35
    3736    [StorableConstructor]
    3837    protected RandomMapper(bool deserializing) : base(deserializing) { }
     
    4342      return new RandomMapper(this, cloner);
    4443    }
    45    
    46    
     44
     45
    4746    /// <summary>
    4847    /// Maps a genotype (an integer vector) to a phenotype (a symbolic expression tree).
     
    5453    public override SymbolicExpressionTree Map(ISymbolicExpressionGrammar grammar,
    5554                                               IntegerVector genotype) {
    56      
     55
    5756      SymbolicExpressionTree tree = new SymbolicExpressionTree();
    58       var rootNode  = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
     57      var rootNode = (SymbolicExpressionTreeTopLevelNode)grammar.ProgramRootSymbol.CreateTreeNode();
    5958      var startNode = (SymbolicExpressionTreeTopLevelNode)grammar.StartSymbol.CreateTreeNode();
    6059      rootNode.AddSubtree(startNode);
    6160      tree.Root = rootNode;
    62      
     61
    6362      // TODO
    64      
     63
    6564      return tree;
    6665    }
Note: See TracChangeset for help on using the changeset viewer.