Beispiel #1
0
    def __init__(self, s_start, s_goal, heuristic_type):
        self.s_start, self.s_goal = s_start, s_goal
        self.heuristic_type = heuristic_type

        self.Env = env.Env()
        self.Plot = plotting.Plotting(self.s_start, self.s_goal)

        self.u_set = self.Env.motions
        self.obs = self.Env.obs
        self.x = self.Env.x_range
        self.y = self.Env.y_range

        self.g, self.rhs, self.U = {}, {}, {}

        for i in range(self.Env.x_range):
            for j in range(self.Env.y_range):
                self.rhs[(i, j)] = float("inf")
                self.g[(i, j)] = float("inf")

        self.rhs[self.s_start] = 0
        self.U[self.s_start] = self.CalculateKey(self.s_start)
        self.visited = set()
        self.count = 0

        self.fig = plt.figure()
Beispiel #2
0
    def __init__(self, s_start, s_goal, eps, heuristic_type):
        self.s_start, self.s_goal = s_start, s_goal
        self.heuristic_type = heuristic_type

        self.Env = env.Env()  # class Env
        self.Plot = plotting.Plotting(s_start, s_goal)

        self.u_set = self.Env.motions  # feasible input set
        self.obs = self.Env.obs  # position of obstacles
        self.x = self.Env.x_range
        self.y = self.Env.y_range

        self.g, self.rhs, self.OPEN = {}, {}, {}

        for i in range(1, self.Env.x_range - 1):
            for j in range(1, self.Env.y_range - 1):
                self.rhs[(i, j)] = float("inf")
                self.g[(i, j)] = float("inf")

        self.rhs[self.s_goal] = 0.0
        self.eps = eps
        self.OPEN[self.s_goal] = self.Key(self.s_goal)
        self.CLOSED, self.INCONS = set(), dict()

        self.visited = set()
        self.count = 0
        self.count_env_change = 0
        self.obs_add = set()
        self.obs_remove = set()
        self.title = "Anytime D*: Small changes"  # Significant changes
        self.fig = plt.figure()
def main():

    problemFile = '/home/aifs1/gu/phd/research/workingPaper/realtime-nancy/worlds/gridPathfinding/exampleworlds/small-3.gp'
    # resultVisFile = '/home/aifs1/gu/phd/research/workingPaper/metareasoning/build_debug/onecommitvis.s3.json'
    # resultVisFile = '/home/aifs1/gu/phd/research/workingPaper/metareasoning/build_debug/lsslrtavis.s3.json'
    resultVisFile = '/home/aifs1/gu/phd/research/workingPaper/metareasoning/build_debug/dtrts.small-3.json'

    # problemFile = '/home/aifs1/gu/phd/research/workingPaper/realtime-nancy/worlds/gridPathfinding/exampleworlds/small-2.gp'
    # resultVisFile = '/home/aifs1/gu/phd/research/workingPaper/metareasoning/build_debug/onecommitvis.s2.json'
    # resultVisFile = '/home/aifs1/gu/phd/research/workingPaper/metareasoning/build_debug/allthewaycommitvis.s2.json'
    # resultVisFile = '/home/aifs1/gu/phd/research/workingPaper/metareasoning/build_debug/vistest.json'

    # system.run('cpp executable -vis resultvisfile < input')

    plot = plotting.Plotting(problemFile)

    path, visited, isKeepThinking, committed = parseVisFile(resultVisFile)

    print("path", path)
    print("visited", visited)
    print("isKeepThinking", isKeepThinking)
    print("committed", committed)

    # plot.animation_one(path, visited, "Fixed Strategy: Commit One")
    # plot.animation_alltheway(path, visited, "Fixed Strategy: Commit All")
    plot.animation_deepthinking(path, visited, isKeepThinking, committed,
                                "Our Approach")
Beispiel #4
0
    def __init__(self, s_start, s_goal):
        self.s_start, self.s_goal = s_start, s_goal

        self.Env = env.Env()
        self.Plot = plotting.Plotting(self.s_start, self.s_goal)

        self.u_set = self.Env.motions
        self.obs = self.Env.obs
        self.x = self.Env.x_range
        self.y = self.Env.y_range

        self.fig = plt.figure()
        self.OPEN = set()
        self.t = {}
        self.PARENT = {}
        self.h = {}
        self.k = {}
        self.path = []
        self.visited = set()
        self.count = 0

        for i in range(self.Env.x_range):
            for j in range(self.Env.y_range):
                self.t[(i, j)] = 'NEW'
                self.k[(i, j)] = 0.0
                self.h[(i, j)] = float("inf")
                self.PARENT[(i, j)] = None

        self.h[self.s_goal] = 0.0
Beispiel #5
0
    def __init__(self, s_start, s_goal, heuristic_type):
        self.s_start, self.s_goal = s_start, s_goal
        self.heuristic_type = heuristic_type

        self.Env = env.Env()  # class Env
        self.Plot = plotting.Plotting(s_start, s_goal)

        self.u_set = self.Env.motions  # feasible input set
        self.obs = self.Env.obs  # position of obstacles
        self.x = self.Env.x_range
        self.y = self.Env.y_range

        self.g, self.rhs, self.OPEN = {}, {}, {}
        self.parent = {}
        self.cknbr = {}
        self.ccknbr = {}
        self.bptr = {}
        self.init_table()

        for i in range(self.Env.x_range):
            for j in range(self.Env.y_range):
                self.rhs[(i, j)] = float("inf")
                self.g[(i, j)] = float("inf")
                self.bptr[(i, j)] = (i, j)

        self.rhs[self.s_goal] = 0.0
        self.OPEN[self.s_goal] = self.CalculateKey(self.s_goal)
        self.visited = set()
        self.count = 0
        self.fig = plt.figure()
