Skip to content

Commit

Permalink
fix (#1524)
Browse files Browse the repository at this point in the history
  • Loading branch information
teytaud authored Jun 20, 2023
1 parent 62427d8 commit 125e245
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion nevergrad/optimization/recastlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,26 @@ def _optimization_function(
# ref_dirs = get_reference_directions("das-dennis", self.num_objectives, n_partitions=12)
# algorithm = get_pymoo_algorithm(self.algorithm, ref_dirs)
# else:
algorithm = get_pymoo_algorithm(weakself.algorithm)
problem = _create_pymoo_problem(weakself, objective_function)
if weakself.algorithm == "CMAES":
from pymoo.algorithms.soo.nonconvex.cmaes import CMAES

algorithm = CMAES(x0=np.random.random(problem.n_var), maxfevals=weakself.budget)
elif weakself.algorithm == "BIPOP":
from pymoo.algorithms.soo.nonconvex.cmaes import CMAES

algorithm = CMAES(
x0=np.random.random(problem.n_var),
sigma=0.5,
restarts=2,
maxfevals=weakself.budget,
tolfun=1e-6,
tolx=1e-6,
restart_from_best=True,
bipop=True,
)
else:
algorithm = get_pymoo_algorithm(weakself.algorithm)
pymoooptimize.minimize(problem, algorithm, seed=weakself._initial_seed)
return None

Expand Down Expand Up @@ -504,5 +522,7 @@ def _evaluate(self, X, out, *args, **kwargs):
return _PymooProblem(optimizer, objective_function)


PymooCMAES = Pymoo(algorithm="CMAES").set_name("PymooCMAES", register=True)
PymooBIPOP = Pymoo(algorithm="BIPOP").set_name("PymooBIPOP", register=True)
PymooNSGA2 = Pymoo(algorithm="nsga2").set_name("PymooNSGA2", register=True)
PymooBatchNSGA2 = PymooBatch(algorithm="nsga2").set_name("PymooBatchNSGA2", register=False)

0 comments on commit 125e245

Please sign in to comment.