Ignore:
Timestamp:
01/09/15 14:57:28 (7 years ago)
Author:
gkronber
Message:

#2283 refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization/SymbolicRegressionPoly10Problem.cs

    r11732 r11742  
    2121
    2222    private readonly IGrammar grammar;
    23     private readonly ExpressionInterpreter interpreter;
    2423
    2524    private readonly int N;
     
    2928    public SymbolicRegressionPoly10Problem() {
    3029      this.grammar = new Grammar(grammarString);
    31       this.interpreter = new ExpressionInterpreter();
    3230
    3331      this.N = 500;
     
    6765
    6866    public double Evaluate(string sentence) {
     67      var interpreter = new ExpressionInterpreter();
    6968      return HeuristicLab.Common.Extensions.RSq(y, Enumerable.Range(0, N).Select(i => interpreter.Interpret(sentence, x[i])).ToArray());
    7069    }
     
    7372
    7473    // right now only + and * is supported
    75     public string Hash(string terminalPhrase) {
     74    public string CanonicalRepresentation(string terminalPhrase) {
    7675      var terms = terminalPhrase.Split('+');
    7776      return string.Join("+", terms.Select(term => string.Join("", term.Replace("*", "").OrderBy(ch => ch)))
Note: See TracChangeset for help on using the changeset viewer.