help-glpk
[Top][All Lists]

## Re: [Help-glpk] Expressing min function according to a boolean variable

 From: Mate Hegyhati Subject: Re: [Help-glpk] Expressing min function according to a boolean variable Date: Thu, 19 Jul 2012 10:03:49 +0200 User-agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

```Hi!

I don't know if I understood well Your problem, if yes, here is a simple
solution with two constraints. (Maybe it needs some polishing, regarding
what should happen if there are two minima among the parameters, but the
general idea is the same).

Also, maybe there is some nicer way to do it.

set smaller{i in set} := setof {j in set: par[j]<par[i]} j ;

So this set will contain those, which has a smaller parameter.

s.t. constraint { i in set}
Y[i] <= 1 - sum {j in smaller[i]} var[i,j] / card(smaller[i]);

This will force Y[i] to be smaller then 1, if at lest one item with a
smaller parameter value has var[i,j] true;

the other way around:

s.t. constraint2 { i in set}
Y[i] >= 1 - sum {j in smaller[i]} var[i,j];

this will force Y[i] to be at least 1, if none with the smaller
parameter value has var[i,j] true;

I hope, this was what You were looking for.

Best regards,

Mate

On 07/19/2012 09:28 AM, esma mehiaoui wrote:
> Hello,
>
> Is it possible to express the function min according to a boolean variable?
>
> For instance:
> I have:
> Set = {a,b,c,...} which represents the set of elements
> par : is a parameter specified for each element
>
>          par[a]=10;
>          par[b]=10;
>          par[c]=15;
>
> var : is a boolean variable
>         var (i,j) such as: i and j are in set and i!=j.
>
> I would like to define a boolean variable for each element Y[i] (i in set)
> such as Y[i] = 1 if:
> for each element j in set (i != j) if var [i,j] = 1 then par[i]< par[j].
> Y[i] = 0 if there exists at least one element for which var [i,j] = 1 and
> par[j]< par[i].
>
>
>
>
>
> _______________________________________________
> Help-glpk mailing list
> https://lists.gnu.org/mailman/listinfo/help-glpk
>

``` hegyhati.vcf
Description: Vcard signature.asc
Description: OpenPGP digital signature