You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following you constrained optimization example in docs:
def square(x):
return sum((x - 0.5) ** 2)
optimizer = ng.optimizers.NGOpt(parametrization=2, budget=100)
# define a constraint on first variable of x:
optimizer.parametrization.register_cheap_constraint(lambda x: x[0] >= 1)
recommendation = optimizer.minimize(square, verbosity=2)
print(recommendation.value)
# >>> [1.00037625, 0.50683314]
Is this the most efficient way of performing the optimization or would it be better to incorporate the same constraint into the objective function (with an if clause that returns inf or very large value)? What are the fundamental differences of these two methods in terms of computation and the way optimization works?
The text was updated successfully, but these errors were encountered:
Following you constrained optimization example in docs:
Is this the most efficient way of performing the optimization or would it be better to incorporate the same constraint into the objective function (with an
if
clause that returnsinf
or very large value)? What are the fundamental differences of these two methods in terms of computation and the way optimization works?The text was updated successfully, but these errors were encountered: