Re: optimize.Bounds - does lb need to be less than ub?

David Menéndez Hurtado <[email protected]> Thu, 18 May 2023 19:10:39 +0200
Newsgroups gmane.comp.python.scientific.devel
Message-ID <CAJhcF=3oaL272WqnSoeW5a4a=7s+hhE4CpU0M=QR3vbgmKDnfw@mail.gmail.com>
My first thought is that if the bounds are flipped, in the majority of
cases it is a bug, and erroring out is the correct action.

What kind of scenario do you have? And can't you apply the fix to the
boundaries before the function?

/David

On Thu, 18 May 2023, 18:41 Andrew Nelson, <[email protected]> wrote:

> Hi all,
> in https://github.com/scipy/scipy/pull/18483 `Bounds` is being modified
> slightly.
>
> Currently there's a check in there:
>
> ```
> if (self.lb > self.ub).any():
>     raise ValueError("An upper bound is less than the corresponding lower
> bound.")
> ```
>
> I would personally find it useful if Bounds was more robust in this area,
> and was able to deal with lb entries that were greater than the ub. I would
> like Bounds to have a clear up code with something like:
>
> ```
> _lb = np.minimum(self.lb, self.ub)
> _ub = np.maximum(self.lb, self.ub)
> self.lb = _lb
> self.ub = _ub
> ```
>
> What are peoples thoughts on this?
>
> A.
>
>
> _____________________________________
> Dr. Andrew Nelson
>
>
> _____________________________________
> _______________________________________________
> SciPy-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/scipy-dev.python.org/
> Member address: [email protected]
>

_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]