Hi all
I am writing some code for which I need to process time series data defined on three dimensions namely years (y), months(m) and weeks(w).
Calendar-wise I have a regular monthly 4-4-5 weeks pattern meaning that:
\
-
for Jan I have 4 weeks (ie weeks 1-4)
-
for Feb I have 4 weeks (5-8)
-
for Mar I have 5 weeks (ie 9-13).
-…………
This 4-4-5 pattern repeats every three month so I have always 52 weeks every year.
Now I need to create a tuple such that the byproduct (m,w) is filled with “yes†such that it reflect the pattern labeling described above.
I have created the following code which works fine for me.
My question to the most experienced GAMS users in this forum : is there any more elegant / efficient way to get to the same result?
Thanks
Massimiliano
sets
y year /2007*2013/
m month /1*12/
w week /1*52/
mw(m,w) /#m.#w/;
\
- we now set the mw set to zero
mw(m,w)=no;
parameter ffw(w) 445 month corresponding to each week/
1 1
2 1
3 1
4 1
5 2
6 2
7 2
8 2
9 3
10 3
11 3
12 3
13 3
14 4
15 4
16 4
17 4
18 5
19 5
20 5
21 5
22 6
23 6
24 6
25 6
26 6
27 7
28 7
29 7
30 7
31 8
32 8
33 8
34 8
35 9
36 9
37 9
38 9
39 9
40 10
41 10
42 10
43 10
44 11
45 11
46 11
47 11
48 12
49 12
50 12
51 12
52 12
/;
\
-
we now fill the mw set with yes only in those weeks with corresponding
-
month based on the ffw table
mw(m,w)$(m.val=ffw(w))=yes;
display mw;
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to which it is addressed and may contain information that is confidential, privileged and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any printing, copying, dissemination, distribution, disclosure or forwarding of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and delete it from your system. Thank You.
Attachments-228/Test03.gms