Hi Mesude,

Indeed both look the same but first have a look at the Multidimensional set Ifield(I,M)

I already suggested that you should see a set like a parameter with 0,1 values hence your Ifields looks like (in the rows the I and in the columns the M, blanks are zeros)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

1 1 1

2 1 1 1 1 1 1

3 1

4 1 1 1 1 1 1 1

5 1 1 1

Now we want to look first for the organic farms which fields are used. This can be done many different ways, but here I just multiply Ifield(I,M) with organic(I)

1 0

2 0

3 1

4 0

5 1

and hence we get Ifield(I,M)*organic(I)

10 18 19 20

3 1

5 1 1 1

Now we do a summation over I and we get sum(I,Ifield(I,M)*organic(I)) :

10 1

18 1

19 1

20 1

(and hence all other fields have the value zero). So we get

OrganicFields(M) $sum(I,Ifield(I,M)*organic(I)) =yes;

Take fields as organic if the sum of the Ifield(I,M)*organic(I)) is greater than zero. You could write it as

OrganicFields(M) $(sum(I,Ifield(I,M)*organic(I))>0) = yes;

but GAMS assumes the >0 as default and GAMS modelers tend to not specify them in their equations/etc.

For conventional fields I use the same apporach, but use the set conventional(I) instead of organic(I).

To make it perhaps simpler or just to give you an alternative:

OrganicFields(M) $sum(I$organic(I), Ifield(I,M))=yes;

OrganicFields(M) $(sum(I$organic(I), Ifield(I,M))>0)=yes;

should give you the same results (and officially with less calculations). I prefer my approach used, since too many conditional statements in one line are confusing and there is hardly any speed difference between these two.

Hope this gives you a better understanding… If not let me know

Best wishes

Wietse

:

\

From: gamsworld@googlegroups.com [gamsworld@googlegroups.com] On Behalf Of Mesude Ozturk [mesudeavci@gmail.com]

Sent: Friday, February 10, 2012 4:56 PM

To: gamsworld@googlegroups.com

Subject: about Baden’s question

Hi Wietse,

I am just curious . I was looking Baden’s question and your answer and I have a question to you:

you wrote these two sentences they look like the same so can you explain what they are doing please?

OrganicFields(M) $sum(I,Ifield(I,M)*organic(I)) =yes;

ConventionelFields(M)$sum(I,Ifield(I,M)*conventional(I))=yes;

Thanks

Mesude

–

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.

\