Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
9a52ea5c
Commit
9a52ea5c
authored
Mar 29, 2016
by
Davis King
Browse files
Yet more stability improvements for line_search().
parent
a6395a76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
dlib/optimization/optimization_line_search.h
dlib/optimization/optimization_line_search.h
+8
-7
No files found.
dlib/optimization/optimization_line_search.h
View file @
9a52ea5c
...
...
@@ -453,6 +453,14 @@ namespace dlib
return
b
;
}
// If alpha has basically become zero then just stop. Think of it like this,
// if we take the largest possible alpha step will the objective function
// change at all? If not then there isn't any point looking for a better
// alpha.
const
double
max_possible_alpha
=
std
::
max
(
std
::
abs
(
a
),
std
::
abs
(
b
));
if
(
std
::
abs
(
max_possible_alpha
*
d0
)
<=
std
::
abs
(
f0
)
*
std
::
numeric_limits
<
double
>::
epsilon
())
return
alpha
;
if
(
val
>
f0
+
rho
*
alpha
*
d0
||
val
>=
a_val
)
{
...
...
@@ -464,13 +472,6 @@ namespace dlib
{
if
(
std
::
abs
(
val_der
)
<=
thresh
)
return
alpha
;
// If we are optimizing a function that doesn't have continuous first
// derivatives then val_der might not ever go below thresh. So check if it
// looks like the first derivative is discontinuous and stop if so. The
// current alpha is plenty good enough in this case.
const
double
second_der
=
std
::
abs
(
a_val_der
-
b_val_der
)
/
std
::
abs
(
a
-
b
);
if
(
std
::
abs
(
a
-
b
)
<
1e-8
&&
second_der
>
1e7
)
return
alpha
;
if
(
(
b
-
a
)
*
val_der
>=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment