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
943408d2
Commit
943408d2
authored
Jul 26, 2020
by
Davis King
Browse files
Allow forwarding initial function evaluations into find_max_global()
parent
5a80ca9e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
268 additions
and
156 deletions
+268
-156
dlib/global_optimization/find_max_global.h
dlib/global_optimization/find_max_global.h
+131
-84
dlib/global_optimization/find_max_global_abstract.h
dlib/global_optimization/find_max_global_abstract.h
+132
-72
dlib/test/global_optimization.cpp
dlib/test/global_optimization.cpp
+5
-0
No files found.
dlib/global_optimization/find_max_global.h
View file @
943408d2
...
@@ -128,7 +128,8 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -128,7 +128,8 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
,
double
solver_epsilon
,
double
ymult
double
ymult
,
std
::
vector
<
std
::
vector
<
function_evaluation
>>
initial_function_evals
)
)
{
{
// Decide which parameters should be searched on a log scale. Basically, it's
// Decide which parameters should be searched on a log scale. Basically, it's
...
@@ -156,7 +157,12 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -156,7 +157,12 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
}
}
}
}
global_function_search
opt
(
specs
);
if
(
initial_function_evals
.
empty
())
{
initial_function_evals
.
resize
(
specs
.
size
());
}
global_function_search
opt
(
specs
,
{
initial_function_evals
});
opt
.
set_solver_epsilon
(
solver_epsilon
);
opt
.
set_solver_epsilon
(
solver_epsilon
);
running_stats_decayed
<
double
>
objective_funct_eval_time
(
functions
.
size
()
*
5
);
running_stats_decayed
<
double
>
objective_funct_eval_time
(
functions
.
size
()
*
5
);
...
@@ -266,13 +272,14 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -266,13 +272,14 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
,
double
solver_epsilon
,
double
ymult
double
ymult
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
)
)
{
{
// disabled, don't use any threads
// disabled, don't use any threads
thread_pool
tp
(
0
);
thread_pool
tp
(
0
);
return
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
ymult
);
return
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
ymult
,
initial_function_evals
);
}
}
}
}
...
@@ -286,10 +293,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -286,10 +293,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
std
::
vector
<
function_spec
>
specs
,
std
::
vector
<
function_spec
>
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
)
)
{
{
return
impl
::
find_max_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
+
1
);
return
impl
::
find_max_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
+
1
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -300,10 +308,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -300,10 +308,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
std
::
vector
<
function_spec
>
specs
,
std
::
vector
<
function_spec
>
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
)
)
{
{
return
impl
::
find_max_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
-
1
);
return
impl
::
find_max_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
-
1
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -315,10 +324,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -315,10 +324,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
std
::
vector
<
function_spec
>
specs
,
std
::
vector
<
function_spec
>
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
)
)
{
{
return
impl
::
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
+
1
);
return
impl
::
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
+
1
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -330,10 +340,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -330,10 +340,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
std
::
vector
<
function_spec
>
specs
,
std
::
vector
<
function_spec
>
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
)
)
{
{
return
impl
::
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
-
1
);
return
impl
::
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
-
1
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -348,12 +359,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -348,12 +359,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
return
find_max_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
).
second
;
return
find_max_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
{
initial_function_evals
}
).
second
;
}
}
template
<
template
<
...
@@ -366,12 +378,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -366,12 +378,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
return
find_min_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
).
second
;
return
find_min_global
(
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
{
initial_function_evals
}
).
second
;
}
}
template
<
template
<
...
@@ -385,12 +398,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -385,12 +398,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
return
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
).
second
;
return
find_max_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
{
initial_function_evals
}
).
second
;
}
}
template
<
template
<
...
@@ -404,12 +418,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -404,12 +418,13 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
funct
>
functions
(
1
,
std
::
move
(
f
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
std
::
vector
<
function_spec
>
specs
(
1
,
function_spec
(
bound1
,
bound2
,
is_integer_variable
));
return
find_min_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
).
second
;
return
find_min_global
(
tp
,
functions
,
std
::
move
(
specs
),
num
,
max_runtime
,
solver_epsilon
,
{
initial_function_evals
}
).
second
;
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -423,10 +438,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -423,10 +438,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -438,10 +454,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -438,10 +454,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -454,10 +471,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -454,10 +471,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -470,10 +488,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -470,10 +488,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -487,10 +506,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -487,10 +506,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -502,10 +522,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -502,10 +522,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -518,10 +539,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -518,10 +539,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -534,10 +556,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -534,10 +556,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -550,10 +573,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -550,10 +573,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -564,10 +588,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -564,10 +588,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -579,10 +604,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -579,10 +604,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -594,10 +620,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -594,10 +620,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -611,10 +638,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -611,10 +638,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -626,10 +654,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -626,10 +654,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -642,10 +671,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -642,10 +671,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -658,10 +688,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -658,10 +688,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -674,10 +705,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -674,10 +705,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -688,10 +720,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -688,10 +720,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -703,10 +736,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -703,10 +736,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
=
initial_function_evals
);
}
}
template
<
template
<
...
@@ -718,10 +752,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -718,10 +752,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -734,10 +769,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -734,10 +769,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -748,10 +784,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -748,10 +784,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -763,10 +800,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -763,10 +800,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -778,10 +816,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -778,10 +816,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -794,10 +833,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -794,10 +833,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -808,10 +848,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -808,10 +848,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -823,10 +864,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -823,10 +864,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -838,10 +880,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -838,10 +880,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -855,10 +898,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -855,10 +898,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -870,10 +914,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -870,10 +914,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -886,10 +931,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -886,10 +931,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -902,10 +948,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
...
@@ -902,10 +948,11 @@ template <typename T> static auto go(T&& f, const matrix<double, 0, 1>& a) -> de
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
dlib/global_optimization/find_max_global_abstract.h
View file @
943408d2
...
@@ -80,7 +80,8 @@ namespace dlib
...
@@ -80,7 +80,8 @@ namespace dlib
const
std
::
vector
<
function_spec
>&
specs
,
const
std
::
vector
<
function_spec
>&
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
);
);
/*!
/*!
requires
requires
...
@@ -101,6 +102,12 @@ namespace dlib
...
@@ -101,6 +102,12 @@ namespace dlib
- if (tp.num_threads_in_pool() != 0) then
- if (tp.num_threads_in_pool() != 0) then
- it must be safe to call the given functions concurrently from multiple
- it must be safe to call the given functions concurrently from multiple
threads.
threads.
- initial_function_evals.empty() || initial_function_evals.size() == functions.size()
- for all valid i:
- for (item : initial_function_evals[i]):
- functions[i](item.x) == item.y
i.e. initial_function_evals contains a record of evaluations of the given
functions.
ensures
ensures
- This function performs global optimization on the set of given functions.
- This function performs global optimization on the set of given functions.
The goal is to maximize the following objective function:
The goal is to maximize the following objective function:
...
@@ -139,6 +146,11 @@ namespace dlib
...
@@ -139,6 +146,11 @@ namespace dlib
being optimized. Therefore, this transformation is invisible to the user
being optimized. Therefore, this transformation is invisible to the user
supplied functions. In most cases, it improves the efficiency of the
supplied functions. In most cases, it improves the efficiency of the
optimizer.
optimizer.
- The evaluations in initial_function_evals are incorporated into the solver state at
startup. This is useful if you have information from a previous optimization attempt
or just know some good initial x values that should be attempted as a baseline.
Giving initial_function_evals allows you to tell the solver to explicitly include
those x values in its search.
- if (tp.num_threads_in_pool() != 0) then
- if (tp.num_threads_in_pool() != 0) then
- This function will make concurrent calls to the given functions. In
- This function will make concurrent calls to the given functions. In
particular, it will submit the calls to the functions as jobs to the
particular, it will submit the calls to the functions as jobs to the
...
@@ -153,7 +165,8 @@ namespace dlib
...
@@ -153,7 +165,8 @@ namespace dlib
const
std
::
vector
<
function_spec
>&
specs
,
const
std
::
vector
<
function_spec
>&
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
);
);
/*!
/*!
this function is identical to the find_max_global() defined immediately above,
this function is identical to the find_max_global() defined immediately above,
...
@@ -168,7 +181,8 @@ namespace dlib
...
@@ -168,7 +181,8 @@ namespace dlib
const
std
::
vector
<
function_spec
>&
specs
,
const
std
::
vector
<
function_spec
>&
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
);
);
/*!
/*!
This function is identical to the find_max_global() defined immediately above,
This function is identical to the find_max_global() defined immediately above,
...
@@ -184,7 +198,8 @@ namespace dlib
...
@@ -184,7 +198,8 @@ namespace dlib
const
std
::
vector
<
function_spec
>&
specs
,
const
std
::
vector
<
function_spec
>&
specs
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
std
::
vector
<
function_evaluation
>>&
initial_function_evals
=
{}
);
);
/*!
/*!
This function is identical to the find_max_global() defined immediately above,
This function is identical to the find_max_global() defined immediately above,
...
@@ -206,7 +221,8 @@ namespace dlib
...
@@ -206,7 +221,8 @@ namespace dlib
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
);
);
/*!
/*!
requires
requires
...
@@ -225,6 +241,9 @@ namespace dlib
...
@@ -225,6 +241,9 @@ namespace dlib
- if (tp.num_threads_in_pool() != 0) then
- if (tp.num_threads_in_pool() != 0) then
- it must be safe to call the given function f() concurrently from multiple
- it must be safe to call the given function f() concurrently from multiple
threads.
threads.
- for (item : initial_function_evals):
- f(item.x) == item.y
i.e. initial_function_evals contains a record of evaluations of f().
ensures
ensures
- This function performs global optimization on the given f() function.
- This function performs global optimization on the given f() function.
The goal is to maximize the following objective function:
The goal is to maximize the following objective function:
...
@@ -263,6 +282,11 @@ namespace dlib
...
@@ -263,6 +282,11 @@ namespace dlib
being optimized. Therefore, this transformation is invisible to the user
being optimized. Therefore, this transformation is invisible to the user
supplied functions. In most cases, it improves the efficiency of the
supplied functions. In most cases, it improves the efficiency of the
optimizer.
optimizer.
- The evaluations in initial_function_evals are incorporated into the solver state at
startup. This is useful if you have information from a previous optimization attempt
of f(x) or just know some good initial x values that should be attempted as a
baseline. Giving initial_function_evals allows you to tell the solver to explicitly
include those x values in its search.
- if (tp.num_threads_in_pool() != 0) then
- if (tp.num_threads_in_pool() != 0) then
- This function will make concurrent calls to the given function f(). In
- This function will make concurrent calls to the given function f(). In
particular, it will submit the calls to f() as jobs to the given
particular, it will submit the calls to f() as jobs to the given
...
@@ -280,7 +304,8 @@ namespace dlib
...
@@ -280,7 +304,8 @@ namespace dlib
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
);
);
/*!
/*!
This function is identical to the find_max_global() defined immediately above,
This function is identical to the find_max_global() defined immediately above,
...
@@ -297,7 +322,8 @@ namespace dlib
...
@@ -297,7 +322,8 @@ namespace dlib
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
);
);
/*!
/*!
This function is identical to the find_max_global() defined immediately above,
This function is identical to the find_max_global() defined immediately above,
...
@@ -315,7 +341,8 @@ namespace dlib
...
@@ -315,7 +341,8 @@ namespace dlib
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
);
);
/*!
/*!
This function is identical to the find_min_global() defined immediately above,
This function is identical to the find_min_global() defined immediately above,
...
@@ -337,10 +364,11 @@ namespace dlib
...
@@ -337,10 +364,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
)
,
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -352,10 +380,11 @@ namespace dlib
...
@@ -352,10 +380,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
)
,
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -368,10 +397,11 @@ namespace dlib
...
@@ -368,10 +397,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
)
,
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -384,10 +414,11 @@ namespace dlib
...
@@ -384,10 +414,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
)
,
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -401,10 +432,11 @@ namespace dlib
...
@@ -401,10 +432,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -416,10 +448,11 @@ namespace dlib
...
@@ -416,10 +448,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -432,10 +465,11 @@ namespace dlib
...
@@ -432,10 +465,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -448,10 +482,11 @@ namespace dlib
...
@@ -448,10 +482,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -464,10 +499,11 @@ namespace dlib
...
@@ -464,10 +499,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -478,10 +514,11 @@ namespace dlib
...
@@ -478,10 +514,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -493,10 +530,11 @@ namespace dlib
...
@@ -493,10 +530,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -508,10 +546,11 @@ namespace dlib
...
@@ -508,10 +546,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
std
::
vector
<
bool
>
(
bound1
.
size
(),
false
),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -525,10 +564,11 @@ namespace dlib
...
@@ -525,10 +564,11 @@ namespace dlib
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -540,10 +580,11 @@ namespace dlib
...
@@ -540,10 +580,11 @@ namespace dlib
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -556,10 +597,11 @@ namespace dlib
...
@@ -556,10 +597,11 @@ namespace dlib
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -572,10 +614,11 @@ namespace dlib
...
@@ -572,10 +614,11 @@ namespace dlib
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
const
std
::
chrono
::
nanoseconds
max_runtime
=
FOREVER
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -588,10 +631,11 @@ namespace dlib
...
@@ -588,10 +631,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -602,10 +646,11 @@ namespace dlib
...
@@ -602,10 +646,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -617,10 +662,11 @@ namespace dlib
...
@@ -617,10 +662,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
=
initial_function_evals
);
}
}
template
<
template
<
...
@@ -632,10 +678,11 @@ namespace dlib
...
@@ -632,10 +678,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
max_function_calls
num
,
const
max_function_calls
num
,
double
solver_epsilon
double
solver_epsilon
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
matrix
<
double
,
0
,
1
>
({
bound1
}),
matrix
<
double
,
0
,
1
>
({
bound2
}),
num
,
FOREVER
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -648,10 +695,11 @@ namespace dlib
...
@@ -648,10 +695,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -662,10 +710,11 @@ namespace dlib
...
@@ -662,10 +710,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -677,10 +726,11 @@ namespace dlib
...
@@ -677,10 +726,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -692,10 +742,11 @@ namespace dlib
...
@@ -692,10 +742,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound1
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -708,10 +759,11 @@ namespace dlib
...
@@ -708,10 +759,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -722,10 +774,11 @@ namespace dlib
...
@@ -722,10 +774,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -737,10 +790,11 @@ namespace dlib
...
@@ -737,10 +790,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -752,10 +806,11 @@ namespace dlib
...
@@ -752,10 +806,11 @@ namespace dlib
const
double
bound1
,
const
double
bound1
,
const
double
bound2
,
const
double
bound2
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -769,10 +824,11 @@ namespace dlib
...
@@ -769,10 +824,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -784,10 +840,11 @@ namespace dlib
...
@@ -784,10 +840,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -800,10 +857,11 @@ namespace dlib
...
@@ -800,10 +857,11 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_max_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
template
<
template
<
...
@@ -816,12 +874,14 @@ namespace dlib
...
@@ -816,12 +874,14 @@ namespace dlib
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
matrix
<
double
,
0
,
1
>&
bound2
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
vector
<
bool
>&
is_integer_variable
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
const
std
::
chrono
::
nanoseconds
max_runtime
,
double
solver_epsilon
=
0
double
solver_epsilon
=
0
,
const
std
::
vector
<
function_evaluation
>&
initial_function_evals
=
{}
)
)
{
{
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
);
return
find_min_global
(
tp
,
std
::
move
(
f
),
bound1
,
bound2
,
is_integer_variable
,
max_function_calls
(),
max_runtime
,
solver_epsilon
,
initial_function_evals
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
}
}
...
...
dlib/test/global_optimization.cpp
View file @
943408d2
...
@@ -172,6 +172,11 @@ namespace
...
@@ -172,6 +172,11 @@ namespace
DLIB_TEST_MSG
(
max
(
abs
(
true_x
-
result
.
x
))
<
1e-5
,
max
(
abs
(
true_x
-
result
.
x
)));
DLIB_TEST_MSG
(
max
(
abs
(
true_x
-
result
.
x
))
<
1e-5
,
max
(
abs
(
true_x
-
result
.
x
)));
print_spinner
();
print_spinner
();
result
=
find_max_global
(
rosen
,
{
0.1
,
0.1
},
{
2
,
2
},
max_function_calls
(
100
),
0
,
{
function_evaluation
({
1.1
,
0.9
},
rosen
({
1.1
,
0.9
}))});
dlog
<<
LINFO
<<
"rosen: "
<<
trans
(
result
.
x
);
DLIB_TEST_MSG
(
max
(
abs
(
true_x
-
result
.
x
))
<
1e-5
,
max
(
abs
(
true_x
-
result
.
x
)));
print_spinner
();
result
=
find_max_global
(
rosen
,
{
0.1
,
0.1
},
{
2
,
2
},
std
::
chrono
::
seconds
(
5
));
result
=
find_max_global
(
rosen
,
{
0.1
,
0.1
},
{
2
,
2
},
std
::
chrono
::
seconds
(
5
));
dlog
<<
LINFO
<<
"rosen: "
<<
trans
(
result
.
x
);
dlog
<<
LINFO
<<
"rosen: "
<<
trans
(
result
.
x
);
DLIB_TEST_MSG
(
max
(
abs
(
true_x
-
result
.
x
))
<
1e-5
,
max
(
abs
(
true_x
-
result
.
x
)));
DLIB_TEST_MSG
(
max
(
abs
(
true_x
-
result
.
x
))
<
1e-5
,
max
(
abs
(
true_x
-
result
.
x
)));
...
...
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