Ignore:
Timestamp:
12/12/16 15:55:22 (4 years ago)
Author:
bburlacu
Message:

#2704: Implement export of expressions as infix strings. Include missing AssemblyInfo.cs.frame file and set language version to C# 4.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.ExpressionGenerator/HeuristicLab.ExpressionGenerator/3.4/ExpressionTemplate.cs

    r14448 r14480  
    3030    private List<Tuple<Expression, double>> arguments;
    3131    private readonly Func<IEnumerable<double>, double> transform;
     32    public string Label { get; set; }
    3233
    33     protected Expression Instantiate(string label, IRandom random, int n, bool sampleWithRepetition = false) {
     34    protected Expression Instantiate(string name, IRandom random, int n, bool sampleWithRepetition = false) {
    3435      var weights = arguments.Select(x => x.Item2);
    3536      var args = sampleWithRepetition
    3637       ? arguments.SampleProportional(random, n, weights).Select(x => x.Item1)
    3738       : arguments.SampleProportionalWithoutRepetition(random, n, weights).Select(x => x.Item1);
    38       return Expression.Function(label, transform, args);
     39      var func = Expression.Function(name, transform, args);
     40      func.Label = Label;
     41      return func;
    3942    }
    4043
Note: See TracChangeset for help on using the changeset viewer.