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

federico vaggi <[email protected]>
Newsgroups gmane.comp.python.scientific.user
Message-ID <CAGvd0=hfYnzMLq4Dw9Fm950_cpxAbM=Wf4BQYivBDqV5PiaX6g@mail.gmail.com>
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 <[email protected]> wrote:

> Send SciPy-User mailing list submissions to
>         [email protected]
>
> 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
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> 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 <[email protected]>
> To: SciPy-User <[email protected]>
> Subject: [SciPy-User] A priority of constrains for
>         scipy.optimize.minimize
> Message-ID: <[email protected]>
> 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
> [email protected]
> https://mail.python.org/mailman/listinfo/scipy-user
>
>
> ------------------------------
>
> End of SciPy-User Digest, Vol 186, Issue 2
> ******************************************
>

_______________________________________________
SciPy-User mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scipy-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.