Creating a dynamic Subset

Hello,

I want to create a dynamic Set which starts at the acronym START of parameter ec and ends at the acronym Ernte of parameter ec. See my code:

**CODE
Set dm /AugI, SepI, OktI, NovI, DezI, JanII, FebII, MrzII, AprII, MaiII, JunII, JulII, AugII, SepII, OktII, NovII, DezII/

Acronyms
Saat, EC13, EC25, EC31, EC39, EC49, Ernte;

Parameter
Ec(dm) /SepI Saat
OktI EC13
MrzII EC25
AprII EC31
MaiII EC39
JulII EC49
SepII Ernte /;

Set
dmm(dm);
dmm(dm)=no;

Loop(dm,
if(ec(dm) = Saat,
dmm(dm) = Yes;
elseif((ec(dm) = Ernte)),
dmm(dm) = yes;
Else
dmm(dm) = no);
);

display dmm

**END of CODE

In the end, the Set dmm(dm) should look like this:

SepI YES
OktI YES
NovI YES
DezI YES
JanII YES
FebII YES
MrzII YES
AprII YES
MaiII YES
JunII YES
JulII YES
AugII YES
SepII YES

Tanks in advance, Michael



\

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.

Hi,
I tried to folow your example a few days ago, and the fact that I
could not find the word START in the code, together with the use of
acronyms, did not help much to understand what you want to achieve,
could you please provide a more detailed explanation? The order of
elements in Ec is also relevant?
Best wishes,
Roger

2014-12-06 16:29 GMT+01:00 Roger Cremades Rodeja :

2014-12-05 16:27 GMT+01:00 :

Hello together,

I still can’t find any solution to my above mentioned issue. It would be very nice of you if you could give any idea accordingly.

Every advice is appreciated.

Michael


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.

\

Hy Roger,

You are right, I mixed up START and Saat…
So, there is a Acronym “Saat” which identifies the starting point of the dynamic set “dmm(dm)” that I want to create.
At Parameter Ec(dm) you can see, that “Saat” belongs to “SepI” which is included in the Set dm.
The endpoint of my dynamic set is marked by the Acronym “Ernte” which is also a element of Ec(dm). "Ernte belongs to “SepII”.
With a look to the Set dm you find a another 11 Month (dm) between “Saat” and “Ernte”

With my LOOP statment I wanted GAMS to find the Acronym “Saat” within the Paramenter Ec(dm) and to builed the dynamic Set dmm(dm). This dynamic Set should contain all Month (dm) until and including the Month (dm) which is marked with the Acronym “Ernte” in the Parameter Ec(dm).
The order of “dm” in the dynamic Set dmm(dm) is not important.

With my LOOP statment I reseive for the dynamic Set dmm(dm) the following solution:

SepI YES
SepII YES





Am Samstag, 6. Dezember 2014 18:18:49 UTC+1 schrieb Roger Cremades:

Hi,
I tried to folow your example a few days ago, and the fact that I
could not find the word START in the code, together with the use of
acronyms, did not help much to understand what you want to achieve,
could you please provide a more detailed explanation? The order of
elements in Ec is also relevant?
Best wishes,
Roger

2014-12-06 16:29 GMT+01:00 Roger Cremades Rodeja :

2014-12-05 16:27 GMT+01:00 :

Hello together,

I still can’t find any solution to my above mentioned issue. It would be very nice of you if you could give any idea accordingly.

Every advice is appreciated.

Michael


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.

Hi Michael,
you have not introduced ordinal information in the loop, which is the
only ingredient you were lacking; there are many options to do so,
this is only a fast thinking suggestion, I hope it helps, cheers,
Roger

