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
a6395a76
Commit
a6395a76
authored
Mar 29, 2016
by
Davis King
Browse files
More robustness improvements to line_search(). Mostly just parameter tweaks.
parent
e03fea5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
dlib/optimization/optimization_line_search.h
dlib/optimization/optimization_line_search.h
+15
-8
No files found.
dlib/optimization/optimization_line_search.h
View file @
a6395a76
...
...
@@ -306,8 +306,9 @@ namespace dlib
// the book Practical Methods of Optimization by R. Fletcher. The sectioning
// phase is an implementation of 2.6.4 from the same book.
// 1 < tau1a < tau1b. Controls the alpha jump size during the search
const
double
tau1a
=
2.0
;
// 1 <= tau1a < tau1b. Controls the alpha jump size during the bracketing phase of
// the search.
const
double
tau1a
=
1.4
;
const
double
tau1b
=
9
;
// it must be the case that 0 < tau2 < tau3 <= 1/2 for the algorithm to function
...
...
@@ -317,7 +318,7 @@ namespace dlib
// Stop right away and return a step size of 0 if the gradient is 0 at the starting point
if
(
std
::
abs
(
d0
)
<
std
::
numeric_limits
<
double
>::
epsilon
())
if
(
std
::
abs
(
d0
)
<
=
std
::
abs
(
f0
)
*
std
::
numeric_limits
<
double
>::
epsilon
())
return
0
;
// Stop right away if the current value is good enough according to min_f
...
...
@@ -397,12 +398,18 @@ namespace dlib
const
double
temp
=
alpha
;
// Pick a larger range [first, last]. We will pick the next alpha in that
// range.
double
first
=
alpha
+
tau1a
*
(
alpha
-
last_alpha
);
double
last
;
double
first
,
last
;
if
(
mu
>
0
)
{
first
=
std
::
min
(
mu
,
alpha
+
tau1a
*
(
alpha
-
last_alpha
));
last
=
std
::
min
(
mu
,
alpha
+
tau1b
*
(
alpha
-
last_alpha
));
}
else
{
first
=
std
::
max
(
mu
,
alpha
+
tau1a
*
(
alpha
-
last_alpha
));
last
=
std
::
max
(
mu
,
alpha
+
tau1b
*
(
alpha
-
last_alpha
));
}
// pick a point between first and last by doing some kind of interpolation
...
...
@@ -462,7 +469,7 @@ namespace dlib
// 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
(
second_der
>
1e
5
)
if
(
std
::
abs
(
a
-
b
)
<
1e-8
&&
second_der
>
1e
7
)
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