Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Rock Boxers: Tabitha Greenwood Cameron Meade Noah Cahan

Similar presentations


Presentation on theme: "The Rock Boxers: Tabitha Greenwood Cameron Meade Noah Cahan"— Presentation transcript:

1 The Rock Boxers: Tabitha Greenwood Cameron Meade Noah Cahan
Pathfinding The Rock Boxers: Tabitha Greenwood Cameron Meade Noah Cahan

2 Introduction Pathfinding uses designed algorithms to optimizes the fastest route to a set endpoint from a set start point based off of distance. Three of the most commonly used algorithms used when it comes to pathfinding is Breadth First Search, Dijktra’s, and A*. They use heuristics to navigate through the nodes of a graph and find the fastest path to the end point based off of a distance cost.

3 Stating the problem informally
An object seeks to reach one point on a grid from another. This object will use three different algorithms to find pathways around various obstacles on a map. The size of the map will remain the same. The objective is to compare the ability of each algorithm to find the shortest path.

4 Formal statement Let K(V,E) be a graph with vertex set V={v_1,v_2,…,v_m} and edge set E={(v_i,v_j) | vi and v_j∈V, v_i != v_j}. M is the Map The gate set is the set that contains the starting point start and ending point finish within M. G = {start, finish} A path from start to finish is a sequence of distinct steps: {(d1, d2), (d2, d3), …, (dk-1, dk)} Where d1 = start and dk = finish. Our goal is to identify the shortest path (P_shortest) from start to finish within M(O, G). Where O is the obstructions Let P_all be the set of all possible path lengths within M from start to finish. P_all = {p1, p2, …, p_i}

5 Dijkstra’s Dijkstra’s algorithm begins at the starting point and checks every surrounding vertex. After checked the vertex is added to a set of checked vertices. This continues until it reaches the end point.

6 Dijkstra’s Continued At each step, the node in the unvisited set with the lowest distance from the start is examined. We calculate the tentative distances of all unvisited neighbors of the current node and compare them to the currently assigned value and use the smaller one. The algorithm selects the node with the shortest tentative distance and repeats the whole process again. U = Set of univisited nodes. V = Set of visited nodes. if U[ i ].dist < short{ //distance of current node. short = U[ i ].dist }

7 This algorithm starts at one node and repeatedly visits neighbors
This algorithm starts at one node and repeatedly visits neighbors. A “frontier” is the boundary between the evaluated and the not evaluated nodes. The frontier expands out from the original node until the whole graph has been evaluated. Breadth-first

8 A* The A* algorithm uses the distance formula to calculate a cost of movement and find the shortest path possible in a graph. O(n^2) based on code and loops within

9 A* Continued To evaluate f(n) = g(n) +h(n)
Where h(n) is the estimated cost from point to goal (distance from current node to end point) and g(n) is the cost from start to point(movement cost) To find h(n) Distance = √(dx²+dy²) Where x₂ = coordinate of the goal point, x₁ = coordinate of the current point, y₂ = coordinate of the goal point, and y₁ = coordinate of current point dx = |x₂ - x₁| dy = |y₂ - y₁|

10 A* Continued To implement this algorithm there are two lists created
Fringe : A set of points that are available to check. Initially only containing starting point. Graphically considered the “frontier”. Closed: A set of points already checked. Initially empty or only containing the points of the obstructions. Graphically considered the “interior”. Each node has a pointer to its parent to keep track of the path it takes. There is a loop that pulls the best node (n) in the fringe list and checks it. Determined best if (f) is lowest. If (n) is the goal the loop breaks. If not (n) is taken from the fringe list and added to the closed list. The nodes (n’) surrounding are then checked .If (n’) is in the closed set it is ignored.

11 Average Times (ran 100 times)
Column1 32x32 4x64 128x128 A* 0.0075 0.1445 breadth First 0.0737 dijktsra's 0.0414

12 Average Number of Calls (ran 100 times)
Column1 32x32 64x64 128x128 A* 7093 25529 161911 breadth First 5891 17883 87399 dijktra's 12906 79665 201593

13 Results Continued

14 Questions What is a heuristic?
a commonsense rule (or set of rules) intended to increase the probability of solving some problem When was Breadth First the quickest algorithm and why? In the smaller maps because it was faster to search the entire map then calculate the cost and search only part of the map. What is a greedy algorithm? an algorithmic paradigm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum. Why is A* the most accurate algorithm? It favors both the end point and start point When pathfinding on a graph what are the vertices used for? These are used to keep record of where to travel and where traveled.


Download ppt "The Rock Boxers: Tabitha Greenwood Cameron Meade Noah Cahan"

Similar presentations


Ads by Google