equation with positive variable either equal to 0 or above 4

Hi everybody,
i’m sorry to bother you. I have a question about my GAMS model. I would like to add a constraint in a farming model. Basically farmer has to allocate crops to area. I would like for a specific crop to add a constraint such as "if the farmer want to cultivate this crop he cannot grow less than 4 ha otherwise he cannot grow it.
I don’ know how to write this down…may be somebody could give me an hand ? I tried this:

Eq1… X(“crop”) * BV =e= 0 ;
Eq2… X(“crop”) =g= 4 * (1-BV);

BV is a binary variable.

But it didn’t work.

Thank you in advance for your help.

Regards.

Pc


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Pcho:



Search for ”Semi-continuous Variable”



Arne


\

Arne Stolbjerg Drud

ARKI Consulting & Development A/S

Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark

Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of pcho
Sent: Wednesday, November 27, 2013 3:07 PM
To: gamsworld@googlegroups.com
Subject: equation with positive variable either equal to 0 or above 4



Hi everybody,

i’m sorry to bother you. I have a question about my GAMS model. I would like to add a constraint in a farming model. Basically farmer has to allocate crops to area. I would like for a specific crop to add a constraint such as "if the farmer want to cultivate this crop he cannot grow less than 4 ha otherwise he cannot grow it.

I don’ know how to write this down…may be somebody could give me an hand ? I tried this:



Eq1… X(“crop”) * BV =e= 0 ;

Eq2… X(“crop”) =g= 4 * (1-BV);



BV is a binary variable.



But it didn’t work.



Thank you in advance for your help.



Regards.



Pc


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hi pcho,

I believe this will work:

Eq2… X(“crop”) =g= 4 * BV;

That is: given that he is producing, BV=1, then X (‘crop’) is greater than 4.



Yonas



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of pcho
Sent: 27. november 2013 15:07
To: gamsworld@googlegroups.com
Subject: equation with positive variable either equal to 0 or above 4



Hi everybody,

i’m sorry to bother you. I have a question about my GAMS model. I would like to add a constraint in a farming model. Basically farmer has to allocate crops to area. I would like for a specific crop to add a constraint such as "if the farmer want to cultivate this crop he cannot grow less than 4 ha otherwise he cannot grow it.

I don’ know how to write this down…may be somebody could give me an hand ? I tried this:



Eq1… X(“crop”) * BV =e= 0 ;

Eq2… X(“crop”) =g= 4 * (1-BV);



BV is a binary variable.



But it didn’t work.



Thank you in advance for your help.



Regards.



Pc


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Pc,

You can try big-M Reformulation:

Eq1… X(“crop”) =l= M*(1-BV) ;
Eq2… -X(“crop”) =l= M*(1-BV) ;
Eq3… X(“crop”) - 4 =l= M * (1-BV) ;
Eq4… 4 - X(“crop”) =l= M * (1-BV) ;

where M is sufficiently large parameter.

Regards,
Dylan

在 2013年11月27日星期三UTC+8下午10时07分06秒,pcho写道:

Hi everybody,
i’m sorry to bother you. I have a question about my GAMS model. I would like to add a constraint in a farming model. Basically farmer has to allocate crops to area. I would like for a specific crop to add a constraint such as "if the farmer want to cultivate this crop he cannot grow less than 4 ha otherwise he cannot grow it.
I don’ know how to write this down…may be somebody could give me an hand ? I tried this:

Eq1… X(“crop”) * BV =e= 0 ;
Eq2… X(“crop”) =g= 4 * (1-BV);

BV is a binary variable.

But it didn’t work.

Thank you in advance for your help.

Regards.

Pc


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Pc,

Sorry for my mistake, the formulation should be:

Eq1 … X(“crop”) =l= MBV ;
Eq2… -X(“crop”) =l= M
BV ;
Eq3… 4 - X(“crop”) =l= M*(1-BV) ;

If BV=1 that the farmer plants the crop, X(“crop”)>=4, otherwise X(“crop”)=0. This reformulation helps to linearize the model that is easier to be solved.

Regards,
Dylan

在 2013年11月27日星期三UTC+8下午10时07分06秒,pcho写道:

Hi everybody,
i’m sorry to bother you. I have a question about my GAMS model. I would like to add a constraint in a farming model. Basically farmer has to allocate crops to area. I would like for a specific crop to add a constraint such as "if the farmer want to cultivate this crop he cannot grow less than 4 ha otherwise he cannot grow it.
I don’ know how to write this down…may be somebody could give me an hand ? I tried this:

Eq1… X(“crop”) * BV =e= 0 ;
Eq2… X(“crop”) =g= 4 * (1-BV);

BV is a binary variable.

But it didn’t work.

Thank you in advance for your help.

Regards.

Pc


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.

Use this

X(“crop”) =L=4+BV *1000;
X(“crop”) =G=4+(BV-1) *1000;

So if there is no selection BV =0, then
first equation will be X(“crop”) =L=4
while secound will be X(“crop”) =G=4-10000,

And if BV =1 then
X(“crop”) =L=1004
X(“crop”) =G=4


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.