Vehicle routing problem. Required minimum travel time!

Problems with modeling
Post Reply
akerdeth
User
User
Posts: 4
Joined: 6 years ago

Vehicle routing problem. Required minimum travel time!

Post by akerdeth »

Hello!

I hope you and your family are all healty!!

I would be very happy if you could help me to write the following code into the GAMS.

The following constraint is on the routing of vehicles;

β(m,i,t+to)+β(m,j,t)≤1 ∀m,∀i,∀j∈Nm,∀t+ to≤Tmax, to≤Ttravel(i,j)

The abovementioned constraint is to ensure that the transportation of vehicles among different nodes satisfies the necessary travel time.

simple example is used to explain related constraint: if it takes 2 time periods of vehicle 1 to travel between nodes 1 and 2, we enforce constraints as follows:

β(1,2,t+1)+β(1,1,t)≤1 , ∀t + 1 ≤ T
β(1,2,t+2)+β(1,1,t)≤1 , ∀t + 1 ≤ T

Thus, if β(1,1,t) (vehicle 1 is connected to node 1 at time t),then β(1,2,t+1)= β(1,2,t+2)= 0 (it cannot be connected to node 2 in
the following two time periods due to the necessary travel time from node 1 to node 2).

Mathematical expression is in below:

I wrote the code in GAMS, however, I am getting Error 126, set is under control already and Error 125, set identifier or ( expected. Can you please help me to write code as correct one? I will never forget your guidance!! Thank you in advance.

Best regards,
Ayşe.


""GAMS CODE"""
routinggg.JPG
Scalar Tmax /48/;

Sets

t(*) time periods
i(*) nodes (1-5)
j(*) nodes (1-5)
to time periods
m /m1/
;
Parameters
Travel(i,j)
;
Variables
mu
;
Binary Variables mu;

mu.fx(i,m,t)$( ord(t)<=22 and node_num (i)=1)= 1 ;
mu.fx(i,m,t) $(con_point(i)=0)= 0;

Equations
CONS_1
CONS_2
CONS_3
;



CONS_1(i,m,t) $(HAS_FEEDER(i)=1 and ord(t)<= 22)..

mu(i,m,t) =G=1;


CONS_2(m,t)..

sum(i$(con_point(i)=1), mu(i,m,t)) =L=1;

CONS_3 (i,j,g,t) $ (ord(j)<> ord(i) and ord(t)+1<Tmax )..

sum(t$ (ord(t)<= smin(ord(t)+Travel_g(i,j),Tmax)), mu(j,g,t+1)=l= (1-mu(i,g,t))*smin(Travel(i,j), Tmax- ord(t)));
routing_problem.gms
(781 Bytes) Downloaded 194 times
abhosekar
Moderator
Moderator
Posts: 295
Joined: 3 years ago

Re: Vehicle routing problem. Required minimum travel time!

Post by abhosekar »

several issues.

1. You are defining set 'to' and using it as an alias to set 't'. This is not allowed. Remove set 'to' from the definition.
2. The sets are not initialized. (*) indicates subset of a universal set. You need to define elements of all the sets before you use them for constraints.
3. You are defining an equation over t and inside the equation, you are again summing over t. As a result, there is a conflict and it is unclear to GAMS which t is being referred. This is why you get the error 'set is already under control'.
You should use the alias set 'to' in the summation.
sum(t0$()..) and so on.
Hope this helps

- Atharv
Post Reply