Changeset 11680
 Timestamp:
 12/12/14 14:50:27 (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs
r11171 r11680 155 155 eval: Math.Tan, 156 156 diff: x => 1 + Math.Tan(x) * Math.Tan(x)); 157 private static readonly Func<Term, UnaryFunc> square = UnaryFunc.Factory(158 eval: x => x * x,159 diff: x => 2 * x);160 157 private static readonly Func<Term, UnaryFunc> erf = UnaryFunc.Factory( 161 158 eval: alglib.errorfunction, … … 378 375 return true; 379 376 } 377 } 378 if (node.Symbol is Square) { 379 AutoDiff.Term t; 380 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 381 term = null; 382 return false; 383 } else { 384 term = AutoDiff.TermBuilder.Power(t, 2.0); 385 return true; 386 } 387 } if (node.Symbol is SquareRoot) { 388 AutoDiff.Term t; 389 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) { 390 term = null; 391 return false; 392 } else { 393 term = AutoDiff.TermBuilder.Power(t, 0.5); 394 return true; 395 } 380 396 } if (node.Symbol is Sine) { 381 397 AutoDiff.Term t; … … 403 419 } else { 404 420 term = tan(t); 405 return true;406 }407 }408 if (node.Symbol is Square) {409 AutoDiff.Term t;410 if (!TryTransformToAutoDiff(node.GetSubtree(0), variables, parameters, variableNames, out t)) {411 term = null;412 return false;413 } else {414 term = square(t);415 421 return true; 416 422 } … … 464 470 !(n.Symbol is Logarithm) && 465 471 !(n.Symbol is Exponential) && 472 !(n.Symbol is SquareRoot) && 473 !(n.Symbol is Square) && 466 474 !(n.Symbol is Sine) && 467 475 !(n.Symbol is Cosine) && 468 476 !(n.Symbol is Tangent) && 469 !(n.Symbol is Square) &&470 477 !(n.Symbol is Erf) && 471 478 !(n.Symbol is Norm) &&
Note: See TracChangeset
for help on using the changeset viewer.