Page **1** of **1**

### condition on two dependent variables

Posted: **Fri May 03, 2019 6:08 pm**

by **nasim**

I have an NLP model in which I am trying to optimize a lot of interdependent variables. I need to put a condition in the model to force on a variable to be positive whenever another variable is positive. I am wondering someone could help me with the syntax.

Thanks

### Re: condition on two dependent variables

Posted: **Sat May 04, 2019 4:36 pm**

by **dirkse**

Nasim,

You mention strict inequalities in your post, but that doesn't really make sense in the context of NLP. Several posts in this forum and elsewhere deal more with this, including this one:

http://yetanothermathprogrammingconsult ... ation.html
Using inequalities, you ask, "How can I implement x >=0 implies y >=0 in NLP?"

Consider the x,y graph with 4 quadrants: all of them are OK except the south-east one: x > 0, y < 0. This is a non-convex feasible region, one that won't lend itself to definition using only nonlinear constraints. You could use a binary variable xPos to indicate that x is positive, and if you have a value M s.t. y >= M for all feasible y, you could do

equation yLo; yLo .. y =G= M * (1-xPos);

The smaller you can make M in absolute value, the better.

You could also do this with indicator constraints in some GAMS solvers, but this is solver specific. Big-M constraints have issues if the M gets large but they are accepted by all GAMS MIP/MINLP solvers.

-Steve