Error 125

29 views
Skip to first unread message

Karina Lang

unread,
Apr 11, 2016, 4:47:44 PM4/11/16
to gamsworld
Hi guys,
Im new user in GAMS. I cannot figure out why the program is giving me the error 125 saying that i have a set under already.

OPTION LIMROW=100;
OPTION LIMCOL =100;
OPTIONS OPTCR=0.01;

SETS
i puntos de oferta /O1 * O29/
k centros de consolidacion /K1 * K3/
m centros de distribucion /M1 * M3/
j puntos de demanda /D1 * D3/
t modos de transporte /T1 * T7/
aset columna costo fijo de las facilidades k /Cfijok/
bset columna costo fijo de las facilidades m /Cfijom/
cset columna capacidad de cada facilidad k /Capacidadk/
dset columna capacidad de cada facilidad m /Capacidadm/
;

$onecho > Book2.txt
I="C:\Users\Lang\Desktop\CasoEstudio\Book2.xls"
r1=Ik!a2:b5
o1=costofijok.inc
r2=Im!a2:b5
o2=costofijom.inc
r3=Capk!a2:b5
o3=capacidadhubk.inc
r4=Capm!a2:b5
o4=capacidadhubm.inc
r5=Sij!a2:d31
o5=costodirecto.inc
r6=Cijk!a2:h234
o6=costoikj.inc
r7=Cijm!a2:h205
o7=costoimj.inc
r8=Cikmj!a2:j466
o8=costoikmj.inc
r9=Wij!a2:d89
o9=demandaij.inc
$offecho

$call =xls2gms @Book2a.txt

TABLE
Ik(k,aset) Costos fijos de localizar un hub de consolidación en k
$include costofijok.inc
;

TABLE
Im(m,bset) Costos fijos de localizar un hub de distribución en m
$include costofijom.inc
;

TABLE
S(i,j) Costo generalizado de transportar una unidad desde i hasta j
$include costodirecto.inc
;

TABLE
C1(i,k,t,j) Costo de transportar una unidad desde i hasta j a través del hub k en transporte carretero
$include costoikj.inc
;

TABLE
C2(i,m,t,j) Costo de transportar una unidad desde i hasta j a través del hub k en transporte fluvial
$include costoimj.inc
;

TABLE
C3(i,k,m,t,j) Costo de transportar una unidad desde i hasta j a través del hub k en transporte férreo
$include costoikmj.inc
;

TABLE
W(i,j) Demanda total en el puerto j
$include demandaij.inc
;

TABLE
qk(k,cset) Capacidad del hub k
$include capacidadhubk.inc
;

TABLE
qm(m,dset) Capacidad del hub k
$include capacidadhubm.inc
;

SCALAR
p        Numero de hub de consolidación a localizar
q        Numero de hub de distribución a localizar
bc       Beta del costo
;
p=1;
q=1;
bc=-33.2;

display Ik,Im,S,C1,C2,C3,W,qk,qm;

VARIABLES
    ctotal         costo total de transporte
    cfijot         costo fijo total de las facilidades
    cfijok         costo fijo de las instalaciones k
    cfijom         costo fijo de las instalaciones m
    cdirecto       costo de transporte por envío directo
    chubk          costo de transporte usando el hub k
    chubm          costo de transporte usando el hub m
    cparhub        costo de transporte usando el par hub k-m
POSITIVE VARIABLES
    pd(i,j)        probabilidad de elección de envío direto de i a j
    pk(i,k,t,j)    probabilidad de elección de envío de i a j usando el hub k
    pm(i,m,t,j)    probabilidad de elección de envío de i a j usando el hub m
    pkm(i,k,m,t,j) probabilidad de elección de envío de i a j usando el par hub k-m


BINARY VARIABLES
    Yk(k)         1 si el hub k es escogido 0 en otro caso
    Ym(m)         1 si el hub m es escogido 0 en otro caso

BINARY VARIABLES Y1,Y2;

EQUATIONS
    dctotal      definición costo total de transporte
    dcfijot      definición costo fijo total de las facilidades
    dcfijok      definición costo fijo de las instalaciones tipo k
    dcfijom      definición costo fijo de las instalaciones tipo m
    dcdirecto    definición costo de transporte por envío directo
    dchubk       definición costo de transporte usando el hub k
    dchubm       definición costo de transporte usando el hub m
    dcparhub     definición costo de transporte usando el par hub k-m
    R1           número de hub de consolidación a instalar
    R2           número de hub de distribución a instalar
    R3           suma de proporciones de flujo que llegan directamente desde el origen o utilizando cualquiera de los hub sea igual a uno
    R4           definición de la probabilidad de envío directo
    R5           definición de la probabilidad de envío utilizando el hub k a través del modo t
    R6           definición de la probabilidad de envío utilizando el hub m a través del modo t
    R7           definición de la probabilidad de envío utilizando el par hub a través del modo t
;

