Node-edge constraint

Problems with modeling
Post Reply
Posts: 1
Joined: 1 year ago

Node-edge constraint

Post by Damaskinos » 1 year ago


Imagine the situation of this constraint, which can be formally written as follows:

gamma(i,j) = gamma(i) for all i

I and j represent nodes as usually. Gamma(i,j) is value of binary variable representing if edge is connected (=0) or disconnected (=1). The same for gamma(i) = 1, then node is disabled, if gamma(i) = 0, nothing happens. It should be something like - if I disable node i, this means all connected edges (nodes) are also disabled. Gamma(i) is limited by ordinary budget constraint and prices. I wanted to use loop or for cycle, but it's not allowed. Of course, in my code I use gamma1(i,j) and gamma2(i) to have different names of those variables. Can you advice how to write this issue in GAMS?

User avatar
Posts: 250
Joined: 2 years ago

Re: Node-edge constraint

Post by Renger » 1 year ago

Just a thought:
If you have a binary variable gamma(i) for the nodes and a binary variable delta(i,j) for the edges (if i is not activated, this doesn't mean that node j will be deactivated as there might be edges from other nodes), then you might do something like

gamma(i) - delta(i,j) = 0;

Hope this helps

Post Reply