Sub set "insted of" multiple fixed variable

Hello,

I am writing a transmission system expansion code in GAMS.

I have the following data:

set N ‘NODES’ /1,2,3,4/;
set s(N) ‘GENERATION NODES’ /1,4/;
set r(N) ‘NON-GENERATION NODES’ /2,3/;
set K(N,N) ‘POSSIBLE TRANSSMISION CABLES’ /(1.2),(1.3),(1.4),(4.2),(4.3)/;

I use a binary variable Y(N,N) to choose which lines to be buildt or not.


My problem:
Is there a way i can variables and Equations to only consider the elements in K(N,N) ?


An axample:
In my objective function the binary variable Y(N,N) is multiplied With a cost.
Some times I get a cost for transmission lines that are not beeing buildt.


I have solved it, for now, like this:

Y.fx(‘1’,‘1’)=0;
Y.fx(‘2’,‘2’)=0;
Y.fx(‘3’,‘3’)=0;
Y.fx(‘4’,‘4’)=0;
Y.fx(‘2’,‘1’)=0;
Y.fx(‘2’,‘2’)=0;
Y.fx(‘2’,‘3’)=0;
Y.fx(‘2’,‘4’)=0;
Y.fx(‘3’,‘1’)=0;
Y.fx(‘3’,‘2’)=0;
Y.fx(‘3’,‘4’)=0;
Y.fx(‘4’,‘1’)=0;



Is there a more elegant way to solve this using the GAMS notation??


Thanx for Your help


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Hi Ivan,
you could build a multidimensional set for the “transmission lines that are not beeing buildt”
indeed, your set K(N,N) is its negation, so you can use a new element departing from it… I wrote a similar example, see the displays,
note alias are needed to avoid activation of only the same elements in both sets,
CODE
set
a/1*4/
K(a,a)/(1.1),(1.2),(1.3),(1.4),(4.2),(4.3)/
No_K(a,a);
alias(a,aa);
No_K(a,aa)= no;
No_K(a,aa)= yes $(not K(a,aa));
display k, No_K;

*then you can use No_K as a condition or your equation, as in
*your_equation($No_K(a,aa))…

Cheers!
Roger


2015-04-08 14:13 GMT+02:00 Ivan Nordnes Dahlberg :

Hello,

I am writing a transmission system expansion code in GAMS.

I have the following data:

set N ‘NODES’ /1,2,3,4/;
set s(N) ‘GENERATION NODES’ /1,4/;
set r(N) ‘NON-GENERATION NODES’ /2,3/;
set K(N,N) ‘POSSIBLE TRANSSMISION CABLES’ /(1.2),(1.3),(1.4),(4.2),(4.3)/;

I use a binary variable Y(N,N) to choose which lines to be buildt or not.


My problem:
Is there a way i can variables and Equations to only consider the elements in K(N,N) ?


An axample:
In my objective function the binary variable Y(N,N) is multiplied With a cost.
Some times I get a cost for transmission lines that are not beeing buildt.


I have solved it, for now, like this:

Y.fx(‘1’,‘1’)=0;
Y.fx(‘2’,‘2’)=0;
Y.fx(‘3’,‘3’)=0;
Y.fx(‘4’,‘4’)=0;
Y.fx(‘2’,‘1’)=0;
Y.fx(‘2’,‘2’)=0;
Y.fx(‘2’,‘3’)=0;
Y.fx(‘2’,‘4’)=0;
Y.fx(‘3’,‘1’)=0;
Y.fx(‘3’,‘2’)=0;
Y.fx(‘3’,‘4’)=0;
Y.fx(‘4’,‘1’)=0;



Is there a more elegant way to solve this using the GAMS notation??


Thanx for Your help


To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.