History Buffer Updating Algorithm初步想法

来源:互联网 发布:网络黑客电影国产 编辑:程序博客网 时间:2024/06/06 04:00

一些定义:

HB:History Buffer,存放所有GCMP的candidates

Cnew:所有从new data中得到的new clusters的集合

前提假设:

1、所有的new clusters都是独立的,无任何交集。所有的candidates中的对象也是独立的,没有交集。

2、GCMP的要求:
1) 全局时长要求:K>1
2) 局部时长要求:L>1
3) 局部间隔要求:G>1

3、candidate的数据结构:拟采用summary结构,即只需要保留关于该candidate的几个相关参数的值:{kt, lt, gt, O, c},前三个分别表示当前已有的全局时长、最新的局部时长、最新的局部间隔时长的value,第四个是所含的objects的编号(可为事先编好的全局编号),最后一个是分配给该candidate的new cluster。

4、每个GCMP有三种状态
1) complete。complete是指发现了完整的GCMP,要提交出去。
2) candidate。是指有待成为complete状态,存在HB中。
3) invalid。是指candidate经过当前时刻判断后,今后无法成为complete GCMP,要从HB中被清除出去。

5、每个candidate有两种状态
1) L-status。是指在当前时刻,还未与new cluster融合时,处在局部连续的状态,此时的ca.lt即为当前局部连续的时刻数,ca.gt=0。
2)G-status。表明当前处在局部间断的状态,此时ca.gt即为当前间隔的时刻数,ca.lt=0。

6、HB中所有candidates的数据结构:拟采用哈希表。key是candidate的O中的core points的编号,value则是candidate的summary。方便将new cluster匹配到对应的candidate。

算法步骤

  1. 完成new clusters与candidates的快速匹配,通过匹配new clusters的core points的编号与candidate的key。匹配后,会出现相同new clusters匹配到了多个candidates处,以及有的candidates没有被匹配上任何new cluster的情况;

  2. 遍历所有的candidates,处理它们的summary结构{kt, lt, gt, O, c},即c的到来会使前四个参数出现哪些变化,从中找到complete GCMP或invalid GCMP,如果都不是,继续当candidate。

    情况一:被处理后,全局时长满足要求,可能出现complete GCMP

情况二:全局时长已超过K,可能出现complete GCMP

情况三:被处理后,全局时长仍为达K,无法出现complete GCMP

初步算法伪代码

Algorithm 1: UpadateHB()quickMatching(HB,Cnew);foreach candidate ca in HB do    //complete GCMP only occurs here    if ca.kt==K-1        ca.kt += 1;        if ca is in L-status            if ca.c==NULL                 ca.gt = 1;                if ca.lt>=L                    report complete GCMP; //bingo!                else                    remove invalid GCMP; //remove!            else                ca.lt += 1;                ca.O = {oi|(oi in ca.O) && (oi in ca.c)};                if ca.lt>=L                    report complete GCMP; //bingo!                else                    ca is still candidate; //still        if ca is in G-status            if ca.c==NULL                 ca.gt += 1;                if ca.gt<G                    report complete GCMP; //bingo!                else                    remove invalid GCMP; //still            else                ca.lt = 1;                ca.O = {oi|(oi in ca.O) && (oi in ca.c)};                ca is still candidate; //still    //after the above or the current process, if a candidate is still a candidate, it will come here the next time. ca.kt has already meet the K, and ca must be in L-status.    else if ca.kt>K-1        ca.kt += 1;        if ca.c==NULL            remove invalid GCMP; //remove!        else            ca.lt += 1;            if ca.lt>=L                report complete GCMP; //bingo!            else                ca is still candidate; //still    // ca.kt < K-1 here, and no possiblity to obtain a complete GCMP. candidates here will be still candidate or removed.       else        ca.kt += 1;        if ca is in L-status            if ca.c==NULL                 ca.gt = 1;                if ca.lt>=L                    ca is still candidate; //still                else                    remove invalid GCMP; //remove!            else                ca.lt += 1;                ca.O = {oi|(oi in ca.O) && (oi in ca.c)};                ca is still candidate; //still        if ca is in G-status            if ca.c==NULL                 ca.gt += 1;                if ca.gt<G                    ca is still candidate; //still                else                    remove invalid GCMP; //still            else                ca.lt = 1;                ca.O = {oi|(oi in ca.O) && (oi in ca.c)};                ca is still candidate; //still
0 0