Set dm /AugI, SepI, OktI, NovI, DezI, JanII, FebII, MrzII,
AprII, MaiII, JunII, JulII, AugII, SepII, OktII, NovII, DezII/
Acronyms
Saat, EC13, EC25, EC31, EC39, EC49, Ernte;
Parameter
Ec(dm) /SepI Saat
OktI EC13
MrzII EC25
AprII EC31
MaiII EC39
JulII EC49
SepII Ernte /;
*ordinal of saat & Ernte
parameter ord_saat(dm), ord_ernte(dm);
ord_saat(dm)(SAMEAS(dm,"SepI"))= ord(dm) ; ord_ernte(dm)(SAMEAS(dm,“SepII”))= ord(dm) ;
scalar ord_saat2, ord_ernte2;
ord_saat2 = ord_saat(“SepI”);
ord_ernte2 = ord_ernte(“SepII”);
Set
dmm(dm);
dmm(dm)=no;
*introduce ordinal information in the loop
SCALAR COUNT;COUNT=0;
Loop(dm,
count=count+1;
if((count ge ord_saat2) AND (count le ord_ernte2),
dmm(dm) = Yes;);
);
display dmm
*bear in mind ordering of set elements


2014-12-07 12:44 GMT+01:00 :

Hy Roger,

You are right, I mixed up START and Saat…
So, there is a Acronym “Saat” which identifies the starting point of the
dynamic set “dmm(dm)” that I want to create.
At Parameter Ec(dm) you can see, that “Saat” belongs to “SepI” which is
included in the Set dm.
The endpoint of my dynamic set is marked by the Acronym “Ernte” which is
also a element of Ec(dm). "Ernte belongs to “SepII”.
With a look to the Set dm you find a another 11 Month (dm) between “Saat”
and “Ernte”

With my LOOP statment I wanted GAMS to find the Acronym “Saat” within the
Paramenter Ec(dm) and to builed the dynamic Set dmm(dm). This dynamic Set
should contain all Month (dm) until and including the Month (dm) which is
marked with the Acronym “Ernte” in the Parameter Ec(dm).
The order of “dm” in the dynamic Set dmm(dm) is not important.

With my LOOP statment I reseive for the dynamic Set dmm(dm) the following
solution:

SepI YES
SepII YES

Am Samstag, 6. Dezember 2014 18:18:49 UTC+1 schrieb Roger Cremades:

Hi,
I tried to folow your example a few days ago, and the fact that I
could not find the word START in the code, together with the use of
acronyms, did not help much to understand what you want to achieve,
could you please provide a more detailed explanation? The order of
elements in Ec is also relevant?
Best wishes,
Roger

2014-12-06 16:29 GMT+01:00 Roger Cremades Rodeja :

2014-12-05 16:27 GMT+01:00 :

Hello together,

I still can’t find any solution to my above mentioned issue. It would
be very nice of you if you could give any idea accordingly.

Every advice is appreciated.

Michael


You received this message because you are subscribed to the Google
Groups “gamsworld” group.
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.


“gamsworld” group.
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.

\

Hi, a shorter solution:
Set dm /AugI, SepI, OktI, NovI, DezI, JanII, FebII, MrzII,
AprII, MaiII, JunII, JulII, AugII, SepII, OktII, NovII, DezII/
Acronyms
Saat, EC13, EC25, EC31, EC39, EC49, Ernte;
Parameter
Ec(dm) /SepI Saat
OktI EC13
MrzII EC25
AprII EC31
MaiII EC39
JulII EC49
SepII Ernte /;
*ordinal of saat & Ernte
parameter ord_saat(dm), ord_ernte(dm);
ord_saat(dm)(SAMEAS(dm,"SepI"))= ord(dm) ; ord_ernte(dm)(SAMEAS(dm,“SepII”))= ord(dm) ;
Set
dmm(dm);
dmm(dm)=no;
*introduce ordinal information in the loop
SCALAR COUNT;COUNT=0;
Loop(dm,
count=count+1;
if(count ge ord_saat(“SepI”) AND count le ord_ernte(“SepII”),
dmm(dm) = Yes;);
);
display dmm

2014-12-09 15:53 GMT+01:00 Roger Cremades Rodeja :

