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
47210753
Commit
47210753
authored
Aug 07, 2020
by
Davis King
Browse files
More optimization unit tests
parent
a9d554a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
dlib/test/optimization.cpp
dlib/test/optimization.cpp
+11
-1
No files found.
dlib/test/optimization.cpp
View file @
47210753
...
@@ -1116,11 +1116,21 @@ namespace
...
@@ -1116,11 +1116,21 @@ namespace
dlog
<<
LINFO
<<
"upper: "
<<
trans
(
upper
);
dlog
<<
LINFO
<<
"upper: "
<<
trans
(
upper
);
dlog
<<
LINFO
<<
"starting: "
<<
trans
(
starting_point
);
dlog
<<
LINFO
<<
"starting: "
<<
trans
(
starting_point
);
// The contract for find_min_box_constrained() says we always call obj() before der(). So
// these lambdas verify that this is so.
dlib
::
matrix
<
double
,
0
,
1
>
last_x
;
auto
obj
=
[
&
](
const
dlib
::
matrix
<
double
,
0
,
1
>
&
x
)
{
last_x
=
x
;
return
brown
(
x
);
};
auto
der
=
[
&
](
const
dlib
::
matrix
<
double
,
0
,
1
>
&
x
)
{
// check that obj(x) was called before der(x).
DLIB_TEST_MSG
(
max
(
abs
(
x
-
last_x
))
==
0
,
max
(
abs
(
x
-
last_x
)));
return
brown_derivative
(
x
);
};
x
=
starting_point
;
x
=
starting_point
;
double
val
=
find_min_box_constrained
(
double
val
=
find_min_box_constrained
(
search_strategy
,
search_strategy
,
objective_delta_stop_strategy
(
1e-16
,
500
),
objective_delta_stop_strategy
(
1e-16
,
500
),
brown
,
brown_derivative
,
x
,
obj
,
der
,
x
,
lower
,
lower
,
upper
upper
);
);
...
...
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