ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/optimization/LineSearchBasedMethod.cpp
(Generate patch)

Comparing:
branches/development/src/optimization/LineSearchBasedMethod.cpp (file contents), Revision 1741 by gezelter, Tue Jun 5 18:02:44 2012 UTC vs.
trunk/src/optimization/LineSearchBasedMethod.cpp (file contents), Revision 1969 by gezelter, Wed Feb 26 14:14:50 2014 UTC

# Line 75 | Line 75 | namespace QuantLib {
75              if (lineSearch_->succeed())
76              {
77                  // Updates
78
78                  // New point
79                  x_ = lineSearch_->lastX();
80                  // New function value
# Line 89 | Line 88 | namespace QuantLib {
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,
# Line 105 | Line 104 | namespace QuantLib {
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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines