forked from ajenningsfrankston/arc_challenge_arga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpriority_item.py
21 lines (20 loc) · 894 Bytes
/
priority_item.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class PriorityItem(object):
"""
storing information of a node in the search tree
the sequence of filters and transformations used to arrive at an abstracted graph is stored as the data,
instead of the abstracted graphs themselves
"""
def __init__(self, data, abstraction, priority, secondary_priority=0, name=0):
self.data = data
self.abstraction = abstraction
self.priority = priority
self.secondary_priority = secondary_priority
self.name = name
def __lt__(self, other):
if self.priority == other.priority:
if self.secondary_priority == other.secondary_priority:
return len(self.data[0]["filters"]) < len(other.data[0]["filters"])
else:
return self.secondary_priority < other.secondary_priority
else:
return self.priority < other.priority