Hiï¼ŒRenger

Thanks for your help.

Best regards

Hiking

2014å¹´11æœˆ26æ—¥ ä¸‹åˆ7:29äºŽ “Renger van Nieuwkoop” å†™é“ï¼š

Hi Hiking

If you only use sita for summing in this one equation, you donâ€™t need the set sita.

You can control the summing over the proper set elements by using k to indicate which variables should be summed. k in your example is either 0 (no summation), 2, or 3.

Here an example, where k is used to control the number of previous periods.

If I understand the equation correctly, the variable y should be defined over (c,m,mp,h) and not over c(c,mp,h).

Cheers

Renger

set

h the set of hours in the operational model /1*10/ ,

c the sets of components exchanger1 and exchanger2/ex1,ex2/,

m modes of c e.g high temperature mode and low temperature mode /off,cold,warm,high,low/

i /bottom, top/;

;

alias(m,mp), (c,cp), (h,hh);

Parameters

K(c,m,mp) / ex1.cold.low 2,

ex1.low.off 2,

ex1.high.off 3,

ex2.cold.low 2,

ex2.low.off 2,

ex2.high.off 3/;

** Use parameters instead of variables to check the equation easily

parameter

y(c,m,mp,h),

z(c,m,mp,hh);

** Initialize z:

z(c,m,mp,hh) = 1;

y(c,m,mp,h)k(c,m,mp) = sum(hh(ord(hh)+k(c,m,mp) > ord(h) and ord(hh) :

hello Renger,

Iam sorry for my rough code .I have overwrited my code ,the set i had been added,and the = had been replaced with =g= as the model demands and so as to the semicolons in the code .But Renger, I think you mistaken what confused me .sita as you can see in the picture attachment should be a fixed sets like sita(c,m,mp) consists of several subsets like /0,1,2…K(c,m,mp)/ .but as you know it is wrong in syntax and cant be formulated like this .In your example hh consists of only one subset ( it is my definition ) ,how can I express it if hh is a parameter like hh(i) (e.g if i =1 ,hh(i)=4;i=2,hh(i)=5;i=3,hh(i)=6),and to get the sum of z(sita) where sita is from 0 to hh(i) .

best regards

Hiking

åœ¨ 2014å¹´11æœˆ25æ—¥æ˜ŸæœŸäºŒUTC+8ä¸‹åˆ7æ—¶14åˆ†14ç§’ï¼Œqinghai Sunå†™é“ï¼š

Hello,

I occured a problem how to write the sum expression.my code is followed ï¼š

set i the extreme points /top,buttom/ ;

set c the sets of components exchanger1 and exchanger2/ex1,ex2/;alias(c,cp);

set m modes of c e.g high tempreture mode and low tempreture mode /off,cold,warm,high,low/ alias(m,mp,mpp);

set p products /tem,hot/ ;alias(p,g ,pp);

set dal(c,m,mp) disallowed transitions/(ex1,ex2).(off.low,off.high,cold.off,cold.high,warm.off,warm.high,low.cold,low.warm,high.warm,high.cold,high.off)/;

set ms(c,m,mp) minimum stay /(ex1,ex2).(cold.low,low.off,high.low)/;

set h the set of hours in the operational model /1*100/ ;

Parameters

x(c,m,i,p) /ex1.low.top.tem 180,

ex1.low.buttom.tem 120,

ex1.high.top.tem 320,

ex1.high.buttom.tem 180,

ex2.low.top.hot 180,

ex2.low.buttom.hot 120,

ex2.high.top.hot 320,

ex2.high.buttom.hot 180/

K(c,m,mp) / ex1.cold.low 2,

ex1.low.off 2,

ex1.high.off 3,

ex2.cold.low 2,

ex2.low.off 2,

ex2.high.off 3/

Equations

minStay(c,mp,h) minimum stay constraint;

minStay(c,mp,h)$(ms(c,m,mp)) … y(c,mp,h) =g= sum(sita,z(c,m,mp,h-sita+1)) where sita I think should be a set .but in the expression demanded sita is a set for 1 to K(ms) .I am confused how to define sita in Gams ,for it is assicated with K(ms) .the expression I am trying to formulated can be seen in the attachment for it cant write directly in the editor .

Thanks in advance .

## Hiking

\

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 http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

–

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.

–

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/ho9lI8QhYG8/unsubscribe.

To unsubscribe from this group and all its topics, 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.

–

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.