Pathfinding Algorithms: Fiona French
Pathfinding Algorithms: Fiona French
Fiona French
Recap
State space
Search tree
Search tree
Branch = action, node = state
Arad
Fagaras Riminicu
Search tree
Search tree
Branch = action, node = state
Is current state a goal?
If not EXPAND state
http://www.redblobgames.com/pathfinding/grids/graphs.html
Uninformed search (blind)
Breadth first
Uniform cost
Depth first
Depth limited
Iterative deepening depth first
Bidirectional
Uninformed search (blind)
Breadth first
FIFO - first in first out of the queue
Memory bigger problem than execution time
Uniform cost
Expands node with lowest path cost
Changes order of QUEUE
Depth first
LIFO
Backtracking search uses less memory
Uninformed search (blind)
Depth limited
Has a predetermined limit (no infinity)
What is the diameter of the problem?
Iterative deepening depth first
This limit gradually
increases
Bidirectional
Informed search (uses heuristic)
Best first search
Greedy best first search
A*
Best First Search
Node expanded based on evaluation function
f(n)
This function determines the search strategy
Includes heuristic h(n)
Heuristic = estimated cost of cheapest path
from state at node n to goal
Dijkstra’s Algorithm
"The question of whether computers can think is like the
question of whether submarines can swim."
path weight
heuristic
A*
Take into account an estimate of cost to target
Heuristic: eg. distance as the crow flies
Underestimate guarantees optimal path
Stops you heading in wrong direction
Heuristics
Example - 8 puzzle
h1
= number of misplaced tiles
h2 Manhattan
= sum of distances from goals
H2 dominates h1
Genetic algorithms
Measure fitness of each possibility
Use this to determine probability of selection
Randomly match 2 parents
Swap match (like DNA) for offspring
Random mutation
https://www.scientificamerican.com/article/brainless-slime-
molds/
Slime mould
Slime mould
http://www.youtube.com/watch?v=2UxGrde1NDA TED
Slime mould
http://www.wired.com/2013/06/slime-mold-computers/
http://phys.org/news/2014-01-slime-molds.html
https://gigaom.com/2014/04/04/how-slime-mold-can-design-transportation-netw
orks-and-maybe-even-transform-computing/
http://slimoco.ning.com/
A* tutorial links
More A* Tutorials
http://www.redblobgames.com/pathfinding/a-star/introduction.html
http://theory.stanford.edu/~amitp/GameProgramming/
http://www.policyalmanac.org/games/aStarTutorial.htm
Cat and bone tutorial:
www.raywenderlich.com/4946/introduction-to-apathfinding
http://wiki.gamegardens.com/Path_Finding_Tutorial
http://en.wikipedia.org/wiki/A%2a_search_algorithm
Vacuum cleaner world - C++ code
http://web.ntnu.edu.tw/~tcchiang/ai/Vacuum%20Cleaner%20World.htm
A* algorithm - C++ code
http://code.activestate.com/recipes/577457-a-star-shortest-path-algorithm/
Other examples / links
http://letsmakerobots.com/node/40756
http://qiao.github.io/PathFinding.js/visual/
http://www.yaldex.com/gamesprogramming/0672323699_ch12lev1sec7.html
http://www.redblobgames.com/pathfinding/tower-defense/
Pseudocode, very clear:
http://www.kirupa.com/forum/showthread.php?72863-Tutorial-PathFinding-
Algorithms-AI