From 0419b816893f314b67dbba56e67c26fbc8b6c361 Mon Sep 17 00:00:00 2001 From: Davis King Date: Fri, 25 Sep 2020 07:41:26 -0400 Subject: [PATCH] Let python users give up to 35 parameters when using the global optimizer. --- tools/python/src/global_optimization.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/python/src/global_optimization.cpp b/tools/python/src/global_optimization.cpp index 9dad21c80..88180b0bd 100644 --- a/tools/python/src/global_optimization.cpp +++ b/tools/python/src/global_optimization.cpp @@ -60,7 +60,7 @@ double call_func(py::object f, const matrix& 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 < 15, "Functions being optimized must take between 1 and 15 scalar arguments."); + DLIB_CASSERT(0 < num && num < 35, "Functions being optimized must take between 1 and 35 scalar arguments."); #define CALL_WITH_N_ARGS(N) case N: return dlib::gopt_impl::_cwv(f,args,typename make_compile_time_integer_range::type()).cast(); switch (num) @@ -80,6 +80,26 @@ double call_func(py::object f, const matrix& 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");