## Linearization of Non-Linear equations Topic is solved

Problems with syntax of GAMS
arvindmarandi
User Posts: 7
Joined: 4 months ago

### Linearization of Non-Linear equations

Hello GAMS Community, Warm Greetings!

Here is my problem, suppose I have a following objective function:

Code: Select all

``objF.. obj =e= 10*x1 + 12*x2 - 20*z1 - 25*z2 - 10*z1*z2``
Symbols (x1,x2) are variables.
Symbols (z1,z2) are binary variables.

I wishes to linearize this objective function as product term z1*z2 term making the equation non-linear.

From a course I have learned that, you can linearize the same equation by considering an another variable w. Such that, w = z1 * z2

Then add an another constraint, w ≥ z1 + z2 - 1, where w ∈ {0,1}.

I had made numerous attempt to do the same, but have failed. As soon has, I write this equation w = z1 * z2 in GAMS. It gives me an error 'A suffix is missing'.

abhosekar
Moderator Posts: 273
Joined: 2 years ago

### Re: Linearization of Non-Linear equations

Hi,

Couple of logical flaws here. You want to linearize z1*z2 but if you still have a constraint w= z1*z2, your entire formulation will still be nonlinear.
Second, even if you have w = z1*z2 constraint, you would want it to be a part of the model so it will be w =e= z1*z2.
w = z1*z2 is simply an assignment and z1 has no meaning (GAMS expects z1.l, z1.lo,... etc. i.e., suffix) this explains the error you get.

Now to the solution.
Simply remove w = z1*z2 from your model.

The constraint you mentioned w >= z1 + z2 - 1 replaces w = z1*z2.
You can look at it case by case.
if both are 1, then w >= 1 but since w is binary, it will be 1.
if one of them is 0, w >= 0 depending on minimize or maximize and the sign of w in the objective function this should force w = 0.
Similarly, if both are 0 then w >= -1 should make w = 0.

Hope this helps.

- Atharv

arvindmarandi
User Posts: 7
Joined: 4 months ago

### Re: Linearization of Non-Linear equations

Thanks for your help. It had solved my problem and improve my understanding of the syntax.

Manassaldi
User Posts: 113
Joined: 5 years ago
Location: Rosario - Argentina

### Re: Linearization of Non-Linear equations

Hello, you can also try this alternative:

Code: Select all

``````objF.. obj =e= 10*x1 + 12*x2 - 20*z1 - 25*z2 - 10*w
eq1.. 1 - z1 + 1 - z2 + w =g= 1
eq2.. z1 + 1 - w =g= 1
eq3.. z2 + 1 - w =g= 1
``````
Best