add dlib optimizer
This commit is contained in:
parent
91b167992a
commit
8ebd87e965
2 changed files with 18 additions and 0 deletions
17
dlibcube2.py
Normal file
17
dlibcube2.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from dlib import find_min_global
|
||||
from randomcube2 import another_random_cube
|
||||
from utils import wrap_untrustworthy, final
|
||||
|
||||
|
||||
def dlib_cube(objective, n_trials, n_dim, with_count):
|
||||
if n_dim > 35:
|
||||
return another_random_cube(objective, n_trials, n_dim, with_count)
|
||||
|
||||
_objective = wrap_untrustworthy(objective, n_trials)
|
||||
|
||||
def __objective(*args):
|
||||
return _objective(list(args))
|
||||
|
||||
find_min_global(__objective, [0.0] * n_dim, [1.0] * n_dim, n_trials)
|
||||
fopt, xopt, feval_count = _objective(final)
|
||||
return (fopt, xopt, feval_count) if with_count else (fopt, xopt)
|
|
@ -1,3 +1,4 @@
|
|||
from dlibcube2 import dlib_cube
|
||||
from nloptcube2 import nlopt_neldermead_cube
|
||||
from randomcube2 import another_random_cube, quasirandom_cube
|
||||
|
||||
|
|
Loading…
Reference in a new issue