I looked into the documentation of the scipy.optimize.Bounds
-class and wondered about what the argument keep_feasible
does. Can someone create an example for this? Because I struggle to understand the description.

- 53
- 4
-
Does this answer your question? [Is there any out of the box newton like solver that allows bounds (and a supplied jacobian and hessian)](https://stackoverflow.com/questions/68105233/is-there-any-out-of-the-box-newton-like-solver-that-allows-bounds-and-a-supplie) – 9769953 Apr 18 '23 at 13:01
-
I've suggested a duplicate. The question may not be similar, but I think the answer (with some of the question's context) may provide the example you're looking for. – 9769953 Apr 18 '23 at 13:01
1 Answers
This is not well documented but this parameter is mostly used for trust-region minimization.
https://docs.scipy.org/doc/scipy/reference/optimize.minimize-trustconstr.html
I could find some discussion in an issue: https://github.com/scipy/scipy/issues/18234#issuecomment-1493469755
If you use keep_feasible=True with SLSQP or Cobyla then its only effect will be to produce an Exception when a point that doesn't obey Bounds is used to calculate a finite difference. The keyword has no other effect in the minimisation.
keep_feasible was mainly designed for use with trust_constr. With this method keep_feasible is used to specify that all steps taken should be within a feasible region. trust-constr works towards minimising the objective function and minimising constraint violation (see initial_constr_penalty).

- 5,738
- 3
- 31
- 52