diff --git a/thursday/candidates/dlib.py b/thursday/candidates/dlib.py index 8db9159..000d35e 100644 --- a/thursday/candidates/dlib.py +++ b/thursday/candidates/dlib.py @@ -3,9 +3,9 @@ from .random import another_random_cube from ..utilities import wrap_untrustworthy, final -def dlib_cube(objective, n_trials, n_dim, with_count): +def dlib_cube(objective, n_trials, n_dim): if n_dim > 35: - return another_random_cube(objective, n_trials, n_dim, with_count) + return another_random_cube(objective, n_trials, n_dim) _objective = wrap_untrustworthy(objective, n_trials) @@ -13,5 +13,4 @@ def dlib_cube(objective, n_trials, n_dim, with_count): 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) + return _objective(final) diff --git a/thursday/candidates/evolopy.py b/thursday/candidates/evolopy.py index 5d239c5..e7b80cc 100644 --- a/thursday/candidates/evolopy.py +++ b/thursday/candidates/evolopy.py @@ -43,7 +43,7 @@ def make_evolopy(optimizer_name, popsize=None): } optimizer = optimizers[optimizer_name.upper()] - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): # ps = n_dim if popsize is None else popsize # ps = max(4, ps) if optimizer_name.upper() == "DE" else ps ps = int(4 + 3 * np.log(n_dim)) if popsize is None else popsize @@ -58,8 +58,7 @@ def make_evolopy(optimizer_name, popsize=None): except ExhaustedTrialsError: pass - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = f"evolopy_{optimizer.__name__.lower()}" name += f"_auto" if popsize is None else f"_ps{popsize:02}" diff --git a/thursday/candidates/fcmaes.py b/thursday/candidates/fcmaes.py index dc61bce..a0f8653 100644 --- a/thursday/candidates/fcmaes.py +++ b/thursday/candidates/fcmaes.py @@ -21,13 +21,12 @@ def _fix_logging(original_function): def make_biteopt(depth=1): from fcmaes.optimizer import Bite_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) optim = Bite_cpp(max_evaluations=n_trials, M=depth) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = f"fcmaes_biteopt_d{depth}" f.__name__ = name + "_cube" @@ -38,15 +37,14 @@ def make_biteopt(depth=1): def make_csma(isigma=3): from fcmaes.optimizer import Csma_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) optim = Csma_cpp(max_evaluations=n_trials) _xopt, _fopt, _feval_count = optim.minimize( _objective, bounds, sdevs=1 / isigma ) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = f"fcmaes_csma_is{isigma:02}" f.__name__ = name + "_cube" @@ -57,7 +55,7 @@ def make_csma(isigma=3): def make_fcmaes(popsize=None): from fcmaes.optimizer import Cma_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) ps = int(4 + 3 * np.log(n_dim)) if popsize is None else popsize @@ -69,8 +67,7 @@ def make_fcmaes(popsize=None): delayed_update=False, ) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds, sdevs=1 / 3) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = "fcmaes_cma" name += f"_auto" if popsize is None else f"_ps{popsize}" @@ -82,14 +79,13 @@ def make_fcmaes(popsize=None): def make_crfmnes(popsize=None): from fcmaes.optimizer import Crfmnes_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) ps = int(4 + 3 * np.log(n_dim)) if popsize is None else popsize optim = Crfmnes_cpp(max_evaluations=n_trials, popsize=ps) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds, sdevs=1 / 3) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = "fcmaes_crfmnes" name += f"_auto" if popsize is None else f"_ps{popsize}" @@ -102,13 +98,12 @@ _broken = """ def make_lde(popsize=None): from fcmaes.optimizer import LDe_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) optim = LDe_cpp(max_evaluations=n_trials, popsize=popsize) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = "fcmaes_lde" name += f"_auto" if popsize is None else f"_ps{popsize}" @@ -121,13 +116,12 @@ def make_lde(popsize=None): def make_da(local=True): from fcmaes.optimizer import Da_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) optim = Da_cpp(max_evaluations=n_trials, use_local_search=local) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = "fcmaes_da" if local: @@ -140,13 +134,12 @@ def make_da(local=True): def make_gclde(popsize=None): from fcmaes.optimizer import GCLDE_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) optim = GCLDE_cpp(max_evaluations=n_trials, popsize=popsize) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = "fcmaes_gclde" name += f"_auto" if popsize is None else f"_ps{popsize}" @@ -158,13 +151,12 @@ def make_gclde(popsize=None): def make_lclde(popsize=None): from fcmaes.optimizer import LCLDE_cpp - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials) bounds = Bounds([0.0] * n_dim, [1.0] * n_dim) optim = LCLDE_cpp(max_evaluations=n_trials, popsize=popsize) _xopt, _fopt, _feval_count = optim.minimize(_objective, bounds) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = "fcmaes_lclde" name += f"_auto" if popsize is None else f"_ps{popsize}" diff --git a/thursday/candidates/nevergrad.py b/thursday/candidates/nevergrad.py index 3bd0cbf..79a81e3 100644 --- a/thursday/candidates/nevergrad.py +++ b/thursday/candidates/nevergrad.py @@ -303,7 +303,7 @@ assert ol.RSLSQP is ol.RSQP, "weirdness is gone, please adjust accordingly" assert ol.SLSQP is ol.SQP, "weirdness is gone, please adjust accordingly" -def nevergrad_cube_factory(optimizer, objective, n_trials, n_dim, with_count): +def nevergrad_cube_factory(optimizer, objective, n_trials, n_dim): instrument = ng.p.Array(lower=0, upper=1, shape=(n_dim,)) # better sigma # ev.RBO, ev.QRBO, ev.MidQRBO, and ev.LBO still complain, though: # /home/py/.local/lib/python3.10/site-packages/nevergrad/parametrization/_datalayers.py:107: NevergradRuntimeWarning: Bounds are 1.0 sigma away from each other at the closest, you should aim for at least 3 for better quality. @@ -326,7 +326,7 @@ def nevergrad_cube_factory(optimizer, objective, n_trials, n_dim, with_count): best_x = recommendation.value best_val = cube_objective(best_x) # don't trust recommendation.loss - return (best_val, best_x, feval_count) if with_count else (best_val, best_x) + return best_val, best_x, feval_count def named_optimizer(optimizer, experimental=False): diff --git a/thursday/candidates/nlopt.py b/thursday/candidates/nlopt.py index 79956ec..d3a7d70 100644 --- a/thursday/candidates/nlopt.py +++ b/thursday/candidates/nlopt.py @@ -47,7 +47,7 @@ NLOPTIMIZERS = { } -def nlopt_cube_factory(objective, n_trials, n_dim, with_count, method): +def nlopt_cube_factory(objective, n_trials, n_dim, method): optim = NLOPTIMIZERS[method] feval_count = 0 @@ -83,110 +83,109 @@ def nlopt_cube_factory(objective, n_trials, n_dim, with_count, method): assert best_so_far is not None, optimizer.__name__ fopt, xopt = best_so_far - - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return fopt, xopt, feval_count -def nlopt_ags_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_ags") +def nlopt_ags_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_ags") -def nlopt_crs2_lm_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_crs2_lm") +def nlopt_crs2_lm_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_crs2_lm") -def nlopt_direct_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_direct") +def nlopt_direct_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_direct") -def nlopt_direct_l_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_direct_l") +def nlopt_direct_l_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_direct_l") -def nlopt_direct_l_noscal_cube(objective, n_trials, n_dim, with_count): +def nlopt_direct_l_noscal_cube(objective, n_trials, n_dim): return nlopt_cube_factory( - objective, n_trials, n_dim, with_count, "gn_direct_l_noscal" + objective, n_trials, n_dim, "gn_direct_l_noscal" ) -def nlopt_direct_lr_cube(objective, n_trials, n_dim, with_count): +def nlopt_direct_lr_cube(objective, n_trials, n_dim): return nlopt_cube_factory( - objective, n_trials, n_dim, with_count, "gn_direct_l_rand" + objective, n_trials, n_dim, "gn_direct_l_rand" ) -def nlopt_direct_lr_noscal_cube(objective, n_trials, n_dim, with_count): +def nlopt_direct_lr_noscal_cube(objective, n_trials, n_dim): return nlopt_cube_factory( - objective, n_trials, n_dim, with_count, "gn_direct_l_rand_noscal" + objective, n_trials, n_dim, "gn_direct_l_rand_noscal" ) -def nlopt_direct_noscal_cube(objective, n_trials, n_dim, with_count): +def nlopt_direct_noscal_cube(objective, n_trials, n_dim): return nlopt_cube_factory( - objective, n_trials, n_dim, with_count, "gn_direct_noscal" + objective, n_trials, n_dim, "gn_direct_noscal" ) -def nlopt_esch_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_esch") +def nlopt_esch_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_esch") -def nlopt_isres_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_isres") +def nlopt_isres_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_isres") -def nlopt_mlsl_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_mlsl") +def nlopt_mlsl_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_mlsl") -def nlopt_mlsl_lds_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_mlsl_lds") +def nlopt_mlsl_lds_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_mlsl_lds") -def nlopt_orig_direct_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "gn_orig_direct") +def nlopt_orig_direct_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "gn_orig_direct") -def nlopt_orig_direct_l_cube(objective, n_trials, n_dim, with_count): +def nlopt_orig_direct_l_cube(objective, n_trials, n_dim): return nlopt_cube_factory( - objective, n_trials, n_dim, with_count, "gn_orig_direct_l" + objective, n_trials, n_dim, "gn_orig_direct_l" ) -def nlopt_auglag_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_auglag") +def nlopt_auglag_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_auglag") -def nlopt_auglag_eq_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_auglag_eq") +def nlopt_auglag_eq_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_auglag_eq") -def nlopt_bobyqa_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_bobyqa") +def nlopt_bobyqa_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_bobyqa") -def nlopt_cobyla_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_cobyla") +def nlopt_cobyla_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_cobyla") -def nlopt_neldermead_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_neldermead") +def nlopt_neldermead_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_neldermead") -def nlopt_newuoa_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_newuoa") +def nlopt_newuoa_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_newuoa") -def nlopt_newuoa_bound_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_newuoa_bound") +def nlopt_newuoa_bound_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_newuoa_bound") -def nlopt_praxis_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_praxis") +def nlopt_praxis_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_praxis") -def nlopt_sbplx_cube(objective, n_trials, n_dim, with_count): - return nlopt_cube_factory(objective, n_trials, n_dim, with_count, "ln_sbplx") +def nlopt_sbplx_cube(objective, n_trials, n_dim): + return nlopt_cube_factory(objective, n_trials, n_dim, "ln_sbplx") NLOPT_OPTIMIZERS = [ diff --git a/thursday/candidates/notwa.py b/thursday/candidates/notwa.py index f223d31..94f59e7 100644 --- a/thursday/candidates/notwa.py +++ b/thursday/candidates/notwa.py @@ -6,7 +6,7 @@ import numpy as np def make_birect(deepness=23, *, longest=False, pruning=False): from ..internal.birect import birect - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): feval_count = 0 def _objective(x): @@ -24,7 +24,7 @@ def make_birect(deepness=23, *, longest=False, pruning=False): pruning=pruning, F=np.float64, ) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return fopt, xopt, feval_count name = f"birect{deepness:02}" name += "_longest" if longest else "" @@ -39,7 +39,7 @@ def make_soo(deepness=None, *, K=3): assert K >= 2 from ..internal.soo import soo - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): feval_count = 0 def _objective(x): @@ -51,7 +51,7 @@ def make_soo(deepness=None, *, K=3): _objective, np.full(n_dim, 0.5), 0.5, n_trials, K=K, h_max=deepness ) fopt = history[-1] - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return fopt, xopt, feval_count name = f"soo{deepness}_k{K}" f.__name__ = name + "_cube" @@ -63,7 +63,7 @@ def make_mercury( ): from ..internal.hg import minimize as hg - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy(objective, n_trials, bounding=bounding) init = (0.5,) * n_dim @@ -89,8 +89,7 @@ def make_mercury( x = prng.uniform(size=n_dim) fx = _objective(x) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = f"hg{flags:02}" name += f"_{bounding}" if bounding != "clip" else "" diff --git a/thursday/candidates/random.py b/thursday/candidates/random.py index 9bfdbf8..36464c9 100644 --- a/thursday/candidates/random.py +++ b/thursday/candidates/random.py @@ -2,7 +2,7 @@ from ..utilities import phi import numpy as np -def another_random_cube(objective, n_trials, n_dim, with_count, seed=None): +def another_random_cube(objective, n_trials, n_dim, seed=None): prng = np.random.default_rng(seed) fopt = None xopt = None @@ -12,10 +12,10 @@ def another_random_cube(objective, n_trials, n_dim, with_count, seed=None): if fopt is None or xopt is None or fx < fopt: fopt = fx xopt = x - return (fopt, xopt, n_trials) if with_count else (fopt, xopt) + return fopt, xopt, n_trials -def quasirandom_cube(objective, n_trials, n_dim, with_count): +def quasirandom_cube(objective, n_trials, n_dim): # http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/ magic = phi(n_dim) alpha = np.zeros(n_dim) @@ -32,4 +32,4 @@ def quasirandom_cube(objective, n_trials, n_dim, with_count): if best_so_far is None or fx < best_so_far[0]: best_so_far = (fx, x) fopt, xopt = best_so_far - return (fopt, xopt, n_trials) if with_count else (fopt, xopt) + return fopt, xopt, n_trials diff --git a/thursday/candidates/scipy.py b/thursday/candidates/scipy.py index 00d0b84..8cfaa55 100644 --- a/thursday/candidates/scipy.py +++ b/thursday/candidates/scipy.py @@ -23,7 +23,7 @@ def make_scipy(method, *, jacobian=None, hessian=None): # "trust-krylov", ), method - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): prng = np.random.default_rng() _objective = wrap_untrustworthy( objective, n_trials, raising=True, bounding="sine" @@ -107,8 +107,7 @@ def make_scipy(method, *, jacobian=None, hessian=None): # TODO: run without this, try to minimize number of attempts (i.e. list length) # if len(checks) >= 5: print(method, [b - a for a, b in zip(checks, checks[1:])]) - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = f"scipy_{method.replace('-', '').lower()}" if jacobian == "2-point": @@ -127,7 +126,7 @@ def make_scipy(method, *, jacobian=None, hessian=None): return f -def scipy_basinhopping_cube(objective, n_trials, n_dim, with_count): +def scipy_basinhopping_cube(objective, n_trials, n_dim): progress = 1e-2 # TODO: make configurable? # NOTE: could also callbacks to extract solutions instead of wrapping objective functions? @@ -151,10 +150,10 @@ def scipy_basinhopping_cube(objective, n_trials, n_dim, with_count): ) fopt, xopt, feval_count = res.fun, res.x, res.nfev # print("success:", res.success) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return fopt, xopt, feval_count -def scipy_direct_cube(objective, n_trials, n_dim, with_count): +def scipy_direct_cube(objective, n_trials, n_dim): bounds = scopt.Bounds([0.0] * n_dim, [1.0] * n_dim) # TODO: try different values of eps. default 0.0001 res = scopt.direct( @@ -166,10 +165,10 @@ def scipy_direct_cube(objective, n_trials, n_dim, with_count): ) fopt, xopt, feval_count = res.fun, res.x, res.nfev # print("success:", res.success) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return fopt, xopt, feval_count -def scipy_direct_l_cube(objective, n_trials, n_dim, with_count): +def scipy_direct_l_cube(objective, n_trials, n_dim): bounds = scopt.Bounds([0.0] * n_dim, [1.0] * n_dim) # TODO: try different values of eps. default 0.0001 res = scopt.direct( @@ -183,7 +182,7 @@ def scipy_direct_l_cube(objective, n_trials, n_dim, with_count): ) fopt, xopt, feval_count = res.fun, res.x, res.nfev # print("success:", res.success) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return fopt, xopt, feval_count def make_shgo(method="cobyla", init="large", it=1, mei=False, li=False, ftol=12): @@ -199,7 +198,7 @@ def make_shgo(method="cobyla", init="large", it=1, mei=False, li=False, ftol=12) # https://docs.scipy.org/doc/scipy/reference/optimize.minimize-cobyla.html pass - def f(objective, n_trials, n_dim, with_count): + def f(objective, n_trials, n_dim): _objective = wrap_untrustworthy( objective, n_trials, bounding="clip", raising=True ) @@ -220,8 +219,7 @@ def make_shgo(method="cobyla", init="large", it=1, mei=False, li=False, ftol=12) ) except ExhaustedTrialsError: pass - fopt, xopt, feval_count = _objective(final) - return (fopt, xopt, feval_count) if with_count else (fopt, xopt) + return _objective(final) name = f"shgo_{method}" if it != 1: diff --git a/thursday/go_benchmark_it.py b/thursday/go_benchmark_it.py index 3b83c4b..0adede1 100644 --- a/thursday/go_benchmark_it.py +++ b/thursday/go_benchmark_it.py @@ -380,7 +380,7 @@ def main(argv, display=True): note( f"Using {opt_name} to optimize {obj_realname} ({obj_name}) [{run}] ..." ) - _ = optimizer(wrapped, n_trials=n_trials, n_dim=n_dim, with_count=False) + _ = optimizer(wrapped, n_trials=n_trials, n_dim=n_dim) fopt, xopt = wrapped.finish() result = (fopt, opt_name, wrapped.history) results.setdefault(obj_name, []).append(result) diff --git a/thursday/parties.py b/thursday/parties.py index 70d7912..144e187 100644 --- a/thursday/parties.py +++ b/thursday/parties.py @@ -32,6 +32,7 @@ EVOLOPY_OPTIMIZERS = [ FCMAES_OPTIMIZERS = [ make_biteopt(1), make_biteopt(2), + make_biteopt(3), make_csma(3), make_da(False), # TODO: fix local=True case. ] + [