Open jacktang opened 4 months ago
the easiest thing to do is add a soft constraint via a differentiable function, something like
margin = cv_mean - 12.5
penalty = - torch.where(margin > 0, 100 * torch.exp(-1 / margin), 0.0)
@martinjankowiak I'm not quite understand your remark. Do you mean add penalty
soft constraint to objective
function like below?
def branin100_with_constraints(x):
....
penalty = torch.where(margin > 0, 100 * torch.exp(-1 / margin), 0.0)
return t1 ** 2 + t2 + 10 + torch.mean(penalty)
yes although not sure about that mean
you added. this is a direct analog of your
if cv_mean > 12.5:
return 1e5
but is differentiable whereas your intervention is not
Hello, I modified
branin100
problem with constraints as belowthe constraint is
np.mean(x[(x > 3)]) > 12.5
, and I found saasbo can't find feasible solution. I also run the problem using NSGA-II, it returns the optimized result (4.68769846). So can you give some advice on solving problem with constraints? Thanks!