summation

Problems with syntax of GAMS
Post Reply
nasim
User
User
Posts: 8
Joined: 6 years ago

summation

Post by nasim »

Hello

I defined 3sets for my model. Now I need to add a term to my OBJ function which is the sum of a sum.

these are my sets:

sets
i "option" /p,b,s,d,f,1,2,3,4,5,6,7,8,9,10,11,12/
j "products" /c,l,m/
k "type of product" /1,2,3,4,5,6,7,8,9,10,11,12,13,14/;

this is my parameter:

C(i) cost per ha of BMPs/

"1" -111
"2" 471
"3" 73
"4" 82
"5" 82
"6" 82
"7" 31.32
"8" 31.32
"9" 50.30
"10" 182.20
"11" 21.43
"12" 2.68
/

I want to write this equation:

sum of i from 1 to 12 in x(i"c"k) times c(i) over k

would you please help me with the syntax of this term.

Thank so much in advance
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: summation

Post by Renger »

Hi
From your question it is not completely clear to me what you want. Is this what you are looking for (otherwise write down the mathematical expression for your question):

OBJ =E= sum((i,k), X(i,k)*C(i))


Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
nasim
User
User
Posts: 8
Joined: 6 years ago

Re: summation

Post by nasim »

Thank you so much. I figured it out. But I have another question!

I wrote the following sum but I got $140 error. would you please help me!

sum((k),(sum((i),x(i,"c",k)* t(ibmp)$ibmp(i))* N(k)) =L= 1420

ibmp(i) is a subset of i

Thanks in advance
Post Reply