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
1eee5ccd
Commit
1eee5ccd
authored
Nov 20, 2017
by
Davis King
Browse files
Cleanup
parent
f924b448
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
dlib/global_optimization/global_function_search.cpp
dlib/global_optimization/global_function_search.cpp
+9
-6
dlib/global_optimization/global_function_search.h
dlib/global_optimization/global_function_search.h
+3
-2
No files found.
dlib/global_optimization/global_function_search.cpp
View file @
1eee5ccd
...
@@ -573,13 +573,16 @@ namespace dlib
...
@@ -573,13 +573,16 @@ namespace dlib
global_function_search
::
global_function_search
::
global_function_search
(
global_function_search
(
const
std
::
vector
<
function_spec
>&
functions_
,
const
std
::
vector
<
function_spec
>&
functions_
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
,
)
:
global_function_search
(
functions_
)
const
double
relative_noise_magnitude_
)
:
global_function_search
(
functions_
)
{
{
DLIB_CASSERT
(
functions_
.
size
()
==
initial_function_evals
.
size
());
DLIB_CASSERT
(
functions_
.
size
()
==
initial_function_evals
.
size
());
DLIB_CASSERT
(
relative_noise_magnitude
>=
0
);
relative_noise_magnitude
=
relative_noise_magnitude_
;
for
(
size_t
i
=
0
;
i
<
initial_function_evals
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
initial_function_evals
.
size
();
++
i
)
{
{
functions
[
i
]
->
ub
=
upper_bound_function
(
initial_function_evals
[
i
]);
functions
[
i
]
->
ub
=
upper_bound_function
(
initial_function_evals
[
i
]
,
relative_noise_magnitude
);
}
}
}
}
...
@@ -669,7 +672,7 @@ namespace dlib
...
@@ -669,7 +672,7 @@ namespace dlib
auto
tmp
=
pick_next_sample_quad_interp
(
info
->
ub
.
get_points
(),
auto
tmp
=
pick_next_sample_quad_interp
(
info
->
ub
.
get_points
(),
info
->
radius
,
info
->
spec
.
lower
,
info
->
spec
.
upper
,
info
->
spec
.
is_integer_variable
);
info
->
radius
,
info
->
spec
.
lower
,
info
->
spec
.
upper
,
info
->
spec
.
is_integer_variable
);
std
::
cout
<<
"QP predicted improvement: "
<<
tmp
.
predicted_improvement
<<
std
::
endl
;
std
::
cout
<<
"QP predicted improvement: "
<<
tmp
.
predicted_improvement
<<
std
::
endl
;
if
(
tmp
.
predicted_improvement
>
qp_eps
)
if
(
tmp
.
predicted_improvement
>
min_trust_region_epsilon
)
{
{
do_trust_region_step
=
false
;
do_trust_region_step
=
false
;
outstanding_function_eval_request
new_req
;
outstanding_function_eval_request
new_req
;
...
@@ -746,7 +749,7 @@ namespace dlib
...
@@ -746,7 +749,7 @@ namespace dlib
double
global_function_search
::
double
global_function_search
::
get_solver_epsilon
(
get_solver_epsilon
(
)
const
{
return
qp_eps
;
}
)
const
{
return
min_trust_region_epsilon
;
}
void
global_function_search
::
void
global_function_search
::
set_solver_epsilon
(
set_solver_epsilon
(
...
@@ -754,7 +757,7 @@ namespace dlib
...
@@ -754,7 +757,7 @@ namespace dlib
)
)
{
{
DLIB_CASSERT
(
0
<=
eps
);
DLIB_CASSERT
(
0
<=
eps
);
qp_eps
=
eps
;
min_trust_region_epsilon
=
eps
;
}
}
double
global_function_search
::
double
global_function_search
::
...
...
dlib/global_optimization/global_function_search.h
View file @
1eee5ccd
...
@@ -144,7 +144,8 @@ namespace dlib
...
@@ -144,7 +144,8 @@ namespace dlib
global_function_search
(
global_function_search
(
const
std
::
vector
<
function_spec
>&
functions_
,
const
std
::
vector
<
function_spec
>&
functions_
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
,
const
double
relative_noise_magnitude
=
0.001
);
);
global_function_search
(
const
global_function_search
&
)
=
delete
;
global_function_search
(
const
global_function_search
&
)
=
delete
;
...
@@ -210,7 +211,7 @@ namespace dlib
...
@@ -210,7 +211,7 @@ namespace dlib
dlib
::
rand
rnd
;
dlib
::
rand
rnd
;
double
pure_random_search_probability
=
0.02
;
double
pure_random_search_probability
=
0.02
;
double
qp_eps
=
1e-11
;
double
min_trust_region_epsilon
=
1e-11
;
double
relative_noise_magnitude
=
0.001
;
double
relative_noise_magnitude
=
0.001
;
size_t
num_random_samples
=
5000
;
size_t
num_random_samples
=
5000
;
bool
do_trust_region_step
=
true
;
bool
do_trust_region_step
=
true
;
...
...
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