Skip to content

Commit

Permalink
Fix ElementwiseProblem call of pymoo in VCBO
Browse files Browse the repository at this point in the history
  • Loading branch information
ajikmr committed Mar 22, 2022
1 parent 725fb30 commit 4c49a77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions HEBO/hebo/optimizers/vcbo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from pymoo.factory import get_sampling, get_crossover, get_mutation, get_algorithm
from pymoo.operators.mixed_variable_operator import MixedVariableSampling, MixedVariableMutation, MixedVariableCrossover
from pymoo.core.problem import Problem
from pymoo.core.problem import ElementwiseProblem
from pymoo.optimize import minimize

import torch
Expand All @@ -25,7 +25,7 @@
from hebo.optimizers.abstract_optimizer import AbstractOptimizer


class MyProblem_gplocal(Problem):
class MyProblem_gplocal(ElementwiseProblem):
def __init__(self, gp_model, y_min, local_info, var_num=10, kappa=1.5, xi=1e-4,
lb=np.array([-1]*10), ub=np.array([1]*10), noise_level=0.0):
self.gp_model = gp_model
Expand All @@ -37,7 +37,7 @@ def __init__(self, gp_model, y_min, local_info, var_num=10, kappa=1.5, xi=1e-4,
self.lb = lb
self.ub = ub
self.noise_level = noise_level
super().__init__(n_var=self.var_num, n_obj=1, n_constr=4, xl=self.lb, xu=self.ub, elementwise_evaluation=True)
super().__init__(n_var=self.var_num, n_obj=1, n_constr=4, xl=self.lb, xu=self.ub)

def _evaluate(self, x, out, *args, **kwargs):
with torch.no_grad():
Expand Down

0 comments on commit 4c49a77

Please sign in to comment.