Hi all, I put a blood vehicle routing problem into gams and made up data of demand, distance, etc. It seems that the model could only smoothly run when I input a total demand which only requires visits to two cities (one for each vehicle).When I attempted to set it to a higher level that requires visits of three or four cities in total, it does not return valid results. Could anyone tell me where the model is wrong? Moreover, as I am using the free Gams version, when I tried to expand the model to five cities, it has already exceeded the limits (too many lines), so is there any way of simplifying the model ? Because I aim to extend to 5 to 10 cities. Here are the gams codes $Title Blood Center Vechile Routing (BCVR,SEQ=188) $ontext A blood center collect blood from cities. this model aims to minimise distance travelled by vehicles. This is the expanded model with five cities and deterministic demand. $offtext ； sets i route starting cities / 0, 1, 2, 3, 4 / j route ending cities / 1, 2, 3, 4, 0 / k vehicle number / vehicle-1, vehicle-2 / ; scalar u maximum number of visits allowed per bloodmobile / 2 / TD total demand for the blood center to supply / 60/ B risk factor i.e. margin of estimated unqualified blood collected / 0.02/ ; Parameters d(i) the number of blood units that is collected at locations i (untis) / 1 9, 2 21, 3 30, 4 13 / q(k) capacity of blodmobile k (units) / vehicle-1 35, vehicle-2 35 /; table c(i,j) distance between cities
0 5 5 4 3 1 5 8 3 3 2 5 8 7 4 3 4 3 7 6 4 3 3 4 6 ; binary variable x(i,j,k) 1 when vehicle k travel from i to j vice versa; variable tdis total distance traveled by al blood moiles; equations obj total distance travelled elvo1 every location is visited once elvo2 every location is visited once elvo3 every location is visited once elvo4 every location is visited once bmc bloodmobile capacity limitation sp starting point that every vehicle must start from city 0 which is blood center rl1 route limit that a vehicle must start from the city that last route ends rl2 route limit that a vehicle must start from the city that last route ends rl3 route limit that a vehicle must start from the city that last route ends rl4 route limit that a vehicle must start from the city that last route ends ep ending point that every vehicle must return to blood center vnl visiting number limitation per vehicle tcr total collection requirement Del0(k) delete infeasible variable Del1(k) delete infeasible variable Del2(k) delete infeasible variable Del3(k) delete infeasible variable Del4(k) delete infeasible variable ; obj.. tdis =e= sum((i,j),c(i,j)*sum(k, x(i,j,k))); Del0(k)..x('0','0',k) =e= 0; Del1(k)..x('1','1',k) =e= 0; Del2(k)..x('2','2',k) =e= 0; Del3(k)..x('3','3',k) =e= 0; Del4(k)..x('4','4',k) =e= 0; elvo1.. sum((j,k), x('1',j,k)) =l= 1; elvo2.. sum((j,k), x('2',j,k)) =l= 1; elvo3.. sum((j,k), x('3',j,k)) =l= 1; elvo4.. sum((j,k), x('4',j,k)) =l= 1; bmc(k).. sum((i,j), d(i)*x(i,j,k)) =l= q(k); sp(k).. sum (j, x('0',j,k)) =e= 1; rl1(k).. sum (i, x(i,'1',k)) - sum (j, x('1',j,k)) =e= 0; rl2(k).. sum (i, x(i,'2',k)) - sum (j, x('2',j,k)) =e= 0; rl3(k).. sum (i, x(i,'3',k)) - sum (j, x('3',j,k)) =e= 0; rl4(k).. sum (i, x(i,'4',k)) - sum (j, x('4',j,k)) =e= 0; ep(k).. sum(i, x(i,'0',k)) =e= 1; vnl(k).. sum((i,j), x(i,j,k)) =l= u; tcr.. sum((i,j,k), d(i) model BCVR / all /; solve BCVR min tdis us MIP;
asked
Danielle |

$Title Blood Center Vechile Routing (BCVR,SEQ=188) $ontext A blood center collect blood from cities. this model aims to minimise distance travelled by vehicles. This is the expanded model with five cities and deterministic demand. $offtext ； sets i route starting cities / 0, 1, 2, 3, 4 / j route ending cities / 1, 2, 3, 4, 0 / k vehicle number / vehicle-1, vehicle-2 / ; scalar u maximum number of visits allowed per bloodmobile / 2 / TD total demand for the blood center to supply / 60/ B risk factor i.e. margin of estimated unqualified blood collected / 0.02/ ; Parameters d(i) the number of blood units that is collected at locations i (untis) / 1 9, 2 21, 3 30, 4 13 / q(k) capacity of blodmobile k (units) / vehicle-1 35, vehicle-2 35 /; table c(i,j) distance between cities
0 5 5 4 3 1 5 8 3 3 2 5 8 7 4 3 4 3 7 6 4 3 3 4 6 ; binary variable x(i,j,k) 1 when vehicle k travel from i to j vice versa; variable tdis total distance traveled by al blood moiles; equations obj total distance travelled
obj.. tdis =e= sum((i,j),c(i,j)*sum(k, x(i,j,k))); Del0(k)..x('0','0',k) =e= 0; Del1(k)..x('1','1',k) =e= 0; Del2(k)..x('2','2',k) =e= 0; Del3(k)..x('3','3',k) =e= 0; Del4(k)..x('4','4',k) =e= 0; elvo1.. sum((j,k), x('1',j,k)) =l= 1; elvo2.. sum((j,k), x('2',j,k)) =l= 1; elvo3.. sum((j,k), x('3',j,k)) =l= 1; elvo4.. sum((j,k), x('4',j,k)) =l= 1; bmc(k).. sum((i,j), d(i)*x(i,j,k)) =l= q(k); sp(k).. sum (j, x('0',j,k)) =e= 1; rl1(k).. sum (i, x(i,'1',k)) - sum (j, x('1',j,k)) =e= 0; rl2(k).. sum (i, x(i,'2',k)) - sum (j, x('2',j,k)) =e= 0; rl3(k).. sum (i, x(i,'3',k)) - sum (j, x('3',j,k)) =e= 0; rl4(k).. sum (i, x(i,'4',k)) - sum (j, x('4',j,k)) =e= 0; ep(k).. sum(i, x(i,'0',k)) =e= 1; vnl(k).. sum((i,j), x(i,j,k)) =l= u; tcr.. sum((i,j,k), d(i) model BCVR / all /; solve BCVR min tdis us MIP;
answered
Danielle |