Closed jacktang closed 5 months ago
Hello @jacktang,
let me rewrite the specific example from above using pseudocode:
def black_box_function_with_constraints(**kwargs):
if not constraint_fulfilled(**kwargs):
return BAD_VALUE
else:
return target_function(**kwargs)
I would encourage you to read the constraints documentation again. Other than that, If you can be more specific with your problem, I might be able to help better.
Hello @till-m , thanks for your reply!
In my case, the black box function is evaluated by some CFD simulation software, and the constraint function is unknown, I will check the output of simulation, if the result is not completed, i suppose the constraint violented. Can the BAD_VALUE
be - np.inf
?
Hey @jacktang,
the idea behind this approach is to discourage the optimizer from re-visiting a region that most likeli does not fulfill the constraints by registering a "bad value". Choosing -np.inf
will break the GP fitting, it would be better to choose a bad, but potentially realistic value -- i.e. something slightly worse than what you've previously observed during optimization.
Thanks for the explanation!
Hello,
I am running 11 dim constrained optimization problem, the bound is clear, and constraint function is unknown. I noticed that BayesianOptimization supports constraint function approximation. But I am not clear how to define
black_box_function_with_constraints
. Take below code as example (from https://bayesian-optimization.github.io/BayesianOptimization/constraints.html)why
-10
is constraint values? Thanks!