Algorithm 3.
1: function POST REFINEMENT(pext) |
2: ppast ← pext(1) |
3: pcurrent ← −1 |
4: count ← 0 |
5: idxbgn ← 1 |
6: idxfin ← 0 |
7: pre(1:T) ← −1 |
8: for t = 1 to T do |
9: pcurrent = pext(t) |
10: if pcurrent ≠ ppast then |
11: idxfin = t−1 |
12: if count>phist then |
13: pre(idxbgn:idxfin) = ppast |
14: idxbgn = t |
15: count = 1 |
16: else |
17: pre(idxbgn:idxfin) = pcurrent |
18: count = count+1 |
19: end if |
20: else |
21: count = count+1 |
22: end if |
23: ppast = pcurrent |
24: end for |
25: return pre |
26: end function |