Linearisation of Bilinear Terms Using McCormick Envelopes

Problems with modeling
Post Reply
zar
User
User
Posts: 13
Joined: 4 months ago

Linearisation of Bilinear Terms Using McCormick Envelopes

Post by zar » 2 weeks ago

Hi Everyone,

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
HOW SHOULD I FORMULATE EQ 4 ? APPRECIATE YOUR TIME AND HELP.
THANKS

User avatar
Renger
Posts: 585
Joined: 3 years ago

Re: Linearisation of Bilinear Terms Using McCormick Envelopes

Post by Renger » 2 weeks ago

Hi
If you sum over f in your equations, the equation can't have the index f in it.

Code: Select all

z(n,i,f) =E=  q*sum(f, stream(n,i, f)); 
Relax1(n,i,f).. z(n,i,f) =E=  q*sum(f, stream(n,i, f))
should then be

Code: Select all

variable 
   z(n,i)

equations
    eq3(n,i), relax1(n,i);
    
eq3..    
   z(n,i) =E=  q*sum(f, stream(n,i, f)); 

Relax1(n,i).. 
    z(n,i) =E=  q*sum(f, stream(n,i, f));
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

Post Reply