maximum number of repetitions

Archive of Gamsworld Google Group
Post Reply
richard
User
User
Posts: 27
Joined: 5 years ago

maximum number of repetitions

Post by richard »

the following table is a result of one model

Code: Select all

   D(i,j)
           40     50       60     
           
    1     40      50
    2                      60 
    3     40
    9            50
    17           50
    19                     60
    32    40     50
    55                     60
    
This table shows patterns.
for example Pattern "40,50" Repeated twice. pattern 50 repeated 2 times. And Pattern "60" repeated three times. Here the maximum number of repetitive patterns is 3. (I mean, the pattern " 60 " has been repeated three times).

How can I find the maximum number of repetitions for patterns, For all tables like this?

Best & thanks
Manassaldi
User
User
Posts: 118
Joined: 7 years ago
Location: Rosario - Argentina

Re: maximum number of repetitions

Post by Manassaldi »

Hi, I think this can work.
Maybe it should be modified for a greater generality
Bye!

Code: Select all

set
i your set i                    /1*55/
n number of pattern             /p1*p6/
j your set j                    /40,50,60/
pattern(n,j) pattern definition /p1.40,p2.50,p3.60,p4.40,p4.50,p5.40,p5.60,p6.50,p6.60/
;
table  D(i,j)
      40     50       60

1     40      50
2                      60
3     40
9            50
17           50
19                     60
32    40     50
55                     60
;
parameter
DD(i,j) same to D but with binary information
rep_pattern(n)
;
DD(i,'40')=D(i,'40')/40;
DD(i,'50')=D(i,'50')/50;
DD(i,'60')=D(i,'60')/60;


rep_pattern(n)=0;
loop((n,i),
if((sum(j$pattern(n,j),1-DD(i,j)) + sum(j$(not pattern(n,j)),DD(i,j))) lt 1,
rep_pattern(n) = rep_pattern(n) + 1;
);
);

display rep_pattern;
richard
User
User
Posts: 27
Joined: 5 years ago

Re: maximum number of repetitions

Post by richard »

Hi Manassaldi , thank you very much , your answer is very helpful. ;)
Best
Richard
Post Reply