Hi Baden,
Yes its always a puzzle… Basically you could see a set as a parameter that only takes the values 1 and 0. Then you just need the right summation and multiplication… DId you want the following:
Sets
I “farmers” /15/
M “fields” /120/
conventional(I) /1,2,4/
organic(I) /3,5/
Ifield(I,M) “farmer I is owner of field(s)”
/1.(1,2)
2.(3,4,6,7,8,9)
3.(10)
4.(11,12,13,14,15,16,17)
5.(18,19,20) /
Sets
organicfields(M)
conventionelfields(M) ;
OrganicFields(M) $sum(I,Ifield(I,M)*organic(I)) =yes;
ConventionelFields(M)$sum(I,Ifield(I,M)*conventional(I))=yes;
display organic,conventional;
display OrganicFields,ConventionelFields;
*Note Field 5 is missing!
Best wishes
Wietse
\
From: gamsworld@googlegroups.com [gamsworld@googlegroups.com] On Behalf Of Baden [jeppebaden@gmail.com]
Sent: Thursday, February 09, 2012 3:50 PM
To: gamsworld@googlegroups.com
Subject: Subset from a one-to-many set
I have some very large sets, and would like to make some subsets.
Here I try to describe it, by they same (but smaller) sets
Sets
I “farmers” /15/
M “fields” /120/
conventional(I) /1,2,4/
organic(I) /3,5/
Ifield(I,M) “farmer I is owner of field(s)”
/1.(1,2)
2.(3,4,6,7,8,9)
3.(10)
4.(11,12,13,14,15,16,17)
5.(18,19,20) /
Then I would like to make a subset of fields which are organic ‘organic(M)’ and
one which is conventionel ‘conventionel(M)’ I need to have them as (M)
and not as (I,M). But I can’t make it work.
Sets
organic(M)
conventionel(M) ;
organic(M) = ?
conventionel(M) = ?
Keep getting errors like; ‘dimension different’, ‘Uncontrolled set entered as constant’ etc .
:-/ Baden
–
To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/wJKO3_ItHlQJ.
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.
\