model:title VRP;
sets:
ii/1..10/: demand;
kk/1..3/;
link1(ii,kk): y, u;
link2(ii,ii): dist;
link3(ii,ii,kk): x;
endsets
min=@sum(link3(i,j,k): x(i,j,k)*dist(i,j));
@for(link1(i,k): [ct1]y(i,k) = @sum(ii(j): x(i,j,k)));
@for(link1(i,k): [ct2]y(i,k) = @sum(ii(j): x(j,i,k)));
@for(ii(i)|i#eq#1: [ct3]@sum(kk(k): y(i,k)) = @size(kk) );
@for(ii(i)|i#ne#1: [ct4]@sum(kk(k): y(i,k)) = 1 );
@for(kk(k): [ct5]@sum(ii(i): y(i,k) * demand(i) ) <= cap );
@for(link3(i,j,k)|i#eq#j: [ct6]x(i,j,k) = 0 );
@for(link3: [ct7]@bin(x));
@for(link1: [ct8]@bin(y));
@for(link1(j,k)|j#ne#1: [ct9]u(j,k)>=@sum(ii(i):u(i,k)*x(i,j,k))+demand(j) );
data:
cap = 15;
demand = 0 5 5 7 6 2 3 5 4 8 ;
dist =
0 21.6 21.0 19.1 23.0 21.9 8.3 20.5 12.0 10