Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/22/08 18:05:14 (16 years ago)
Author:
gkronber
Message:

merged FunctionsAndStructIdRefactoring-branch (r142, r143, r144, r145, r146, r147, r148, r149, r152, r153) back into the trunk (ticket #112)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/Average.cs

    r2 r155  
    3131    public override string Description {
    3232      get {
    33         return @"Returns the average (arithmetic mean) of all sub-operator results.";
     33        return @"Returns the average (arithmetic mean) of all sub-tree results.";
    3434      }
    3535    }
     
    4040    }
    4141
    42     public Average(Average source, IDictionary<Guid, object> clonedObjects)
    43       : base(source, clonedObjects) {
    44     }
    45 
    46 
    47     public override double Evaluate(Dataset dataset, int sampleIndex) {
     42    public override double Apply(Dataset dataset, int sampleIndex, double[] args) {
    4843      double sum = 0.0;
    49       for(int i = 0; i < SubFunctions.Count; i++) {
    50         sum += SubFunctions[i].Evaluate(dataset, sampleIndex);
     44      for(int i = 0; i < args.Length; i++) {
     45        sum += args[i];
    5146      }
    52       return sum / SubFunctions.Count;
    53     }
    54 
    55     public override object Clone(IDictionary<Guid, object> clonedObjects) {
    56       Average clone = new Average(this, clonedObjects);
    57       clonedObjects.Add(clone.Guid, clone);
    58       return clone;
     47      return sum / args.Length;
    5948    }
    6049
Note: See TracChangeset for help on using the changeset viewer.