Beispiel #6
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    BF = BestFirst(s_start, s_goal, 'euclidean')
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = BF.searching()
    plot.animation(path, visited, "Best-first Searching")  # animation
Beispiel #7
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    dfs = DFS(s_start, s_goal)
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = dfs.searching()
    plot.animation(path, visited, "Depth-first Searching (DFS)")  # animation
Beispiel #8
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    astar = Astar(s_start, s_goal, "euclidean")
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = astar.searching()
    plot.animation(path, visited, "A*")  # animation
Beispiel #9
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    dijkstra = Dijkstra(s_start, s_goal, 'None')
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = dijkstra.searching()
    plot.animation(path, visited, "Dijkstra's")  # animation generate
Beispiel #10
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    arastar = AraStar(s_start, s_goal, 2.5, "euclidean")
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = arastar.searching()
    plot.animation_ara_star(path, visited, "Anytime Repairing A* (ARA*)")
Beispiel #11
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    bfs = BFS(s_start, s_goal)
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = bfs.searching()
    plot.animation(path, visited, "Breadth-first Searching (BFS)")
Beispiel #12
0
def main():
    x_start = (5, 5)
    x_goal = (45, 25)

    bastar = BidirectionalAStar(x_start, x_goal, "euclidean")
    plot = plotting.Plotting(x_start, x_goal)

    path, visited_fore, visited_back = bastar.searching()
    plot.animation_bi_astar(path, visited_fore, visited_back, "Bidirectional-A*")  # animation
Beispiel #13
0
def main():
    s_start = (10, 5)
    s_goal = (45, 25)

    lrta = LrtAstarN(s_start, s_goal, 250, "euclidean")
    plot = plotting.Plotting(s_start, s_goal)

    lrta.searching()
    plot.animation_lrta(lrta.path, lrta.visited,
                        "Learning Real-time A* (LRTA*)")
Beispiel #14
0
def main():
    s_start = (10, 5)
    s_goal = (45, 25)

    rtaa = RTAAStar(s_start, s_goal, 240, "euclidean")
    plot = plotting.Plotting(s_start, s_goal)

    rtaa.searching()
    plot.animation_lrta(rtaa.path, rtaa.visited,
                        "Real-time Adaptive A* (RTAA*)")
Beispiel #15
0
def main():
    s_start = (5, 5)
    s_goal = (45, 25)

    dfs = DFS(s_start, s_goal, 'None')
    plot = plotting.Plotting(s_start, s_goal)

    path, visited = dfs.searching()
    visited = list(dict.fromkeys(visited))
    plot.animation(path, visited, "Depth-first Searching (DFS)")  # animation
Beispiel #16
0
    def __init__(self, s_start, s_goal):
        self.s_start, self.s_goal = s_start, s_goal

        self.Env = env.Env()
        self.plotting = plotting.Plotting(self.s_start, self.s_goal)

        self.u_set = self.Env.motions  # feasible input set
        self.obs = self.Env.obs  # position of obstacles

        self.OPEN = queue.QueuePrior()  # OPEN set
        self.OPEN.put(self.s_start, self.Heuristic(self.s_start))
        self.CLOSED = []  # CLOSED set / visited order
        self.PARENT = {self.s_start: self.s_start}
Beispiel #17
0
    def __init__(self, s_start, s_goal):
        self.s_start, self.s_goal = s_start, s_goal

        self.Env = env.Env()
        self.plotting = plotting.Plotting(self.s_start, self.s_goal)

        self.u_set = self.Env.motions                       # feasible input set
        self.obs = self.Env.obs                             # position of obstacles

        self.OPEN = queue.QueueFIFO()                       # OPEN set: visited nodes
        self.OPEN.put(self.s_start)
        self.CLOSED = []                                    # CLOSED set: explored nodes
        self.PARENT = {self.s_start: self.s_start}
Beispiel #18
0
    def __init__(self, s_start, s_goal):
        self.s_start, self.s_goal = s_start, s_goal

        self.Env = env.Env()
        self.plotting = plotting.Plotting(self.s_start, self.s_goal)

        self.u_set = self.Env.motions  # feasible input set
        self.obs = self.Env.obs  # position of obstacles

        self.g = {self.s_start: 0, self.s_goal: float("inf")}  # cost to come
        self.OPEN = queue.QueuePrior()  # priority queue / OPEN set
        self.OPEN.put(self.s_start, 0)
        self.CLOSED = []  # closed set & visited
        self.PARENT = {self.s_start: self.s_start}
    def __init__(self, s_start, s_goal):
        self.s_start = s_start
        self.s_goal = s_goal
        self.kp = 5.0
        self.eta = 400
        self.r = 30.0
        self.OL = 10
        self.rr = 2

        self.Env = env.Env()
        self.Plot = plotting.Plotting(s_start, s_goal)

        self.u_set = self.Env.motions  # feasible input set
        self.obs = self.Env.obs  # position of obstacles
        self.x = self.Env.x_range
        self.y = self.Env.y_range
    def __init__(self, s_start, s_goal):
        self.s_start, self.s_goal = s_start, s_goal

        self.Env = env.Env()
        self.Plot = plotting.Plotting(self.s_start, self.s_goal)

        self.u_set = self.Env.motions
        self.obs = self.Env.obs
        self.x = self.Env.x_range
        self.y = self.Env.y_range

        self.fig = plt.figure()

        self.OPEN = set()
        self.t = dict()
        self.PARENT = dict()
        self.h = dict()
        self.k = dict()
        self.path = []
        self.visited = set()
        self.count = 0