57 ONE_STEP_PER_ITERATION
95 template<
class M,
class F,
class VALUES>
96 static IterationResult Iterate(
98 const M&
Rd,
const F&
f,
const VALUES&
x0,
const double f_error,
const bool verbose=
false);
138 template<
class M,
class F,
class VALUES>
141 const M&
Rd,
const F&
f,
const VALUES&
x0,
const double f_error,
const bool verbose)
151 enum { NONE, INCREASED_DELTA, DECREASED_DELTA } lastAction = NONE;
153 gttic(Dog_leg_point);
156 gttoc(Dog_leg_point);
158 if(verbose) std::cout <<
"delta = " <<
delta <<
", dx_d_norm = " <<
result.dx_d.norm() << std::endl;
162 const VALUES x_d(
x0.retract(
result.dx_d));
165 gttic(decrease_in_f);
168 gttoc(decrease_in_f);
172 const double new_M_error =
Rd.error(
result.dx_d);
175 if(verbose) std::cout << std::setprecision(15) <<
"f error: " << f_error <<
" -> " <<
result.f_error << std::endl;
176 if(verbose) std::cout << std::setprecision(15) <<
"M error: " << M_error <<
" -> " << new_M_error << std::endl;
183 (f_error -
result.f_error) / (M_error - new_M_error);
185 if(verbose) std::cout << std::setprecision(15) <<
"rho = " << rho << std::endl;
189 const double dx_d_norm =
result.dx_d.norm();
195 if(
std::abs(newDelta -
delta) < 1
e-15 || lastAction == DECREASED_DELTA)
199 lastAction = INCREASED_DELTA;
206 }
else if(0.75 > rho && rho >= 0.25) {
210 }
else if(0.25 > rho && rho >= 0.0) {
213 bool hitMinimumDelta;
215 newDelta = 0.5 *
delta;
216 hitMinimumDelta =
false;
219 hitMinimumDelta =
true;
225 lastAction = DECREASED_DELTA;
239 lastAction = DECREASED_DELTA;
241 if(verbose) std::cout <<
"Warning: Dog leg stopping because cannot decrease error with minimum delta" << std::endl;