# Re: A priority of constrains for scipy.optimize.minimize

 Classic List Threaded
1 message
Reply | Threaded
Open this post in threaded view
|

## Re: A priority of constrains for scipy.optimize.minimize

 Change your loss function to a penalized form.IE:Instead of minimizing L(x)s.t.f_1(x) (necessary constraint)f_2(x) (nice but not necessary constraint)....Do this instead:Minimize L(x) + \lambda * f_2(x)s.t.f_1(x)where \lambda can be a hyper parameter you can tune to trade off how important constraint f_2 is relative to loss function quality.Alternatively: if you are doing minimization on a probability simplex, you can probably re-parametrize your problem so the only viable solution automatically satisfies those probabilities.  The most common way is to run your output through a softmax (https://en.wikipedia.org/wiki/Softmax_function) On Tue, Feb 5, 2019 at 9:06 AM <[hidden email]> wrote:Send SciPy-User mailing list submissions to         [hidden email] To subscribe or unsubscribe via the World Wide Web, visit         https://mail.python.org/mailman/listinfo/scipy-user or, via email, send a message with subject or body 'help' to         [hidden email] You can reach the person managing the list at         [hidden email] When replying, please edit your Subject line so it is more specific than "Re: Contents of SciPy-User digest..." Today's Topics:    1. A priority of constrains for scipy.optimize.minimize       (Jan Hendrik Berlin) ---------------------------------------------------------------------- Message: 1 Date: Tue, 5 Feb 2019 02:07:35 +0100 From: Jan Hendrik Berlin <[hidden email]> To: SciPy-User <[hidden email]> Subject: [SciPy-User] A priority of constrains for         scipy.optimize.minimize Message-ID: <[hidden email]> Content-Type: text/plain; charset=utf-8; format=flowed Hi, I am solving a problem with some constrains. At first there is a constraint, that the sum of the percentages must be 1. The single percentage could be in the range from 0,0 to 1. And this is the main constraint. On the other side there are some constrains belonging to stuff of the calculation.  It is possible, that this constrains are to strong and the solver can't get a solution. In this Case I want to have an option to get a solution respecting the first constraint. Has anybody an idea of a solution? I think there is no option for a priority of the constrains. kind regards Jan Hendrik Berlin ------------------------------ Subject: Digest Footer _______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user ------------------------------ End of SciPy-User Digest, Vol 186, Issue 2 ****************************************** _______________________________________________ SciPy-User mailing list [hidden email] https://mail.python.org/mailman/listinfo/scipy-user