1

I am trying to solve below network problem in GAMS Cplex. I am unable to get the desired output as the GAMS is giving the arcs which doesnt exist as output. Could you please help me in correcting this.

Program:

Set

i  supply nodes /1,2,3,4/;

Alias(i,j);

Set

arc(i,j) arcs from node i to j 
/1 .2

 2 .3

 3 .4

 1 .4

 2 .4/;


Parameter b(i) number of units available or required at node i
/ 1  5

  2  2

  3 -4

  4 -3/ ;

Table c(i,j) cost of shipping from node i to node j
         1       2       3      4

1        0       3       0      1

2        0       0       6      5

3        0       0       0      0

4        0       0       2      0 ;

Positive variables
x(i,j) number of units shipped along arc from i to j;

Variable z;

Equations obj, cons(i);

obj.. z =E= sum(arc(i,j),c(arc)*x(arc));

cons(i).. sum(j,x(i,j)) - sum(j,x(j,i)) =E= b(i);
Lutz
  • 2,197
  • 1
  • 10
  • 12
mvk
  • 13
  • 3

1 Answers1

1

I think you need to use the set "arc" in your constraints "cons" like this:

cons(i).. sum(arc(i,j),x(i,j)) - sum(arc(j,i),x(j,i)) =E= b(i);

Hope that helps, Lutz

Lutz
  • 2,197
  • 1
  • 10
  • 12