### Linearizing the absolute value function of a binary variable

Posted:

**Mon Sep 13, 2021 3:55 pm**Hi Guys,

I am a new user of GAMS and I would like to know how to linearize the absolute value function of a binary variable in the model

Here is my mathematical equation:

W= abs((x*y)-z)/max(z,1)

Kindly note that X is a binary variable while Y & Z are both parameters

Here is how I wrote it in GAMS:

W(i,j)=E=abs((x(i,j)*y(i,'1'))-z(i,j))/max(z(i,j),1);

Appreciate all your help on how to linearize the abs() function in the above equation

I am a new user of GAMS and I would like to know how to linearize the absolute value function of a binary variable in the model

Here is my mathematical equation:

W= abs((x*y)-z)/max(z,1)

Kindly note that X is a binary variable while Y & Z are both parameters

Here is how I wrote it in GAMS:

W(i,j)=E=abs((x(i,j)*y(i,'1'))-z(i,j))/max(z(i,j),1);

Appreciate all your help on how to linearize the abs() function in the above equation