title: Minimum Network Flow in GAMS
body: <p>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.</p>
  
  <p>Program:</p>
  
  <pre><code>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);
  </code></pre>