Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/14 09:23:18 (11 years ago)
Author:
mkommend
Message:

#2177: Corrected evaluation of the xor symbol in the interpreters.

File:
1 edited

Legend:

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

    r10774 r10788  
    312312          instr.value = code[instr.childIndex].value > 0.0 ? -1.0 : 1.0;
    313313        } 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;
     314          int positiveSignals = 0;
     315          for (int j = 0; j < instr.nArguments; j++) {
     316            if (code[instr.childIndex + j].value > 0.0) positiveSignals++;
     317          }
     318          instr.value = positiveSignals % 2 != 0 ? 1.0 : -1.0;
    323319        } else if (instr.opCode == OpCodes.GT) {
    324320          double x = code[instr.childIndex].value;
Note: See TracChangeset for help on using the changeset viewer.