Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/10/15 11:29:34 (10 years ago)
Author:
mkommend
Message:

#2320: Merged the encoding class and all accompanying changes in the trunk.

Location:
trunk/sources/HeuristicLab.Problems.GrammaticalEvolution
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.GrammaticalEvolution

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/SymbolicExpressionTreeEncoding/HeuristicLab.Problems.GrammaticalEvolutionmergedeligible
      /stable/HeuristicLab.Problems.GrammaticalEvolutionmergedeligible
  • TabularUnified trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.3/ArtificialAnt/GEArtificialAntEvaluator.cs

    r12012 r12422  
    4949    }
    5050    // phenotype:
    51     public ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter {
    52       get { return (ILookupParameter<SymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; }
     51    public ILookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
     52      get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters["SymbolicExpressionTree"]; }
    5353    }
    5454    public ILookupParameter<BoolMatrix> WorldParameter {
     
    8484      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality of the evaluated artificial ant solution."));
    8585      Parameters.Add(new LookupParameter<IntegerVector>("IntegerVector", "The artificial ant solution encoded as an integer vector genome."));
    86       Parameters.Add(new LookupParameter<SymbolicExpressionTree>("SymbolicExpressionTree", "The artificial ant solution encoded as a symbolic expression tree that should be evaluated"));
     86      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>("SymbolicExpressionTree", "The artificial ant solution encoded as a symbolic expression tree that should be evaluated"));
    8787      Parameters.Add(new LookupParameter<BoolMatrix>("World", "The world for the artificial ant with scattered food items."));
    8888      Parameters.Add(new LookupParameter<IntValue>("MaxTimeSteps", "The maximal number of time steps that the artificial ant should be simulated."));
     
    9393      Parameters.Add(new LookupParameter<IntMatrix>("Bounds", "The integer number range in which the single genomes of a genotype are created."));
    9494      Parameters.Add(new LookupParameter<IntValue>("MaximumExpressionLength", "Maximal length of the expression to control the artificial ant (genotype length)."));
     95    }
     96
     97    [StorableHook(HookType.AfterDeserialization)]
     98    private void AfterDeserialization() {
     99      // BackwardsCompatibility3.3
     100      #region Backwards compatible code, remove with 3.4
     101
     102      if (Parameters.ContainsKey("SymbolicExpressionTree") &&
     103          Parameters["SymbolicExpressionTree"] is ILookupParameter<SymbolicExpressionTree>) {
     104        Parameters.Remove("SymbolicExpressionTree");
     105        Parameters.Add(new LookupParameter<ISymbolicExpressionTree>("SymbolicExpressionTree", "The artificial ant solution encoded as a symbolic expression tree that should be evaluated"));
     106      }
     107
     108      #endregion
     109
    95110    }
    96111
  • TabularUnified trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.3/Mappers/GenotypeToPhenotypeMapper.cs

    r12012 r12422  
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3232using HeuristicLab.Problems.GrammaticalEvolution.Mappers;
     33using HeuristicLab.Random;
    3334
    3435namespace HeuristicLab.Problems.GrammaticalEvolution {
     
    6869      if (!possibleSymbolsList.Any()) return null;
    6970
    70       var newNode = possibleSymbolsList.SelectRandom(random).CreateTreeNode();
     71      var newNode = possibleSymbolsList.SampleRandom(random).CreateTreeNode();
    7172      if (newNode.HasLocalParameters) newNode.ResetLocalParameters(random);
    7273      return newNode;
  • TabularUnified trunk/sources/HeuristicLab.Problems.GrammaticalEvolution/3.3/Mappers/RandomMapper.cs

    r12012 r12422  
    2929using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    3030using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     31using HeuristicLab.Random;
    3132
    3233namespace HeuristicLab.Problems.GrammaticalEvolution {
     
    102103        } else {
    103104          // similar to PIGEMapper, but here the current node is determined randomly ...
    104           ISymbolicExpressionTreeNode current = nonTerminals.SelectRandom(random);
     105          ISymbolicExpressionTreeNode current = nonTerminals.SampleRandom(random);
    105106          nonTerminals.Remove(current);
    106107
Note: See TracChangeset for help on using the changeset viewer.