dctotal..                ctotal =e= cfijot + cdirecto + chubk + chubm + cparhub;
dcfijot..                cfijot =e= cfijok + cfijom;
dcfijok(aset)..          cfijok =e= sum(k,Ik(k,aset)*Y1(k));
dcfijom(bset)..          cfijom =e= sum(m,Im(m,bset)*Y2(m));
dcdirecto..              cdirecto =e= sum((i,j),S(i,j)*W(i,j)*pd(i,j));
dchubk..                 chubk =e= sum((i,k,t,j),C1(i,k,t,j)*W(i,j)*pk(i,k,t,j));
dchubm..                 chubm =e= sum((i,m,t,j),C2(i,m,t,j)*W(i,j)*pm(i,m,t,j));
dcparhub..               cparhub =e= sum((i,k,m,j,t),C3(i,k,m,t,j)*W(i,j)*pkm(i,k,m,t,j));
R1..                     sum(k,Yk(k)) =e= p;
R2..                     sum(m,Ym(m)) =e= q;
R3(i,j)..                pd(i,j) + sum((k,t),pk(i,k,t,j)) + sum((m,t),pm(i,m,t,j)) + sum((k,m,t),pkm(i,k,m,t,j)) =e= 1;
R4(i,t,j)..              pd(i,j)=e= exp(bc*S(i,j))/(exp(bc*S(i,j)) + sum(k,Yk(k)*exp(bc*C1(i,k,t,j))) + sum(m,Ym(m)*exp(bc*C2(i,m,t,j))) + sum((k,m),Yk(k)*Ym(m)*exp(bc*C3(i,k,m,t,j))));
R5(i,k,t,j)..            pk(i,k,t,j) =e= (Yk(k)*exp(bc*C1(i,k,t,j)))/(exp(bc*S(i,j)) + sum(Yk(k)*exp(bc*C1(i,k,t,j))) + sum(m,Ym(m)*exp(bc*C2(i,m,t,j))) + sum((k,m),Yk(k)*Ym(m)*exp(bc*C3(i,k,m,t,j))));
R6(i,m,t,j)..            pm(i,m,t,j) =e= (Ym(m)*exp(bc*C2(i,m,t,j)))/(exp(bc*S(i,j)) + sum(Yk(k)*exp(bc*C1(i,k,t,j))) + sum(m,Ym(m)*exp(bc*C2(i,m,t,j))) + sum((k,m),Yk(k)*Ym(m)*exp(bc*C3(i,k,m,t,j))));
R7(i,k,m,t,j)..          pkm(i,k,m,t,j) =e= (Ym(m)*exp(bc*C3(i,k,m,t,j)))/(exp(bc*S(i,j)) + sum(Yk(k)*exp(bc*C1(i,k,t,j))) + sum(m,Ym(m)*exp(bc*C2(i,m,t,j))) + sum((k,m),Yk(k)*Ym(m)*exp(bc*C3(i,k,m,t,j))));

Model TerminalesLogisticas /All/;
Solve TerminalesLogisticas using MINLP Minimizing ctotal;
display ctotal.l, cfijot.l, cdirecto.l, chubk.l, chubm.l, cparhub.l, pd.l, pk.l, pm.l, pkm.l, Yk.l, Ym.l;



Please help me

Renger van Nieuwkoop

unread,
Apr 11, 2016, 4:59:26 PM4/11/16
to gams...@googlegroups.com
Hi Karina
Read the last point of advice of Claudio. This is also an error that has surfaced many times in the forum.
Cheers
Renger

sent from my iPad
--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at https://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Karina Lang

unread,
Apr 11, 2016, 5:30:36 PM4/11/16
to gams...@googlegroups.com, ren...@vannieuwkoop.ch
Im trying to calculate probabilities (Logit model in GAMS)

El 11 de abril de 2016, 16:16, Karina Lang <ingk...@gmail.com> escribió:
Hi Renger,

I read all the forums about this error. But i cannot figure out. I´m trying to do this many times and the same error appear. 

Can you help me?

--
You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsworld/vYLthp8fOTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gamsworld+...@googlegroups.com.

Karina Lang

unread,
Apr 11, 2016, 5:30:36 PM4/11/16
to gams...@googlegroups.com, ren...@vannieuwkoop.ch
Hi Renger,

I read all the forums about this error. But i cannot figure out. I´m trying to do this many times and the same error appear. 

Can you help me?
El 11 de abril de 2016, 15:58, Renger van Nieuwkoop <ren...@vannieuwkoop.ch> escribió:

--
You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsworld/vYLthp8fOTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gamsworld+...@googlegroups.com.

Karina Lang

unread,
Apr 11, 2016, 6:27:15 PM4/11/16
to gams...@googlegroups.com
Ok... I did it but i have error 149 now..... :(

El 11 de abril de 2016, 15:58, Renger van Nieuwkoop <ren...@vannieuwkoop.ch> escribió:

--
You received this message because you are subscribed to a topic in the Google Groups "gamsworld" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gamsworld/vYLthp8fOTM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gamsworld+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages