Hello Gamsworld,
I’m in a bit of a pickle and need your Help. I have set up a queuing
problem to solve an Emergency response scenario. I have been able to
handle the majority of special cases using subsets, but there is one
thing that I have not been able to solve. The model was initially a
MINLP problem, but transforming the model we were able to formulate a
mathematically sound LP. The problem now is to implement it in GAMS.
The Mathematical equation which I would like to model is the
following:
Y(i,q,k) + Y(q,j,k) - 1 <= Y(i,j,k)
This equation accounts for the transitivity of predecessor
relationships, and is essential for my model to function properly.
What I need, is to adress a variable (in this case Y, normally defined
over i, j and k) but on two occasions this variable should be
controlled by another index.
Here are a few of my ideas:
*Transitivity(si,j,k,l)… Y(si,%l,k) + Y(%l,j,k) - 1 =l= Y(si,j,k) ;
(Last resort attempt, compiling error)
*Transitivity(si,li,j,lj,k)(ORD(lj) eq ORD(li)).. Y(si,lj,k) +
Y(li,j,k)(ORD(li) eq ORD(lj)) - 1 =l= Y(si,j,k) ;
(No Joy, since lj was a dynamic subset of j, ORD(lj) is infeasible,
compiling error)
*Transitivity(ssi,ssj,k,l)… Y(ssi,ssj,k)(ORD(ssj) eq ORD(l)) +
Y(ssi,ssj,k)(ORD(ssi) eq ORD(l)) - 1 =l= Y(ssi,ssj,k) ;
(Worked, but it did not do what it was supposed to do,- obviously not
the right idea to this problem )
Here’s a bit of Code for your understanding, (I can send my current
full code on request):
Set ssi incident superset i from 0 to n+1 /
i0*i6 / ;
Set ssj incident superset j from 0 to n+1 /
j0*j6 / ;
Set k rescue unit k from 1 to m /
k1*k3 / ;
Set l incident transitivity subset /
l0*l6 / ;
Set si(ssi) incident subset i from 0 to n ;
si(ssi) = YES$((ORD(ssi) ge 1) AND (ORD(ssi) le (CARD(ssi)-1)));
Set i(ssi) incident subset i from 1 to n ;
i(ssi) = YES$((ORD(ssi) ge 2) AND (ORD(ssi) le (CARD(ssi)-1)));
Set ii(ssi) incident subset i from 1 to n+1 ;
ii(ssi) = YES$((ORD(ssi) ge 2) AND (ORD(ssi) le CARD(ssi)));
Set ifirst(ssi) incident subset i controlling the first
pseudo incident i ;
ifirst(ssi) = YES$(ORD(ssi) eq 1);
Set ilast(ssi) incident subset i controlling the last pseudo
incident i ;
ilast(ssi) = YES$(ORD(ssi) eq CARD(ssi));
Set sj(ssj) incident subset j from 0 to n ;
sj(ssj) = YES$((ORD(ssj) ge 1) AND (ORD(ssj) le (CARD(ssj)-1)));
Set j(ssj) incident subset j from 1 to n ;
j(ssj) = YES$((ORD(ssj) ge 2) AND (ORD(ssj) le (CARD(ssj)-1)));
Set jj(ssj) incident subset j from 1 to n+1 ;
jj(ssj) = YES$((ORD(ssj) ge 2) AND (ORD(ssj) le CARD(ssj)));
Set jfirst(ssj) incident subset j controlling the first
pseudo incident j ;
jfirst(ssj) = YES$(ORD(ssj) eq 1);
Set jlast(ssj) incident subset j controlling the last pseudo
incident j ;
jlast(ssj) = YES$(ORD(ssj) eq CARD(ssj));
Binary Variables
X(ssi,ssj,k) Decision if incident i is processed
immediately before incident j by rescue unit k
Y(ssi,ssj,k) Decision if incident i is processed before
incident j by rescue unit k ;
Equation Preincident(ssj) (C1) Each incident has a
predecessor ;
Preincident(j)… sum((si,k), X(si,j,k)) =e= 1 ;
Equation Postincident(ssi) (C2) Each incident has a successor
incident ;
Postincident(i)… sum((jj,k), X(i,jj,k)) =e= 1 ;
Equation Transitivity(ssi,ssj,k,l) (C5) Transitivity of predecessor
incidents ;
*Transitivity(si,j,k,l)… Y(si,%l,k) + Y(%l,j,k) - 1 =l= Y(si,j,k) ;
*Transitivity(si,li,j,lj,k)(ORD(lj) eq ORD(li)).. Y(si,lj,k) +
Y(li,j,k)(ORD(li) eq ORD(lj)) - 1 =l= Y(si,j,k) ;
*Transitivity(ssi,ssj,k,l)… Y(ssi,ssj,k)(ORD(ssj) eq ORD(l)) +
Y(ssi,ssj,k)(ORD(ssi) eq ORD(l)) - 1 =l= Y(ssi,ssj,k) ;
Equation Immediate(ssi,ssj,k) (C6) An immediate predecessor is a
specific predecessor ;
Immediate(si,jj,k)… X(si,jj,k) =l= Y(si,jj,k) ;
Any help would be greatly appreciated.
\