[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] function

From: Mate Hegyhati
Subject: Re: [Help-glpk] function
Date: Fri, 17 Aug 2012 18:05:41 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0


>> R >= 0
>> R <= P - PMIN*X
>> R <= PMAX*X - P
> This fails for X=0.
If X==0, then the RHS in the last two inequalities are 0, so together
with P, R will be set to 0 too, that is the desired behaviour

But You are correct, my proposed model fails, if X==0, however, it is
because of these constraints:

P <= (PMIN + PMAX) / 2 + (1-Y) * (PMAX-PMIN)/2
P >= (PMIN + PMAX) / 2 - (1-Y) * (PMAX-PMIN)/2

First of all, it should have been like this:

P <= (PMIN + PMAX) / 2 + Y * (PMAX-PMIN)/2
P >= (PMIN + PMAX) / 2 - (1-Y) * (PMAX-PMIN)/2

The first one enforces Y=1 if  P > (PMIN + PMAX) / 2, and the second one
enforces Y=0 if P < (PMIN + PMAX) / 2.

However, I considered P here only in the [PMIN,PMAX] interval, thus if
P==0, the second one can not be satisfied.

To resolve this mistake, the second inequality should be like this for

P >= (PMIN + PMAX) / 2 - (1-Y) * (PMAX-PMIN)/2 -  ( 1 - X ) * PMIN

This additional "-  ( 1 - X ) * PMIN" further relaxes the constraint if
X = 0. (In this case Y will still be set for 0).

And then the rest of the constraints would just work fine:
R >= P - PMIN - Y * PMAX
R >= PMAX - P - (1-Y)*PMAX

Note, that I assumed, that PMIN > 0, but if it is not a case, some
relaxations must still be polished.

And as Michael said, choosing a really bigM is usually not a good way to
go. Luckily here PMAX can be used as a general bigM, but sometimes a
smaller can be used as well, like (PMAX-PMIN)/2 in the constraints I
failed with.

Thank You very much for pointing out the mistake I made. I'm sorry for
giving an erroneous suggestion.

Best regards,


Attachment: hegyhati.vcf
Description: Vcard

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]