Changeset 11208 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
- Timestamp:
- 07/18/14 16:39:50 (10 years ago)
- Location:
- branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/InterpreterState.cs
r9456 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r9456 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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 }, -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r9828 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 447 447 il.Emit(System.Reflection.Emit.OpCodes.Sub); 448 448 il.Emit(System.Reflection.Emit.OpCodes.Neg); // * -1 449 return; 450 } 451 case OpCodes.XOR: { 452 CompileInstructions(il, state, ds); 453 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); 454 il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0 455 456 for (int i = 1; i < nArgs; i++) { 457 CompileInstructions(il, state, ds); 458 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0); 459 il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0 460 il.Emit(System.Reflection.Emit.OpCodes.Xor); 461 } 462 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2 463 il.Emit(System.Reflection.Emit.OpCodes.Mul); 464 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0); // - 1 465 il.Emit(System.Reflection.Emit.OpCodes.Sub); 449 466 return; 450 467 } -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r9828 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 344 344 return Evaluate(dataset, ref row, state) > 0.0 ? -1.0 : 1.0; 345 345 } 346 case OpCodes.XOR: { 347 //mkommend: XOR on multiple inputs is defined as true if the number of positive signals is odd 348 // this is equal to a consecutive execution of binary XOR operations. 349 int positiveSignals = 0; 350 for (int i = 0; i < currentInstr.nArguments; i++) { 351 if (Evaluate(dataset, ref row, state) > 0.0) positiveSignals++; 352 } 353 return positiveSignals % 2 != 0 ? 1.0 : -1.0; 354 } 346 355 case OpCodes.GT: { 347 356 double x = Evaluate(dataset, ref row, state); -
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r9944 r11208 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 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 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; 313 319 } else if (instr.opCode == OpCodes.GT) { 314 320 double x = code[instr.childIndex].value;
Note: See TracChangeset
for help on using the changeset viewer.