SETS:
nodi/1..24/;
 
archi(nodi,nodi)/
1, 2, 1, 4, 1, 5,
 2, 3, 2, 5, 2, 6,
 3, 6, 3, 9, 3, 15,
 4, 5, 4, 8,
 5, 6, 5, 7, 5, 8, 5, 10,
 6, 7, 6, 9, 
7, 9, 7, 10,
 8, 10, 8, 11, 8, 13, 8,  20,
 9, 10, 9, 12, 
10, 11, 10, 12, 10, 14,
 11, 13, 11, 14, 
12, 14, 12, 15,   12, 19,
 13, 14, 13, 16, 13, 17, 13, 20,
 14, 16, 14, 18, 14, 19, 
15, 19,
 16, 17, 16, 18, 16, 23,
 17, 20, 17, 21, 17, 23, 
18, 19, 18, 22, 18, 23,    18, 24,
 19, 22, 
20, 21, 
21, 23, 
22, 24, 
23, 24
/:c,prob,x1,x2,d;
 
 
 
ENDSETS
 
DATA:
c= 73, 5, 53, 48, 92, 45, 97, 22, 97, 10, 44, 43, 5, 49, 86, 73, 94, 71, 
    85, 78, 71, 23, 29, 72, 74, 53, 77, 69, 6, 22, 98, 90, 82, 86, 19, 66,
  64, 26, 36, 97, 75, 5, 51, 51, 77, 76, 37, 47, 100, 68, 1, 98, 2, 64, 44, 
    56;
 
d= 49, 80, 53, 50, 56, 67, 55, 142, 293, 106, 103, 71, 50, 116, 116, 54, 
 88, 70, 88, 92, 105, 164, 239, 95, 117, 54, 138, 119, 72, 85, 91, 35, 80, 
   63, 63, 46, 82, 32, 52, 95, 49, 45, 29, 54, 48, 39, 61, 68, 50, 40, 38, 
   33, 36, 44, 30, 36;
 
prob= 
0.0072, 0.0189, 0.0111, 0.0124, 0.0112, 0.019, 0.0067, 0.0195, 0.0192, 
    0.0174, 0.0187, 0.0033, 0.0184, 0.0057, 0.0152, 0.0118, 0.0006, 0.0087, 
  0.0032, 0.0101, 0.0029, 0.0086, 0.0171, 0.0104, 0.0156, 0.0097, 0.006,
   0.018, 0.0045, 0.0108, 0.0193, 0.0185, 0.0053, 0.0133, 0.0006, 0.0152,
   0.0069, 0.0076, 0.0054, 0.0034, 0.0063, 0.0189, 0.0021, 0.0133, 0.0035,
   0.0103, 0.005, 0.0029, 0.0079, 0.0005, 0.019, 0.0049, 0.0034, 0.0098, 
    0.0197, 0.0064
;
 
source=1;sink=24;
 
ENDDATA
 
 
 min= cc;
 
!max=finprob;
 
 
 
cc=@SUM(archi:prob*c*x1)+@SUM(archi:prob*c*x2);
 
dist=@SUM(archi:d*x1)+@SUM(archi:d*x2);
 
 dist< 500;
 
 
@FOR(nodi(i)|(i#NE#source)#AND#(i#NE#sink):[v]
     @SUM(archi(i,j):x1(i,j)) - @SUM(archi(i,j):(1-  prob(i,j))*x2(i,j)) -
     @SUM(archi(j,i):(1-  prob(j,i))*x1(j,i)) + @SUM(archi(j,i):x2(j,i)) = 0 );
 
@FOR(nodi(i)|(i#EQ#source) :[v]
     @SUM(archi(i,j):x1(i,j)) - @SUM(archi(i,j):(1-  prob(i,j))*x2(i,j)) -
     @SUM(archi(j,i):(1-  prob(j,i))*x1(j,i)) + @SUM(archi(j,i):x2(j,i)) = 1 );
 
 @FOR(nodi(j)|(j#EQ#sink) :
     @SUM(archi(i,j):(1-  prob(i,j))*x1(i,j)) - @SUM(archi(i,j):x2(i,j)) -
     @SUM(archi(j,i):x1(j,i)) + @SUM(archi(j,i):(1-  prob(j,i))*x2(j,i)) = finprob );