Conditions on the decision variable

Hi all,

My objective function depends on the quantity of an equation N(i) = I(i) - b(i) + D(i);

Would it be possible to set N(i) as 0 if it is negative and take the intrinsic value if it is positive? I am currently using NLP solver.

Thanks a lot!

you want N(i) to be max(0, I(i) - b(i) + D(i));
You can do this by
N(i) =g= 0;
N(i) =g= I(i) - b(i) + D(i);

However, this depends on the fact that your objective naturally tries to minimize N(i). If that’s not the case, you will have to use big-M constraints.

  • Atharv