Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1068


Ignore:
Timestamp:
12/25/08 13:50:04 (16 years ago)
Author:
gkronber
Message:

fixed #447 (Differential symbol should evaluate to 0 if the previous value is NaN, Inf. or out of range) in CEDMA refactoring branch (#419).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/BakedTreeEvaluator.cs

    r773 r1068  
    162162        case EvaluatorSymbolTable.DIFFERENTIAL: {
    163163            int row = sampleIndex + currInstr.i_arg1;
    164             if (row < 1 || row >= dataset.Rows) return double.NaN;
    165             else return currInstr.d_arg0 * (dataset.GetValue(row, currInstr.i_arg0) - dataset.GetValue(row - 1, currInstr.i_arg0));
     164            if (row < 0 || row >= dataset.Rows) return double.NaN;
     165            else if (row < 1) return 0.0;
     166            else {
     167              double prevValue = dataset.GetValue(row - 1, currInstr.i_arg0);
     168              if (double.IsNaN(prevValue) || double.IsInfinity(prevValue)) return 0.0;
     169              else return currInstr.d_arg0 * (dataset.GetValue(row, currInstr.i_arg0) - prevValue);
     170            }
    166171          }
    167172        case EvaluatorSymbolTable.MULTIPLICATION: {
Note: See TracChangeset for help on using the changeset viewer.