Ejemplo n.º 1
0
    def __init__(self, src, dst, city, dimension, adjacency_list, heuristic_matrices):
        self.__src = src
        self.__dst = dst
        self.__city = city

        self.__open_list = []
        self.__closed_list = []
        self.__dimension = self.__dimension_index(dimension)

        self.__org_node = LoadData.load_org_node(city)
        self.__org_path = LoadData.load_org_path(city, 6)
        self.__link_table = adjacency_list
        self.__heuristic = heuristic_matrices
        # self.__heuristic = self.__calculate_heuristic()

        self.__dimension_cost, self.__heuristic_cost, self.__total_cost = ({} for _ in range(3))

        self.__dimension_cost = {node: float("inf") for node in self.__org_node.keys()}
        self.__dimension_cost[self.__src] = 0
        self.__heuristic_cost[self.__src] = self.__heuristic.loc[self.__src, self.__dst]
        self.__total_cost[self.__src] = \
            self.__heuristic_cost[self.__src] + self.__heuristic_cost[self.__src]

        self.__previous_node = {self.__src: None}

        heapq.heappush(self.__open_list, (self.__total_cost[self.__src], self.__src))
Ejemplo n.º 2
0
    def __init__(self, src, dst, dtype, location, dimension):
        self.src = int(src)
        self.dst = int(dst)

        self.org_node = LoadData.load_org_node(location)
        self.org_path = LoadData.load_org_path(location, dimension)
        self.link_table = LoadData.load_linking_table(location)
        # print('org_node', self.org_node)
        # print('org_path', self.org_path)
        # print('self.link_table', self.link_table)

        self.heap = Heap(dtype)
        self.quadrant = self.__get_quadrant(self.src, self.dst)