help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] function


From: Zvonko Bregar
Subject: Re: [Help-glpk] function
Date: Fri, 17 Aug 2012 10:54:02 +0000

Hi Mate,
Many thanks for your quick answer.
I will try both solutions, first "the simple" one.
Thanks again.
--Zvonko

-----Original Message-----
From: Mate Hegyhati [mailto:address@hidden
Sent: Friday, August 17, 2012 10:18 AM
To: Zvonko Bregar
Cc: address@hidden
Subject: Re: [Help-glpk] function

Hi Zvonko,

maybe something like this?

R >= 0
R <= P - PMIN*X
R <= PMAX*X - P

This should be enough, if R is not represented anywhere else, and it should be 
as much as possible in the objective.

Otherwise I think You need an additional binary variable, Y, representing 
whether P is closer to PMIN or to PMAX.

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

And then You can add these to the above constraints:

R >= P - PMIN - Y * PMAX
R >= PMAX - P - (1-Y)*PMAX

Hope this is what You are looking for, best regards,

Mate

On 08/17/2012 10:02 AM, Zvonko Bregar wrote:
> Hi,
>
> My name is Zvonko Bregar.
>
> Please help me with the following problem.
>
> There is a real variable P having disjunct definition area {0} + [PMIN, PMAX].
> There is also a binary variable X helping in this definition.
> If X = 0 then P = 0
> And if X = 1 then PMIN < P < PMAX.
> So variables X an P work simultaneously.
> This should be a rather standard construction.
>
> The question is to construct another variable, say R, from X an P Such
> that If X = P = 0 then also R = 0 Else R = min {P-PMIN,PMAX-P}
>
> In other words, R measures the minimal distance of P to its boundaries PMIN 
> and PMAX.
> But if P = 0 then R must be set to 0 too.
>
> For example, if PMIN = 200 and PMAX = 400, than the required function should 
> be something like the "upside down" absolute value function:
>
> R =  - | P - 300 | + 100  if 200 < P < 400
>
> But also R = 0 if P = 0.
>
> I have been trying this for quite some time but didn't succeed. It looks 
> simple and perhaps there is a simple solution? Or perhaps this cannot be done 
> at all?
>
> Thank you
>
> OPOZORILO: To elektronsko sporo?ilo in vse njegove morebitne priloge lahko 
> vsebujejo zaupne in/ali privilegirane informacije, ki so last 
> Elektroin?tituta Milan Vidmar in so namenjene izklju?no naslovniku. ?e ste 
> sporo?ilo prejeli pomotoma zaradi napake v naslovu ali pri prenosu sporo?ila, 
> Vas prosimo, da nas o tem obvestite s povratno po?to. V tem primeru vsebine 
> prejetega sporo?ila ne smete uporabiti, kopirati, tiskati, objaviti ali 
> distribuirati, ampak ga morate takoj uni?iti.
>
> DISCLAIMER: This e-mail is for the intended recipient only. It contains 
> proprietary information some or all of which may be legally privileged. If 
> you received this e-mail by mistake please notify us by replying to this 
> e-mail. Consequently, the contents of this e-mail must be deleted and not be 
> used, copied, printed, disclosed or distributed.
>
>
>
>
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk
>

OPOZORILO: To elektronsko sporočilo in vse njegove morebitne priloge lahko 
vsebujejo zaupne in/ali privilegirane informacije, ki so last Elektroinštituta 
Milan Vidmar in so namenjene izključno naslovniku. Če ste sporočilo prejeli 
pomotoma zaradi napake v naslovu ali pri prenosu sporočila, Vas prosimo, da nas 
o tem obvestite s povratno pošto. V tem primeru vsebine prejetega sporočila ne 
smete uporabiti, kopirati, tiskati, objaviti ali distribuirati, ampak ga morate 
takoj uničiti.

DISCLAIMER: This e-mail is for the intended recipient only. It contains 
proprietary information some or all of which may be legally privileged. If you 
received this e-mail by mistake please notify us by replying to this e-mail. 
Consequently, the contents of this e-mail must be deleted and not be used, 
copied, printed, disclosed or distributed.


reply via email to

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