56 ONE_STEP_PER_ITERATION
94 template<
class M,
class F,
class VALUES>
95 static IterationResult Iterate(
97 const M&
Rd,
const F&
f,
const VALUES&
x0,
const double f_error,
const bool verbose=
false);
137 template<
class M,
class F,
class VALUES>
140 const M&
Rd,
const F&
f,
const VALUES&
x0,
const double f_error,
const bool verbose)
150 enum { NONE, INCREASED_DELTA, DECREASED_DELTA } lastAction = NONE;
152 gttic(Dog_leg_point);
155 gttoc(Dog_leg_point);
157 if(verbose) std::cout <<
"delta = " <<
delta <<
", dx_d_norm = " <<
result.dx_d.norm() << std::endl;
161 const VALUES x_d(
x0.retract(
result.dx_d));
164 gttic(decrease_in_f);
167 gttoc(decrease_in_f);
171 const double new_M_error =
Rd.error(
result.dx_d);
174 if(verbose) std::cout << std::setprecision(15) <<
"f error: " << f_error <<
" -> " <<
result.f_error << std::endl;
175 if(verbose) std::cout << std::setprecision(15) <<
"M error: " << M_error <<
" -> " << new_M_error << std::endl;
182 (f_error -
result.f_error) / (M_error - new_M_error);
184 if(verbose) std::cout << std::setprecision(15) <<
"rho = " << rho << std::endl;
188 const double dx_d_norm =
result.dx_d.norm();
194 if(
std::abs(newDelta -
delta) < 1
e-15 || lastAction == DECREASED_DELTA)
198 lastAction = INCREASED_DELTA;
205 }
else if(0.75 > rho && rho >= 0.25) {
209 }
else if(0.25 > rho && rho >= 0.0) {
212 bool hitMinimumDelta;
214 newDelta = 0.5 *
delta;
215 hitMinimumDelta =
false;
218 hitMinimumDelta =
true;
224 lastAction = DECREASED_DELTA;
238 lastAction = DECREASED_DELTA;
240 if(verbose) std::cout <<
"Warning: Dog leg stopping because cannot decrease error with minimum delta" << std::endl;