Constraint for: If x>0 then y=1

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

JapanGo,

Modification to Bob’s formulation.

y >= EPSILON*x
y = EPSILON and y = 0 and y wrote:

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hello Destin,
hello Babak,

thanks to both of you. The adaption of Destin made it work.
As a feedback to the community: One can also model the constraint with big M:
yM >= x
y = EPSILON*x
y = EPSILON and y = 0 and y wrote:

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/XcpZxPOgIi8J.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Dear all,

JapanGo, I can see it work, but I strongly disagree with your satisfaction of the proposed answers.
The question was: how to condense it to one equation. Answer: cheat and use:
y= x
y = EPSILON*x
y = EPSILON and y = 0 and y wrote:

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/7mz_6exIiasJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Regardless of what I wrote before, I obviously meant y>=min(x,1), as that does fulfill the requirements stated.

On Tuesday, October 30, 2012 10:59:33 AM UTC+1, JapanGo wrote:

Hello Destin,
hello Babak,

thanks to both of you. The adaption of Destin made it work.
As a feedback to the community: One can also model the constraint with big M:
yM >= x
y = EPSILON*x
y = EPSILON and y = 0 and y wrote:

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/5QkqUvVb-ZkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

But that is non-linear!

On Thu, Nov 15, 2012 at 1:42 PM, HJW Vermue wrote:

Regardless of what I wrote before, I obviously meant y>=min(x,1), as that does fulfill the requirements stated.


On Tuesday, October 30, 2012 10:59:33 AM UTC+1, JapanGo wrote:

Hello Destin,
hello Babak,

thanks to both of you. The adaption of Destin made it work.
As a feedback to the community: One can also model the constraint with big M:
yM >= x
y = EPSILON*x
y = EPSILON and y = 0 and y wrote:

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/5QkqUvVb-ZkJ.

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

\

To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

发自我的 iPad

在 2012-11-15,20:42,HJW Vermue 写道:

Regardless of what I wrote before, I obviously meant y>=min(x,1), as that does fulfill the requirements stated.

On Tuesday, October 30, 2012 10:59:33 AM UTC+1, JapanGo wrote:

Hello Destin,
hello Babak,

thanks to both of you. The adaption of Destin made it work.
As a feedback to the community: One can also model the constraint with big M:
yM >= x
y

Am Dienstag, 30. Oktober 2012 10:22:47 UTC+1 schrieb Destin Zed:

    JapanGo,

    Modification to Bob's formulation.

    y >= EPSILON*x
    y
    If x equals 10, then y >= EPSILON and y = 0 and y
    I hope this works for you.

    Destin

    On Mon, Oct 29, 2012 at 7:14 PM, Bob Pay  wrote:

        Hi
        try this, maybe it helps:

        x              x> y

        if x is positive, second is not considered, and from first, for example x =10, 10
        if x = 0, then first constrain is not considered, but second constrain, 0 > y, as y is binary, it takes value 0.

        I am not sure about it.

        you can check H.P Williams book, Model Building for more details.



        On Mon, Oct 29, 2012 at 8:46 PM, JapanGo  wrote:

            Hello GAMS community,

            I am trying to find a constraint solution for the case:

            if x>0 then y=1
            where x is a positive integer variable and y is a binary variable.
            Thus in cases where x=0 also y=0

            I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

            Would be great to get your opinions on it. Thanks!

            --
            To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
            To post to this group, send email to gams...@googlegroups.com.
            To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
            For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.




        --
        Babak Saleck Pay
        M.Sc
        Socio-Economic System Engineering
        Group of Industrial Engineering
        University of Tehran
        Tehran,Iran
        [www.babaksp.com](http://www.babaksp.com)

        --
        To post to this group, send email to gams...@googlegroups.com.
        To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
        For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/5QkqUvVb-ZkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi,

I would like to perform in GAMS the following logical condition: Z(t)=0 if X(t)=0 and Z(t)=1 if X(t)>0 (where X(t) is any positive number). The problem is that I need to define Z(t) as the positive variable rather that the binary one due to limitations of the student version. Do you have idea how to perform it?

Thanks,

בתאריך יום ×©× ×™, 29 באוקטובר 2012 20:15:29 UTC+2, מאת B.Saleckpay:

Hi
try this, maybe it helps:

x y

if x is positive, second is not considered, and from first, for example x =10, 10 y, as y is binary, it takes value 0.

I am not sure about it.

you can check H.P Williams book, Model Building for more details.



On Mon, Oct 29, 2012 at 8:46 PM, JapanGo wrote:

Hello GAMS community,

I am trying to find a constraint solution for the case:

if x>0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/TmhGHHfdrsYJ.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.



\

Babak Saleck Pay
M.Sc
Socio-Economic System Engineering
Group of Industrial Engineering
University of Tehran
Tehran,Iran
www.babaksp.com


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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\

hello dears
maybe this constrains help you
y>=epsilon*x
y0 then y=1
where x is a positive integer variable and y is a binary variable.
Thus in cases where x=0 also y=0

I tried several combination (including big M, -y, (1-y) formulations etc.) but do not get to the wanted result. Maybe it is not possible with a single constraint, but needs two?

Would be great to get your opinions on it. Thanks!


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/d/optout.