help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] var between 2 parameters


From: Mate Hegyhati
Subject: Re: [Help-glpk] var between 2 parameters
Date: Wed, 08 Aug 2012 18:43:52 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0

Dear Paolo,

well, I don't know, what You exactly want, but to show the idea:

s.t. Constraint_a:
 x <= a + M * y;

This says that  (x > a) => (y = 1). (M is a big number)
the same can go for b:

s.t. Constraint_b:
 x >= b - M * y;

So (x < b) => (y=1);

Basically,  we managed to do, that (a < x < b) => (y=1);

What we haven't done yet is :

!(a < x < b) => (y=0)

And - somebody please correct me if I'm wrong - you can't not do that.

(If You could, and add the constraint y=1, and the objective:
maximize/minimize x, then there would be no solution, but the objective
would still be bounded, which can not happen for an LP / MILP.)

Best regards,

Mate

On 08/08/2012 05:53 PM, Paolo Tofoni wrote:
> Hi,
> I'm working on scheduling model which consider the day-off in the allocation.
> I need your help because I need to model a constraint as the following:
> 
> var x, y;
> param a,b;
> 
> if (x > param a) and (x < param b) then
>     y = 1;
> else
>     y = 0;
> end if;
> 
> do you think is feasible?
> Thanks in advance for your help.
> 
> _______________________________________________
> Help-glpk mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk
> 

Attachment: hegyhati.vcf
Description: Vcard

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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