Hello,

I have a table:

Table branch(l,n,np,*) branch characteristics

X rating exist branchNum

L1.n1.n2 0.0281 2.5 1 1

L2.n2.n3 0.0108 3.5 1 2

L3.n3.n4 0.0297 2.4 1 3

L4.n4.n5 0.0297 2.4 1 4

L5.n5.n1 0.0064 4 1 5

L6.n1.n4 0.0304 1.5 1 6;

I have a binary variable x(l,t)

I would like to make a summation **for all lines not connected to N4**. So in layman terms, it would be L1, L2, and L5

A naive approach of doing it:

Parameter branchNum(l);

branchNum(l) = 0;

branchNum(l) = sum((n,np),branch(l,n,np,‘LineNumber’));

SUM(l,x(l,t)(branchNum(l) ne 1) (branchNum(l) ne 2) $ (branchNum(l) ne 5) );

The works for a small case and to some extent, not programmatic.

How do I write a gams code for summing only lines that are not connected to Node 4 in the table?

May be: sum(l,x(l,t)$(sum((n,np)$sameas(n,‘n4’) ??? This is wrong. I need help

Much appreciated