assigning specific elements to a subset from a set.

Hi there,

This might be a simple question, but I’d like to have some clarification.

Suppose I have a set AllPeriod with its defined elements…

set
AllPeriod
/2000*2100/

…and the subset is defined as:

set
Period(AllPeriod)

I know that you can put single elements into the set by

Period(AllPeriod) = no;
Period("2010") = yes;
Period("2011") = yes;

What I want to do is put the elements 2010 to 2090 into the subset Period without having to manually write:

Period("2010") = yes;
Period("2011") = yes;
...
Period("2089") = yes
Period("2090") = yes

Is the some simplified way of writing this, for example like Period(/2010*2090/)?

Thanks in advance.

One possibility is to filter with ORD expressions (assuming the set AllPeriod is ordered):

Period(AllPeriod)$((ord(AllPeriod)>10)$(ord(AllPeriod)<card(AllPeriod)-9))=yes;

In you know you will need this subset 2010*2090, you could do

sets
  AllPeriod /2000*2100/
  Period(AllPeriod)
  xxxPeriod(allPeriod) /2010*2090/
  ;
period(xxxPeriod) = yes;

If the membership of period is static, you could just define the elements in the declaration, like it is for xxxPeriod above. But if you want to make the assignment to period dynamic, it’s handy to declare/define something like the xxxPeriod set and use that.

-Steve