Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/23/14 13:12:07 (11 years ago)
Author:
mkommend
Message:

#2177: Implemented XOR symbol and adapted the interpreters and grammars.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r9944 r10774  
    311311        } else if (instr.opCode == OpCodes.NOT) {
    312312          instr.value = code[instr.childIndex].value > 0.0 ? -1.0 : 1.0;
     313        } else if (instr.opCode == OpCodes.XOR) {
     314          double firstArgument = code[instr.childIndex].value;
     315          instr.value = 1.0;
     316          for (int j = 1; j < instr.nArguments; j++) {
     317            if (instr.value > 0.0) {
     318              if (firstArgument <= 0 && code[instr.childIndex + j].value > 0) instr.value = -1.0;
     319              if (firstArgument > 0 && code[instr.childIndex + j].value <= 0) instr.value = -1.0;
     320            } else break;
     321          }
     322          instr.value = instr.value > 0.0 ? 1.0 : -1.0;
    313323        } else if (instr.opCode == OpCodes.GT) {
    314324          double x = code[instr.childIndex].value;
Note: See TracChangeset for help on using the changeset viewer.