From fa43cde658b101747f65bd87cf8d9fa5fa966262 Mon Sep 17 00:00:00 2001 From: "Davis E. King" Date: Wed, 2 Jul 2014 10:31:55 -0400 Subject: [PATCH] Fixed a bug, the initial step size wasn't being used in part of the code. Also made the initial bracketing step a little more efficient. --- dlib/optimization/optimization_line_search.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlib/optimization/optimization_line_search.h b/dlib/optimization/optimization_line_search.h index 40ee40498..cc2d324d8 100644 --- a/dlib/optimization/optimization_line_search.h +++ b/dlib/optimization/optimization_line_search.h @@ -599,8 +599,8 @@ namespace dlib // The first thing we do is get a starting set of 3 points that are inside the [begin,end] bounds - p1 = max(starting_point-1, begin); - p3 = min(starting_point+1, end); + p1 = max(starting_point-search_radius, begin); + p3 = min(starting_point+search_radius, end); f1 = f(p1); f3 = f(p3); @@ -647,15 +647,16 @@ namespace dlib } // If the left most points are identical in function value then expand out the - // left a bit, unless it's already at bound. - if (f1==f2 && f1!=begin) + // left a bit, unless it's already at bound or we would drop that left most + // point anyway because it's bad. + if (f1==f2 && f1