Using a variable in a equations condition

Problems with syntax of GAMS
Post Reply
saeid.jafarpour
User
User
Posts: 8
Joined: 3 months ago

Using a variable in a equations condition

Post by saeid.jafarpour » 3 months ago

hi i need to use variable Pm(m,MEG,t) in a equation condition term as illustrated bellow, however, it is not possible to use a variable in a equations condition. i wonder if there is any solution or trick for this problem.

parameter

numb(m)
G(m,n)
PDGmax(m)
;

binary variable

zz(m,t)
;

variable

Pm(m,MEG,t)
;

e18(m,t)$(PDGmax(m) ne 0 or Pm(m,MEG,t) ne 0 ).. zz(m,t)=e=1;

e19(m,t)$(PDGmax(m) eq 0 and Pm(m,MEG,t) eq 0 ).. sum(n$(ord(m) ne ord(n) and G(m,n) ne 0),delta(m,n,t))/numb(m)=l=zz(m,t);

e20(m,t)$(PDGmax(m) eq 0 and Pm(m,MEG,t) eq 0) .. sum(n$(ord(m) ne ord(n) and G(m,n) ne 0),delta(m,n,t))=g=zz(m,t);

GabrielYin
User
User
Posts: 60
Joined: 4 years ago
Location: Dallas, TX, USA
Contact:

Re: Using a variable in a equations condition

Post by GabrielYin » 2 months ago

Hi,

You can use the indicator constraint to achieve what you want for the variable condition in equations.

And I just posted a question post here. If someone answers my post, I think you will be able to implement the indicator constraint through my small example!

Cheers,
Gabriel

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

Re: Using a variable in a equations condition

Post by Manassaldi » 2 months ago

Hello, I suggest you make a manually "big M" or convex hull reformulation or try with the indicator constraint. Best!

saeid.jafarpour
User
User
Posts: 8
Joined: 3 months ago

Re: Using a variable in a equations condition

Post by saeid.jafarpour » 2 months ago

GabrielYin wrote:
2 months ago
Hi,

You can use the indicator constraint to achieve what you want for the variable condition in equations.

And I just posted a question post here. If someone answers my post, I think you will be able to implement the indicator constraint through my small example!

Cheers,
Gabriel
Hi
Thanks for your help.
Saeid

saeid.jafarpour
User
User
Posts: 8
Joined: 3 months ago

Re: Using a variable in a equations condition

Post by saeid.jafarpour » 2 months ago

Manassaldi wrote:
2 months ago
Hello, I suggest you make a manually "big M" or convex hull reformulation or try with the indicator constraint. Best!
Hi
I have aleready tested big M but it didnt work.
Thanks for your help.
Saeid

Post Reply