Baysian Search
OptunaTPESearch
Solver name is “OptunaTPE”.
- class flopt.solvers.optuna_searches.OptunaTPESearch[source]
Tree-structured Parzen Estimator (TPE) Sampling Search of Optuna. https://optuna.readthedocs.io/en/latest/reference/samplers/generated/optuna.samplers.TPESampler.html This solver can solve constrainted problems, but it cannot handle equal constraints well.
- Parameters:
name (str) – name
consider_prior (bool) –
consider_magic_clip (bool) –
consider_endpoints (bool) –
n_startup_trials (int) –
n_ei_candidates (int) –
seed (float) – seed of random generater
Examples
import flopt x = flopt.Variable("x", lowBound=-1, upBound=1, cat="Continuous") y = flopt.Variable("y", lowBound=-1, upBound=1, cat="Continuous") prob = flopt.Problem() prob += 2*x*x + x*y + y*y + x + y prob += x + y >= 0 status, log = prob.solve(solver="OptunaTPE", msg=True, timelimit=1) print("obj =", flopt.Value(prob.obj)) print("x =", flopt.Value(x)) print("y =", flopt.Value(y))
HyperoptSearch
Solver name is “Hyperopt”.
- class flopt.solvers.hyperopt_search.HyperoptSearch[source]
TPE Search using Hyperopt (https://hyperopt.github.io/hyperopt/)
- Parameters:
n_trial (int) – number of trials
show_progressbar (bool) – whether display a progress bar of search
Examples
import flopt x = flopt.Variable("x", lowBound=-1, upBound=1, cat="Continuous") y = flopt.Variable("y", lowBound=-1, upBound=1, cat="Continuous") prob = flopt.Problem() prob += 2*x*x + x*y + y*y + x + y status, log = prob.solve(solver="Hyperopt", msg=True, timelimit=1) print("obj =", flopt.Value(prob.obj)) print("x =", flopt.Value(x)) print("y =", flopt.Value(y))