Hello everyone!

I am struggling to find the correct way to implement a constaint in Gams. First and foremost i would like to state that my problems refers to mathematical programming of Liquefied natural gas cargos with split deliveries.

Indice l is for cargos, indice t is for terminals t and indice k is for slots. There is a constraint in the problem which states that the number of terminals a cargo can visit during a trip is restricted to two (2), as it is only possible in the case of split delivery. X(l,t,k) is a binary variable which is 1 if cargo l arrives at terminal t at the start of slot k and 0 otherwise. The paper that i am reading states that this constraint is written mathematically as constraint (10) in the image i attached.

Q(c t), is the time to travel to terminal t from the supplier and Q(c tb) is the time required to travel back to the supplier from the terminal. The problem is that i am writting this constraint in GAMS (its in the other picture i attached).

Analytically this is like this :

LTC1a(Disha,1)… x(Disha,Ter1,1) + x(Disha,Ter2,1) + x(Disha,Ter3,1) =L= 1 ; (LHS = 0)

LTC1a(Disha,2)… x(Disha,Ter1,1) + x(Disha,Ter1,2) + x(Disha,Ter2,1) + x(Disha,Ter2,2) + x(Disha,Ter3,1) + x(Disha,Ter3,2) =L= 1 ; (LHS = 0)

LTC1a(Disha,3)… x(Disha,Ter1,1) + x(Disha,Ter1,2) + x(Disha,Ter1,3) + x(Disha,Ter2,1) + x(Disha,Ter2,2) + x(Disha,Ter2,3) + x(Disha,Ter3,1) + x(Disha,Ter3,2) + x(Disha,Ter3,3) =L= 1 ;

LTC1(Disha,4)… x(Disha,Ter1,1) + x(Disha,Ter1,2) + x(Disha,Ter1,3) + x(Disha,Ter1,4) + x(Disha,Ter2,1) + x(Disha,Ter2,2) + x(Disha,Ter2,3) + x(Disha,Ter2,4) + x(Disha,Ter3,1) + x(Disha,Ter3,2) + x(Disha,Ter3,3) + x(Disha,Ter3,4) =L= 2 ; (LHS = 0)

LTC1(Disha,5)… x(Disha,Ter1,1) + x(Disha,Ter1,2) + x(Disha,Ter1,3) + x(Disha,Ter1,4) + x(Disha,Ter1,5) + x(Disha,Ter2,1) + x(Disha,Ter2,2) + x(Disha,Ter2,3) + x(Disha,Ter2,4) + x(Disha,Ter2,5) + x(Disha,Ter3,1) + x(Disha,Ter3,2) + x(Disha,Ter3,3) + x(Disha,Ter3,4) + x(Disha,Ter3,5) =L= 2 ; (LHS = 0)

… etc

But when i am solving the problem i see that variable x(l,t,k) is 1 in wrong slots for example X(Aseem,ter3, slot 14)=1 and X (Aseem , ter2, slot 17)=1, this cannot happen because cargo Aseem needs time to return back from terminal 3 which is 2 slots and also it needs time to travel to terminal 2 which is 3 slots so if it arrives at terminal 3 at slot 14 its impossible to be selected at slot 17 again. How can i fix this? I am attaching also the code i wrote for this problem, but the main thing is this constraint.

split deliveryyy.gms (20.8 KB)