Dear Renger,
Thank you very much.
Regards,
Nan
On Sun, Oct 28, 2012 at 4:13 AM, Renger van Nieuwkoop wrote:
Hi Nan
J_o is defined as a subset of j (j_o(j), so no need to have this somewhere in the equation).
Your second question:
A possible solution would be
total(t) =E= sum(j_o, x(1,j_o))(ord(t) Eq 1) + sum(j_o, x(1,j_c))(ord(t) Eq 2)
Cheers
Renger
From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Nan Yu
Sent: Saturday, October 27, 2012 9:32 AM
To: gamsworld@googlegroups.com
Subject: Re: Subsets and handling in equations
Hi,
I also have a similar problem concerning the sub sets.
I’m confused about your reply. In the first equation, if you change x(t,j) to x(t,j_o), then how to capture the fact that j_o is a sub set of j?
If I have a variable x (t,j) and I want to sum x(t,j) at diffent t, but at different t, the elements of j will be differnt.
In Japango’s example,
when t=1, I want to sum x(1,j_o)
when t=2, I wnat to sum x(2,j_c)
how to define this?
Thank you very much.
Regards,
Nan
On Friday, October 26, 2012 8:38:31 PM UTC+8, Renger van Nieuwkoop wrote:
Hi Martin
In the first equation be sure that you have the same sets on both sides: open:_being(j_o,t)$… x(t,j_o) and not x(t,j). This will cause problems because can’t find the index j_o in the equation
you can just use x(t+,j) instead of ord(t) = ord(t)+1.
Cheers
Rehger
Modelworks
Gewerbestrasse 15
3600 Thun – Switzerland
+41 79 818 53 73
Info@modelworks.ch
blog.modelworks.ch
From: gams...@googlegroups.com [gams…@googlegroups.com] on behalf of JapanGo [markus…@googlemail.com]
Sent: Friday, October 26, 2012 13:25
To: gams...@googlegroups.com
Subject: Subsets and handling in equations
Dear members of Gamsworld,
I am sitting in front of a MIP code, which is bothering me quite a time and I have not found a solution so far.
Quickly explaines in words what I want to achieve:
I have a set J consisting of several cities (e.g. New York, Chicago, Miami → 1, 2, 3). I defined a subset which consists of a selection of those cities:
Sets
j set of cities /1*3/; This is the whole set
Set j_o(j) subset1 /1,3/; This is subset 1 of set J
Set j_c(j) subset2 /2/; This is subset 2 of set J
The division is used as an initialization because some cities are active in period t=1, others are not. During the course of time, the activity may change.
Following restrictions on the activity:
- a city of subset1 needs to be active in period t=1
- an active city (subset1) can become inactive during the planning horizon, but is not allowed to be reactivated
- an inactive city (subset2) can become active and will stay active for the rest of the planning horizon
In order to model the sets with equations I tried the following, but I guess I am doing something wrong here with the sets.
- open_begin(j_o,t)$(ord(t)=1)… x(t,j) =e= 1; This equation should be for all x(t,j) which belong to t=1 and the subset1 of set J
- no_reopen(j_o,t)… x(t,j) =g= x(t,j)$(ord(t)=ord(t)+1); This equation should be for all x(t,j) which belong to the subset1 of set J, the expression with “ord” should model x(t,j) =g= x(“t+1”,j) and I hope I did this part correct
- open_new(j_c,t)… x(t,j) =l= x(t,j)$(ord(t)=ord(t)+1); This equation should be for all x(t,j) which belong to the subset2 of set J
I think this may be an easy one for GAMS professionals, but I am just stuck and don’t know how to solve it. I googled a lot, but unfortunately no success on that last little step.
Thanks a lot to all!
\
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/4slXH4XFFosJ.
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.
–
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/hHCfNEdPDsAJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.