Changeset 5923 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs
- Timestamp:
- 04/01/11 10:12:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r5897 r5923 339 339 case OpCodes.TimeLag: { 340 340 var timeLagTreeNode = (LaggedTreeNode)currentInstr.dynamicNode; 341 if (row + timeLagTreeNode.Lag < 0 || row + timeLagTreeNode.Lag >= dataset.Rows)342 return double.NaN;343 344 341 row += timeLagTreeNode.Lag; 345 342 double result = Evaluate(dataset, ref row, state); … … 350 347 int savedPc = state.ProgramCounter; 351 348 var timeLagTreeNode = (LaggedTreeNode)currentInstr.dynamicNode; 352 if (row + timeLagTreeNode.Lag < 0 || row + timeLagTreeNode.Lag >= dataset.Rows)353 return double.NaN;354 349 double sum = 0.0; 355 350 for (int i = 0; i < Math.Abs(timeLagTreeNode.Lag); i++) { … … 368 363 // y' = 1/8h (f_i + 2f_i-1, -2 f_i-3 - f_i-4) 369 364 case OpCodes.Derivative: { 370 if (row - 4 < 0) return double.NaN;371 365 int savedPc = state.ProgramCounter; 372 366 double f_0 = Evaluate(dataset, ref row, state); ; row--; … … 408 402 } 409 403 case OpCodes.Variable: { 404 if (row < 0 || row >= dataset.Rows) 405 return double.NaN; 410 406 var variableTreeNode = currentInstr.dynamicNode as VariableTreeNode; 411 407 return dataset[row, currentInstr.iArg0] * variableTreeNode.Weight; … … 414 410 var laggedVariableTreeNode = currentInstr.dynamicNode as LaggedVariableTreeNode; 415 411 int actualRow = row + laggedVariableTreeNode.Lag; 416 if (actualRow < 0 || actualRow >= dataset.Rows) throw new ArgumentException("Out of range access to dataset row: " + row); 412 if (actualRow < 0 || actualRow >= dataset.Rows) 413 return double.NaN; 417 414 return dataset[actualRow, currentInstr.iArg0] * laggedVariableTreeNode.Weight; 418 415 } … … 425 422 //to determine the relative amounts of the true and false branch see http://en.wikipedia.org/wiki/Logistic_function 426 423 case OpCodes.VariableCondition: { 424 if (row < 0 || row >= dataset.Rows) 425 return double.NaN; 427 426 var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode; 428 427 double variableValue = dataset[row, currentInstr.iArg0];
Note: See TracChangeset
for help on using the changeset viewer.