[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] How to linearize a weighted average with a decision vari
From: |
Heinrich Schuchardt |
Subject: |
Re: [Help-glpk] How to linearize a weighted average with a decision variable? |
Date: |
Thu, 26 Apr 2018 08:18:16 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/25/2018 03:15 AM, Matt wrote:
> Hi all,
>
> I'm trying to model a problem but it turned out to be non linear.
>
> A simplified version of the model is written below. Basically it
> averages the weighted value of all enabled points, provided there are
> exactly M enabled points.
>
> *max sum(i) { enabled[i] * value[i] * weight[i] } / sum(i) { enabled[i]
> * weight[i] }*
> *s.t. sum (i) enabled[i] = M
If there are no further constraints there is no need for a MIP solver.
The problem can be solved by sorting by value and weight.
If the number of binaries is small (<= 20) you will be able to iterate
over all permutations with sum(enabled) = M sorted by descending
objective and to take the first combination satisfying all constraints.
Regards
Heinrich
> *
>
> - *value*is a vector of decimal numbers in [0, 1] (precomputed)
> - *weight*is a vector of decimal numbers in [0, 1] (precomputed)
> - *enabled*is a vector of either 0 or 1 (decision variable)
>
> The model is very simple so I'm guessing there probably is a way to
> linearize it or some workaround I'm not aware of.
>
> Thanks,
> Matt
>
>
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk
>