Hi Michael,
you have not introduced ordinal information in the loop, which is the
only ingredient you were lacking; there are many options to do so,
this is only a fast thinking suggestion, I hope it helps, cheers,
Roger

Set dm /AugI, SepI, OktI, NovI, DezI, JanII, FebII, MrzII,
AprII, MaiII, JunII, JulII, AugII, SepII, OktII, NovII, DezII/
Acronyms
Saat, EC13, EC25, EC31, EC39, EC49, Ernte;
Parameter
Ec(dm) /SepI Saat
OktI EC13
MrzII EC25
AprII EC31
MaiII EC39
JulII EC49
SepII Ernte /;
*ordinal of saat & Ernte
parameter ord_saat(dm), ord_ernte(dm);
ord_saat(dm)(SAMEAS(dm,"SepI"))= ord(dm) ; ord_ernte(dm)(SAMEAS(dm,“SepII”))= ord(dm) ;
scalar ord_saat2, ord_ernte2;
ord_saat2 = ord_saat(“SepI”);
ord_ernte2 = ord_ernte(“SepII”);
Set
dmm(dm);
dmm(dm)=no;
*introduce ordinal information in the loop
SCALAR COUNT;COUNT=0;
Loop(dm,
count=count+1;
if((count ge ord_saat2) AND (count le ord_ernte2),
dmm(dm) = Yes;);
);
display dmm
*bear in mind ordering of set elements

2014-12-07 12:44 GMT+01:00 :

Hy Roger,

You are right, I mixed up START and Saat…
So, there is a Acronym “Saat” which identifies the starting point of the
dynamic set “dmm(dm)” that I want to create.
At Parameter Ec(dm) you can see, that “Saat” belongs to “SepI” which is
included in the Set dm.
The endpoint of my dynamic set is marked by the Acronym “Ernte” which is
also a element of Ec(dm). "Ernte belongs to “SepII”.
With a look to the Set dm you find a another 11 Month (dm) between “Saat”
and “Ernte”

With my LOOP statment I wanted GAMS to find the Acronym “Saat” within the
Paramenter Ec(dm) and to builed the dynamic Set dmm(dm). This dynamic Set
should contain all Month (dm) until and including the Month (dm) which is
marked with the Acronym “Ernte” in the Parameter Ec(dm).
The order of “dm” in the dynamic Set dmm(dm) is not important.

With my LOOP statment I reseive for the dynamic Set dmm(dm) the following
solution:

SepI YES
SepII YES

Am Samstag, 6. Dezember 2014 18:18:49 UTC+1 schrieb Roger Cremades:

Hi,
I tried to folow your example a few days ago, and the fact that I
could not find the word START in the code, together with the use of
acronyms, did not help much to understand what you want to achieve,
could you please provide a more detailed explanation? The order of
elements in Ec is also relevant?
Best wishes,
Roger

2014-12-06 16:29 GMT+01:00 Roger Cremades Rodeja :

2014-12-05 16:27 GMT+01:00 :

Hello together,

I still can’t find any solution to my above mentioned issue. It would
be very nice of you if you could give any idea accordingly.

Every advice is appreciated.

Michael


You received this message because you are subscribed to the Google
Groups “gamsworld” group.
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.


“gamsworld” group.
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.

\

Hi Roger,

thank you very much for your support!
Your suggestion mached exactly the point what I was searching for.
The SAMEAS command is new to me.

best wishes,

Michael

Am Dienstag, 9. Dezember 2014 16:21:53 UTC+1 schrieb Roger Cremades:

