SETS:
nodi/1..12/;
 
archi(nodi,nodi)/
1 2
1 6
1 9
2 3
2 6
3 4
3 6
3 7
4 5
4 7
5 8
5 12
6 7
7 8
7 9
7 10
8 10
8 11
8 12
9 10
10 11
11 12
/:x1,x2,c;
 
 
 
ENDSETS
 
DATA:
c= 6 6 2 7 3 8 8 5 2 4 3 1 5 8 2 5 7 3 2 7 3 2;
 
source=1;sink=12;
 
ENDDATA
 
min= cc;
 
 
cc=@SUM(archi:c*x1)+@SUM(archi:c*x2);
 
@FOR(nodi(i)|(i#NE#source)#AND#(i#NE#sink):[v]
     @SUM(archi(i,j):x1(i,j)) - @SUM(archi(i,j):x2(i,j)) -
     @SUM(archi(j,i):x1(j,i)) + @SUM(archi(j,i):x2(j,i)) = 0 );
 
@FOR(nodi(i)|(i#EQ#source) :
     @SUM(archi(i,j):x1(i,j)) - @SUM(archi(i,j):x2(i,j)) -
     @SUM(archi(j,i):x1(j,i)) + @SUM(archi(j,i):x2(j,i)) = 1 );
 
@FOR(nodi(j)|(j#EQ#sink) :
     @SUM(archi(i,j):x1(i,j)) - @SUM(archi(i,j):x2(i,j)) -
     @SUM(archi(j,i):x1(j,i)) + @SUM(archi(j,i):x2(j,i)) = 1 );