Beispiel #1
0
    def ASTAR(self):
        # Time how long it takes to get a path
        results = Results()
        start = time.clock()
        results.path = self.__ASTAR(results)
        end = time.clock()

        # Determine results
        results.runningTime = end - start
        if results.path:
            results.problemsSolved = 1
            results.avgPathLen = self.getPathDistance(results.path)
        return results
Beispiel #2
0
    def IDS(self):
        # Time how long it takes to get a path
        results = Results()
        start = time.clock()

        depth = 1
        while depth <= len(self.cities) and not results.path:
            results.path = self.__DFS(results, depth)
            depth += 1
        end = time.clock()

        # Determine results
        results.runningTime = end - start
        if results.path:
            results.problemsSolved = 1
            results.avgPathLen = self.getPathDistance(results.path)

        return results