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””"
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)