-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColocationPattern.py
More file actions
44 lines (43 loc) · 2.51 KB
/
ColocationPattern.py
File metadata and controls
44 lines (43 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from Point import PointGrid
from CoarseMBR import CoarseMBR
from HelpLib import TwoDimensionalDictionary
class ColocationPattern():
def __init__(self):
self.patternTypes = []
self.typeLabel = "!@#".join(self.patternTypes)
self.typeNumber = len(self.patternTypes)
self.instances = []
self.patternIndex = TwoDimensionalDictionary()
self.patternPrefixSum = []
self.participatingPoints = {} # <str, list<int>>
self.participationPointPrefixSum = {} # <str, [,]>
self.mbr = {} # <int, CoarseMBR>
self.mbrNum = 0
self.mbrIndex = TwoDimensionalDictionary() # {int:{int:list<int>}}
def AddHotspot(self, m_basePointGrid: PointGrid,
m_minRowIndex: int, m_minColumnIndex: int,
m_maxRowIndex: int, m_maxColumnIndex: int,
m_piThreshold: float,
m_activeCellIdxes: list, m_activeCellList, m_checkedNum: int):
mbrInstance = CoarseMBR()
if self.mbrIndex.ContainsKey(m_minRowIndex, m_minColumnIndex):
for mbrId in self.mbrIndex.dict[m_minRowIndex][m_minColumnIndex]: #mbrId -> int
if (self.mbr[mbrId].maxRowIndex == m_maxRowIndex) and (self.mbr[mbrId].maxColumnIndex == m_maxColumnIndex):
if (self.mbr[mbrId].checkedMBR == m_checkedNum) and (len(self.mbr[mbrId].preciseMBRList) != 0):
mbrInstance = self.mbr[mbrId]
mbrInstance.PreciseSearch(self.patternIndex, self.instances, m_basePointGrid,
m_piThreshold, m_activeCellIdxes, m_activeCellList, self.participatingPoints)
else:
return
if mbrInstance is None:
mbrInstance = CoarseMBR(self.mbrNum,
m_minRowIndex, m_minColumnIndex,
m_maxRowIndex, m_maxColumnIndex,
self.patternTypes, m_basePointGrid,
self.participationPointPrefixSum
)
if mbrInstance.maxParticipationIndex >= m_piThreshold:
mbrInstance.PreciseSearch(self.patternIndex, self.instances, m_basePointGrid,
m_piThreshold, m_activeCellIdxes, m_activeCellList, self.participatingPoints)
if len(mbrInstance.preciseMBRList) > 0:
for otherMinRow in