Hi, a shorter solution:
Set dm /AugI, SepI, OktI, NovI, DezI, JanII, FebII, MrzII,
AprII, MaiII, JunII, JulII, AugII, SepII, OktII, NovII, DezII/
Acronyms
Saat, EC13, EC25, EC31, EC39, EC49, Ernte;
Parameter
Ec(dm) /SepI Saat
OktI EC13
MrzII EC25
AprII EC31
MaiII EC39
JulII EC49
SepII Ernte /;
*ordinal of saat & Ernte
parameter ord_saat(dm), ord_ernte(dm);
ord_saat(dm)(SAMEAS(dm,"SepI"))= ord(dm) ; ord_ernte(dm)(SAMEAS(dm,“SepII”))= ord(dm) ;
Set
dmm(dm);
dmm(dm)=no;
*introduce ordinal information in the loop
SCALAR COUNT;COUNT=0;
Loop(dm,
count=count+1;
if(count ge ord_saat(“SepI”) AND count le ord_ernte(“SepII”),
dmm(dm) = Yes;);
);
display dmm

2014-12-09 15:53 GMT+01:00 Roger Cremades Rodeja :

Hi Michael,
you have not introduced ordinal information in the loop, which is the
only ingredient you were lacking; there are many options to do so,
this is only a fast thinking suggestion, I hope it helps, cheers,
Roger

Set dm /AugI, SepI, OktI, NovI, DezI, JanII, FebII, MrzII,
AprII, MaiII, JunII, JulII, AugII, SepII, OktII, NovII, DezII/
Acronyms
Saat, EC13, EC25, EC31, EC39, EC49, Ernte;
Parameter
Ec(dm) /SepI Saat
OktI EC13
MrzII EC25
AprII EC31
MaiII EC39
JulII EC49
SepII Ernte /;
*ordinal of saat & Ernte
parameter ord_saat(dm), ord_ernte(dm);
ord_saat(dm)(SAMEAS(dm,"SepI"))= ord(dm) ; ord_ernte(dm)(SAMEAS(dm,“SepII”))= ord(dm) ;
scalar ord_saat2, ord_ernte2;
ord_saat2 = ord_saat(“SepI”);
ord_ernte2 = ord_ernte(“SepII”);
Set
dmm(dm);
dmm(dm)=no;
*introduce ordinal information in the loop
SCALAR COUNT;COUNT=0;
Loop(dm,
count=count+1;
if((count ge ord_saat2) AND (count le ord_ernte2),
dmm(dm) = Yes;);
);
display dmm
*bear in mind ordering of set elements

2014-12-07 12:44 GMT+01:00 :

Hy Roger,

You are right, I mixed up START and Saat…
So, there is a Acronym “Saat” which identifies the starting point of the
dynamic set “dmm(dm)” that I want to create.
At Parameter Ec(dm) you can see, that “Saat” belongs to “SepI” which is
included in the Set dm.
The endpoint of my dynamic set is marked by the Acronym “Ernte” which is
also a element of Ec(dm). "Ernte belongs to “SepII”.
With a look to the Set dm you find a another 11 Month (dm) between “Saat”
and “Ernte”

With my LOOP statment I wanted GAMS to find the Acronym “Saat” within the
Paramenter Ec(dm) and to builed the dynamic Set dmm(dm). This dynamic Set
should contain all Month (dm) until and including the Month (dm) which is
marked with the Acronym “Ernte” in the Parameter Ec(dm).
The order of “dm” in the dynamic Set dmm(dm) is not important.

With my LOOP statment I reseive for the dynamic Set dmm(dm) the following
solution:

SepI YES
SepII YES

Am Samstag, 6. Dezember 2014 18:18:49 UTC+1 schrieb Roger Cremades:

Hi,
I tried to folow your example a few days ago, and the fact that I
could not find the word START in the code, together with the use of
acronyms, did not help much to understand what you want to achieve,
could you please provide a more detailed explanation? The order of
elements in Ec is also relevant?
Best wishes,
Roger

2014-12-06 16:29 GMT+01:00 Roger Cremades Rodeja :

2014-12-05 16:27 GMT+01:00 :

Hello together,

I still can’t find any solution to my above mentioned issue. It would
be very nice of you if you could give any idea accordingly.

Every advice is appreciated.

Michael


You received this message because you are subscribed to the Google
Groups “gamsworld” group.
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.


“gamsworld” group.
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.