Commit 31c304e1 authored by Davis King's avatar Davis King

Modified the find_min_single_variable() function so that it is more

robust when working with functions that are made up of a bunch of
constant value strips.  Previously, these kinds of functions could
cause the optimization to fail.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403392
parent 97300eb3
...@@ -545,8 +545,9 @@ namespace dlib ...@@ -545,8 +545,9 @@ namespace dlib
{ {
// check if the minimum is butting up against the bounds and if so then pick // check if the minimum is butting up against the bounds and if so then pick
// a point between p1 and p2 in the hopes that shrinking the interval will // a point between p1 and p2 in the hopes that shrinking the interval will
// be a good thing to do. // be a good thing to do. Or if p1 and p2 aren't differentiated then try and
if (p1 == begin) // get them to obtain different values.
if (p1 == begin || (f1 == f2 && (end-begin) < jump_size ))
{ {
p3 = p2; p3 = p2;
f3 = f2; f3 = f2;
...@@ -575,8 +576,9 @@ namespace dlib ...@@ -575,8 +576,9 @@ namespace dlib
{ {
// check if the minimum is butting up against the bounds and if so then pick // check if the minimum is butting up against the bounds and if so then pick
// a point between p2 and p3 in the hopes that shrinking the interval will // a point between p2 and p3 in the hopes that shrinking the interval will
// be a good thing to do. // be a good thing to do. Or if p2 and p3 aren't differentiated then try and
if (p3 == end) // get them to obtain different values.
if (p3 == end || (f2 == f3 && (end-begin) < jump_size))
{ {
p1 = p2; p1 = p2;
f1 = f2; f1 = f2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment