Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/06/08 16:58:42 (16 years ago)
Author:
gkronber
Message:

minor changes in BakedTreeEvaluator to removed branches

File:
1 edited

Legend:

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

    r424 r460  
    204204            double x = EvaluateBakedCode();
    205205            double y = EvaluateBakedCode();
    206             if(condition == 0.0) return x;
    207             else return y;
     206            return condition * y - (condition - 1) * x;
    208207          }
    209208        case EvaluatorSymbolTable.LT: {
     
    216215            double result = EvaluateBakedCode();
    217216            Debug.Assert(result == 0.0 || result == 1.0);
    218             if(result == 0.0) return 1.0;
    219             else return 0.0;
     217            return Math.Abs(result - 1.0);
    220218          }
    221219        case EvaluatorSymbolTable.OR: { // only defined for inputs 0 or 1
     
    224222              double x = EvaluateBakedCode();
    225223              Debug.Assert(x == 0.0 || x == 1.0);
    226               if(x == 1.0) result = 1.0;
    227             }
    228             return result;
     224              result += x;
     225            }
     226            return Math.Sign(result);
    229227          }
    230228        case EvaluatorSymbolTable.XOR: { // only defined for inputs 0 or 1
Note: See TracChangeset for help on using the changeset viewer.