Sets

14 views
Skip to first unread message

Nikola

unread,
May 27, 2012, 12:53:09 AM5/27/12
to gamsworld
Hi All,

I am working on the pickup and delivery problem and I encountered an
issue. I am extracting here a few lines of code that are giving me a
hard time:

Set:
I set of pickup and delivery nodes /p1*p5, d1*d5/
P(I) set of pickup nodes /p1*p5/

Positive Variable:
Y(i)
X(i)

Equation:
eq1(p).. Y(p) =e= X(p+5) - X(p) - 3;

The report says that the above equation is infeasible and when I look
at the listing I realize that X(p+5) was ignored. As a result, the
listing gives: Y(p) + X(p) =e= -3, which is infeasible since both Y(p)
and X(p) are positive variables. My question is why was X(p+5) ignored
and what can I do to fix this?

I would greatly appreciate your help.
Nikola

Arne Stolbjerg Drud

unread,
May 29, 2012, 4:20:01 AM5/29/12
to gams...@googlegroups.com
Nikola:

The problem is, that the lead operator works within the set that you specify
so p+5 means five elements further out within the set p and if this element
does not exist then nothing. And since you only have 5 elements in p you
will never get anything.

You must use the lead operator on the large set, I. The equation can be
written as:

eq1(i)$p(i).. Y(i) =e= X(i+5) - X(i) - 3;

Good luck.

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: ad...@arki.dk
--
You received this message because you are subscribed to the Google Groups
"gamsworld" group.
To post to this group, send email to gams...@googlegroups.com.
To unsubscribe from this group, send email to
gamsworld+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/gamsworld?hl=en.

Nikola

unread,
May 29, 2012, 3:11:02 PM5/29/12
to gamsworld
Hi Arne,

Thanks a lot for your help!

Nikola
Reply all
Reply to author
Forward
0 new messages