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
0419b816
Commit
0419b816
authored
Sep 25, 2020
by
Davis King
Browse files
Let python users give up to 35 parameters when using the global optimizer.
parent
e7c25c06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
tools/python/src/global_optimization.cpp
tools/python/src/global_optimization.cpp
+21
-1
No files found.
tools/python/src/global_optimization.cpp
View file @
0419b816
...
...
@@ -60,7 +60,7 @@ double call_func(py::object f, const matrix<double,0,1>& args)
const
auto
num
=
num_function_arguments
(
f
,
args
.
size
());
DLIB_CASSERT
(
num
==
args
.
size
(),
"The function being optimized takes a number of arguments that doesn't agree with the size of the bounds lists you provided to find_max_global()"
);
DLIB_CASSERT
(
0
<
num
&&
num
<
1
5
,
"Functions being optimized must take between 1 and
1
5 scalar arguments."
);
DLIB_CASSERT
(
0
<
num
&&
num
<
3
5
,
"Functions being optimized must take between 1 and
3
5 scalar arguments."
);
#define CALL_WITH_N_ARGS(N) case N: return dlib::gopt_impl::_cwv(f,args,typename make_compile_time_integer_range<N>::type()).cast<double>();
switch
(
num
)
...
...
@@ -80,6 +80,26 @@ double call_func(py::object f, const matrix<double,0,1>& args)
CALL_WITH_N_ARGS
(
13
)
CALL_WITH_N_ARGS
(
14
)
CALL_WITH_N_ARGS
(
15
)
CALL_WITH_N_ARGS
(
16
)
CALL_WITH_N_ARGS
(
17
)
CALL_WITH_N_ARGS
(
18
)
CALL_WITH_N_ARGS
(
19
)
CALL_WITH_N_ARGS
(
20
)
CALL_WITH_N_ARGS
(
21
)
CALL_WITH_N_ARGS
(
22
)
CALL_WITH_N_ARGS
(
23
)
CALL_WITH_N_ARGS
(
24
)
CALL_WITH_N_ARGS
(
25
)
CALL_WITH_N_ARGS
(
26
)
CALL_WITH_N_ARGS
(
27
)
CALL_WITH_N_ARGS
(
28
)
CALL_WITH_N_ARGS
(
29
)
CALL_WITH_N_ARGS
(
30
)
CALL_WITH_N_ARGS
(
31
)
CALL_WITH_N_ARGS
(
32
)
CALL_WITH_N_ARGS
(
33
)
CALL_WITH_N_ARGS
(
34
)
CALL_WITH_N_ARGS
(
35
)
default:
DLIB_CASSERT
(
false
,
"oops"
);
...
...
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