Open slishak-PX opened 1 week ago
cc @dme65 who introduced this check, but I believe it was in a context where we could not simply use SLSQP so making sure that the ICs satisfied the constraints was necessary. I guess we could potentially make this a warning in cases when we use optimizers that can handle infeasible ICs.
I just spotted this explanation in the docstring:
So the motivation wasn't necessarily to enforce a feasible starting point, it was to ensure the returned candidate is feasible even if the optimiser fails.
In this case, it probably makes sense to raise the warning (or exception) only in the case that the optimiser fails to find a feasible point.
Side-note: it might be confusing that nonlinear_inequality_constraints
are feasible when the indicator is positive but outcome_constraint
has the opposite convention.
In this case, it probably makes sense to raise the warning (or exception) only in the case that the optimiser fails to find a feasible point.
That makes sense to me.
Side-note: it might be confusing that
nonlinear_inequality_constraints
are feasible when the indicator is positive butoutcome_constraint
has the opposite convention.
Yeah, great point. And we could use better documentation on how and where to define constraints.
🐛 Bug
When using
nonlinear_inequality_constraints
inoptimize_acqf
, you need to setbatch_initial_conditions
, and these ICs need to respect the constraints. This seems unnecessary - SLSQP is capable of starting from an infeasible IC. If the only reasonbatch_initial_conditions
needs to be set is so that the user is forced to provide a feasible IC, then this requirement can be relaxed too.I imagine the issue can also be solved by using
DeterministicModel
with an outcome constraint, but this does not work with analytic acquisition functions.https://github.com/pytorch/botorch/blob/92d73e41220316235772d1783b77f8aea52706ea/botorch/optim/parameter_constraints.py#L593-L596
To reproduce
Code snippet to reproduce
Stack trace/error message
Expected Behavior
If the exception is commented out, the same candidate is found regardless of whether
initial_condition
is feasible or infeasible, demonstrating that in this case the exception is preventing use cases where it is hard to find a feasible region and you want the optimiser to find it for you.System information
Please complete the following information:
Additional context
NA