this is my test model(periodic lrp with time window) - source: A hybrid evolutionary algorithm for the periodic location-routing problem by Caroline Prodhon
sets
loc all locations /i1i3,j1j7/
i(loc) depot /i1i3/
j(loc) customers /j1j7/
k vehicles /13/
l period /13/
r combinations of days /1*7/;
*azaye majmue halate r /1 2 3 1.2 1.3 2.3 1.2.3/
alias(loc,loc2);
alias(j,p,h);
scalar vc vehicle cost
/50/ ;
parameters
Q(k) capacity of vehicles
/
1 40
2 40
3 40
/
w(i) capacity of depot i
/
i1 50
i2 50
i3 50
/
o(i) cost of establishing depot i
/
i1 50
i2 50
i3 50
/
st(loc) service time of customer
/
j1 2
j2 7
j3 21
j4 24
j5 18
j6 17
j7 6
i1 0
i2 0
i3 0
/
etw(loc) earliest time in time window
/
j1 354
j2 234
j3 411
j4 474
j5 155
j6 361
j7 451
i1 0
i2 0
i3 0
/
ltw(loc) latest time in time window
/
j1 509
j2 401
j3 573
j4 622
j5 295
j6 509
j7 629
i1 800
i2 800
i3 800
/
table d(r,l,j) demand of customer j on day l of combination r
j1 j2 j3 j4 j5 j6 j7
1.1 13 16 0 0 0 0 0
2.2 10 16 0 0 0 0 0
3.3 13 8 0 0 0 0 0
4.1 0 0 11 11 17 0 0
4.2 0 0 10 18 20 0 0
4.3 0 0 15 11 17 0 0
5.1 0 0 15 14 16 0 0
5.3 0 0 20 11 17 0 0
6.2 0 0 15 15 17 0 0
6.3 0 0 12 11 8 0 0
7.1 0 0 0 0 0 9 11
7.2 0 0 0 0 0 15 20
7.3 0 0 0 0 0 10 17
*table n(r,l,j) matrix of possibility of service to customer j in period l from combination r
*1.1 1 1 0 0 0 0 0
*2.2 1 1 0 0 0 0 0
*3.3 1 1 0 0 0 0 0
*4.1 0 0 1 1 1 0 0
*4.2 0 0 1 1 1 0 0
*4.3 0 0 1 1 1 0 0
*5.1 0 0 1 1 1 0 0
*5.3 0 0 1 1 1 0 0
*6.2 0 0 1 1 1 0 0
*6.3 0 0 1 1 1 0 0
*7.1 0 0 0 0 0 1 1
*7.2 0 0 0 0 0 1 1
*7.3 0 0 0 0 0 1 1
table a(r,l) matrix of assignment of l to r
1 2 3
1 1 0 0
2 0 1 0
3 0 0 1
4 1 1 0
5 1 0 1
6 0 1 1
7 1 1 1
;
table c(loc,loc2) travel cost matrix
$call =xls2gms r=a1:k11 i=20nodes-PLRPTW.xls o=pard.inc
$include pard.inc
;
display c;
table t(loc,loc2) travel cost matrix
$call =xls2gms r=a15:k25 i=20nodes-PLRPTW.xls o=pard.inc
$include pard.inc
;
display t;
Binary variables
x(loc,loc2,k,l) if edge i-j is traversed from i to j in theroute performed by vehicle k on day l
b(j,r) if visit combination r is assigned tocustomer j
*n(r,l,j) if customer is visited in period l in combination r
y(i) if depot i is opened
f(i,j) if customer j is assigned to depot i;
positive variable
nv(i) number of vehicle
at(loc,k,l) arival time to node
u(loc,k,l)
;
variables
z;
Equations
Cost
cons22(j,l)
cons23(j,l)
cons33(k,l)
cons55(k,l)
VehicleNumber(l,i) satisfy total number of vehicles used at depot i
LeaveReturn(k,i,l) observe arc leaves and returns
SubtourElimination(h,j,k,l) elimination of subtour
MaxLoadofVehicle(k,l,r) satisfy max load of vehicle
DepotCapacity(i,l,r) satisfy depot capacity
StartingDepot(k,l) observe vehicle is starting from depot i
CustomerAssignment(i,j,k,l) assign customer to depot if route is open
CombinationAssignment(j) assign one visit combination to each customer
CombinationAssignment2(j) assign one visit combination to each customer
CombinationAssignment3(j) assign one visit combination to each customer
CustomerVisit(j,l) satisfy customer visit only once on each day of assigned combination
timesequence(loc,loc2,k,l) sequency of time
timewindow1(loc,k,l) time window
timewindow2(loc,k,l) time window
beginingtime(k,l)
;
cost…z=e=sum(i,o(i)*y(i))+sum((loc,loc2,k,l)$(ord(loc)ord(loc2)),c(loc,loc2)x(loc,loc2,k,l))+sum(i,vcnv(i));
cons22(j,l)…sum((k,loc)(ord(j)ord(loc)),x(j,loc,k,l))=l=1;
cons23(j,l)..sum((k,loc)(ord(loc)ord(j)),x(loc,j,k,l))=l=1;
LeaveReturn(k,i,l)…sum(loc2,x(i,loc2,k,l))=e=sum(h, x(h,i,k,l));
cons33(k,l)…sum((j,i),x(i,j,k,l))=l=1;
cons55(k,l)…sum((j,i),x(j,i,k,l))=l=1;
VehicleNumber(l,i)…sum((k,loc2),x(i,loc2,k,l))=l=nv(i);
SubtourElimination(h,j,k,l)$(ord(j)ord(h))…u(h,k,l)-u(j,k,l)+(card(j)*x(h,j,k,l))=l=card(j)-1;
MaxLoadofVehicle(k,l,r)…sum((loc,j),d(r,l,j)*x(loc,j,k,l))=l= Q(k);
DepotCapacity(i,l,r)…sum(j,d(r,l,j)*f(i,j))=l=w(i)*y(i);
StartingDepot(k,l)…sum(loc,sum(loc2,(x(loc,loc2,k,l))))=l=1;
CustomerAssignment(i,j,k,l)…sum(p,x(i,p,k,l))+sum(p$(ord(p)ord(j)),x(p,j,k,l))=l=1+f(i,j);
CombinationAssignment(j)$(ord(j)2)and(ord(j)5)…b(j,‘7’)=e=1;
CustomerVisit(j,l)…sum((loc,k),x(loc,j,k,l))=e=sum(r,b(j,r)*a(r,l));
timesequence(loc,loc2,k,l)$(ord(loc)ord(loc2))…at(loc,k,l)+st(loc)+t(loc,loc2)-at(loc2,k,l)=l=(1-x(loc,loc2,k,l))*1000000000;
timewindow1(loc,k,l)…etw(loc)=l=at(loc,k,l);
timewindow2(loc,k,l)…ltw(loc)=g=at(loc,k,l);
beginingtime(k,l)…sum(i,at(i,k,l))=e=0;
model PLRPTW /all/;
solve PLRPTW using mip minimizing z;
display x.l,y.l,f.l,b.l,nv.l,at.l,u.l,z.l ;
On Tuesday, 11 March 2014 07:30:44 UTC+4:30, n azadi wrote:
hi
i have a problem with my written vrptw model in gams, it seems my model has written correct in general but some of its constraints shows infeasible, can anybody help me kindly?
my id is : nasima_354@yahoo.com
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.