| 75 |
|
if (lineSearch_->succeed()) |
| 76 |
|
{ |
| 77 |
|
// Updates |
| 78 |
– |
|
| 78 |
|
// New point |
| 79 |
|
x_ = lineSearch_->lastX(); |
| 80 |
|
// New function value |
| 88 |
|
|
| 89 |
|
// conjugate gradient search direction |
| 90 |
|
direction = getUpdatedDirection(P, gold2, prevGradient); |
| 92 |
– |
|
| 91 |
|
sddiff = direction - lineSearch_->searchDirection(); |
| 92 |
|
lineSearch_->searchDirection() = direction; |
| 93 |
|
// Now compute accuracy and check end criteria |
| 94 |
|
// Numerical Recipes exit strategy on fx (see NR in C++, p.423) |
| 95 |
+ |
|
| 96 |
|
fnew = P.functionValue(); |
| 97 |
|
fdiff = 2.0*std::fabs(fnew-fold) / |
| 98 |
|
(std::fabs(fnew) + std::fabs(fold) + NumericConstant::epsilon); |
| 99 |
< |
std::cerr << "fdiff = " << fdiff << "ftol = " << ftol << "\n"; |
| 99 |
> |
|
| 100 |
|
if (fdiff < ftol || |
| 101 |
|
endCriteria.checkMaxIterations(iterationNumber_, ecType)) { |
| 102 |
|
endCriteria.checkStationaryFunctionValue(0.0, 0.0, |
| 104 |
|
endCriteria.checkMaxIterations(iterationNumber_, ecType); |
| 105 |
|
return ecType; |
| 106 |
|
} |
| 107 |
+ |
|
| 108 |
|
P.setCurrentValue(x_); // update problem current value |
| 109 |
|
++iterationNumber_; // Increase iteration number |
| 110 |
– |
std::cerr << "in = " << iterationNumber_ << "\n"; |
| 110 |
|
first_time = false; |
| 111 |
|
} else { |
| 112 |
|
done = true; |