Evolution Search
OptunaCmaEsSearch
Solver name is “OptunaCmaEs”.
- class flopt.solvers.optuna_searches.OptunaCmaEsSearch[source]
Covariance Matrix Adaptation Evolution Strategy (CMA-ES) search of Optuna. https://optuna.readthedocs.io/en/latest/reference/samplers/generated/optuna.samplers.CmaEsSampler.html
- Parameters:
sigma0 –
n_startup_trials –
independent_sampler –
warn_independe_sampling –
seed –
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="OptunaCmaEs", msg=True, timelimit=1) print("obj =", flopt.Value(prob.obj)) print("x =", flopt.Value(x)) print("y =", flopt.Value(y)) >>> obj = -0.2857142857142857 >>> x = -0.14285714185152507 >>> y = -0.4285714299429902
OptunaNSGAIISearch
Solver name is “OptunaNSGAII”.
- class flopt.solvers.optuna_searches.OptunaNSGAIISearch[source]
Multi-objective sampler using the NSGA-II algorithm of Optuna. This solver can solve constrainted problems, but it cannot handle equal constraints well.
- Parameters:
name (str) – name
population_size (int) –
mutation_prob (float) –
crossover –
crossover_prob (float) –
swapping_prob (float) –
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="OptunaNSGAII", msg=True, timelimit=1) print("obj =", flopt.Value(prob.obj)) print("x =", flopt.Value(x)) print("y =", flopt.Value(y))