I am solving a problem by linearizing bilinear terms using McCormick envelopes.

Code: Select all

```
*NOTE: Equations are not written exactly as per standard GAMS syntex, so please ignore that and get the idea.
*I want to linearize the following biliear term (EQ 1) using McCormick Envelopes:
VARIABLES q, stream(n,i,f), z;
*Bilinear Term
= q * sum(f, stream(n,i, f)) ----EQ 1
*using McCormick, it will be equal to z.
z =E= q*sum(f, stream(n,i, f)); ----EQ 2
*Here I face a problem, EQ 2 cannot be modeled this way in GAMS, the variable z should also hold sets n, i, f as its domain, like this in EQ 3:
z(n,i,f) =E= q*sum(f, stream(n,i, f)); ---EQ 3
*EQ 3 cannot be formulated this way as in EQ 3, because GAMS will generate an Error message 'uncontrolled set entered as constant'.
*EQ 3 cannot be formulated in following way also, because GAMS will generate many equations instead of a single line summation equation.
Relax1(n,i,f).. z(n,i,f) =E= q*sum(f, stream(n,i, f)); ----EQ 4
```

THANKS