- Timestamp:
- 04/23/14 13:12:07 (11 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r9456 r10774 46 46 public const byte OR = 14; 47 47 public const byte NOT = 15; 48 public const byte XOR = 45; 48 49 49 50 … … 99 100 { typeof(Or), OpCodes.OR }, 100 101 { typeof(Not), OpCodes.NOT}, 102 { typeof(Xor),OpCodes.XOR}, 101 103 { typeof(Average), OpCodes.Average}, 102 104 { typeof(InvokeFunction), OpCodes.Call }, -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r9828 r10774 344 344 return Evaluate(dataset, ref row, state) > 0.0 ? -1.0 : 1.0; 345 345 } 346 case OpCodes.XOR: { 347 double firstArgument = Evaluate(dataset, ref row, state); 348 double result = 1.0; 349 for (int i = 1; i < currentInstr.nArguments; i++) { 350 if (result <= 0.0) { 351 state.SkipInstructions(); 352 } else { 353 double evalutationResult = Evaluate(dataset, ref row, state); 354 if (firstArgument <= 0 && evalutationResult > 0) result = -1.0; 355 else if (firstArgument > 0 && evalutationResult <= 0) result = -1.0; 356 } 357 } 358 return result > 0.0 ? 1.0 : -1.0; 359 } 346 360 case OpCodes.GT: { 347 361 double x = Evaluate(dataset, ref row, state); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r9944 r10774 311 311 } else if (instr.opCode == OpCodes.NOT) { 312 312 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; 313 323 } else if (instr.opCode == OpCodes.GT) { 314 324 double x = code[instr.childIndex].value;
Note: See TracChangeset
for help on using the changeset viewer.