sum over a subset

Dear GAMS-Users,


I have a model that calculates the cost-minimal output of different machines. The temporal resolution is 8760 hours (= 1 year). One of the machines can only produce 4 hours a day. I don´t know how to implement this restriction into the model. Can anybody help me?



My idea was to use the binary variable ON (t) which describes whether the machine is online (=1) or offline (=0). The sum of this variable over one day has to be lower than 4 (hours):

(Set t /1*8760/)

The problem is, that I do not know how to sum over 24 hours. I used the subset t_sub (t,tt) = YES$((ord(tt) gt ord(t)-24) and (ord(tt) lt ord(t))). But it didn´t work.

Furthermore I don´t know how to express the fact that the sum should only be built if t = {1-24; 25- 48; 49 – 72; …}.


Please, can anybody help me?


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/d/optout.

Dear Anne,

Attached please find a possible solution to your question. I hope it helps you.


Cheers,
Pedro


On Tue, Jun 17, 2014 at 2:52 PM, Anne wrote:

Dear GAMS-Users,


I have a model that calculates the cost-minimal output of different machines. The temporal resolution is 8760 hours (= 1 year). One of the machines can only produce 4 hours a day. I don´t know how to implement this restriction into the model. Can anybody help me?



My idea was to use the binary variable ON (t) which describes whether the machine is online (=1) or offline (=0). The sum of this variable over one day has to be lower than 4 (hours):

(Set t /1*8760/)

The problem is, that I do not know how to sum over 24 hours. I used the subset t_sub (t,tt) = YES$((ord(tt) gt ord(t)-24) and (ord(tt) lt ord(t))). But it didn´t work.

Furthermore I don´t know how to express the fact that the sum should only be built if t = {1-24; 25- 48; 49 – 72; …}.


Please, can anybody help me?


Example.gms (232 Bytes)

Hi,

Can you be more clear. you are saying that “One of the machines can only produce 4 hours a day” and then you are defining a binary variable and forcing the summation of the variable be less than 4. In my idea it is not justifiable.Working 4 hours means you are talking about time length that is continuous, binary variable is saying that, this machine was online 4 times during a day, but for how long???
That is what I understood from your problem, you van be more clear, so people here can help you to implement it in GAMS.
(although I think that this type of questions can be solved by better modeling, they are not directly related to GAMS tricks)

Best,


On Tue, Jun 17, 2014 at 9:52 AM, Anne wrote:

Dear GAMS-Users,


I have a model that calculates the cost-minimal output of different machines. The temporal resolution is 8760 hours (= 1 year). One of the machines can only produce 4 hours a day. I don´t know how to implement this restriction into the model. Can anybody help me?



My idea was to use the binary variable ON (t) which describes whether the machine is online (=1) or offline (=0). The sum of this variable over one day has to be lower than 4 (hours):

(Set t /1*8760/)

The problem is, that I do not know how to sum over 24 hours. I used the subset t_sub (t,tt) = YES$((ord(tt) gt ord(t)-24) and (ord(tt) lt ord(t))). But it didn´t work.

Furthermore I don´t know how to express the fact that the sum should only be built if t = {1-24; 25- 48; 49 – 72; …}.


Please, can anybody help me?


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/d/optout.



\

Babak Saleck Pay
Ph.D Student of Systems Modeling and Analysis
Department of Statistical Sciences and Operations Research
Virginia Commonwealth University
4156 Grace Harris Hall
1015 Floyd Ave.
Richmond, VA

\

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/d/optout.

Dear Pedro,

thank you very much! :slight_smile:


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/d/optout.