Hey guys,
I’m currently working on the implementation of a model in GAMS. There is, however, a problem which I simply cannot solve.
Here is the restriction I’m currently having problems with:
XS_{k+1,w} = XF_{k,w} + W_{k,w} forall k <= K-1, forall w
Here is the GAMS-Code (reduced to the essential stuff):
sets
w
k
parameters
d(k,w)
b(k)
variables
XS(k,w)
XF(k,w)
Wait(k,w)
equations
NB2(k,w);
NB2(k,w)$(k <= card(k)) … XS(k+1,w) =e= XF(k,w) + Wait(k,w);
The error I’m getting is 148 (Dimension different) as soon as I put the part $(k <= card(k))in.
Does anyone have an idea how to fix this? Thanks in advance!
\
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
Stefan:
K is not a number but an element in a set. You need to use the ord function to convert an element into a number:
NB2(k,w)$(ord(k) <= card(k))
Regards
Arne
\
Arne Stolbjerg Drud
ARKI Consulting & Development A/S
Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark
Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: adrud@arki.dk
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Stefan Heinemann
Sent: Tuesday, November 19, 2013 1:10 PM
To: gamsworld@googlegroups.com
Subject: Error 148 when dealing with the $-Operator
Hey guys,
I’m currently working on the implementation of a model in GAMS. There is, however, a problem which I simply cannot solve.
Here is the restriction I’m currently having problems with:
XS_{k+1,w} = XF_{k,w} + W_{k,w} forall k <= K-1, forall w
Here is the GAMS-Code (reduced to the essential stuff):
sets
w
k
parameters
d(k,w)
b(k)
variables
XS(k,w)
XF(k,w)
Wait(k,w)
equations
NB2(k,w);
NB2(k,w)(k <= card(k)) .. XS(k+1,w) =e= XF(k,w) + Wait(k,w);
\
\
\
The error I'm getting is 148 (Dimension different) as soon as I put the part (k <= card(k))in.
Does anyone have an idea how to fix this? Thanks in advance!
\
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.
Reply-to: gamsworld@googlegroups.com
Thanks a lot, Arne! It works.
–
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/groups/opt_out.