gros_MidtermProject
Midterm Project of lecture "Advanced Introduction to C++, scientific computing and machine learning".
Wintersemester 2018/19
Supervisor: Emanuele Varriale
Pathfinding algorithms have to find the optimal path between two points on a map (1). A map can
be represented as a graph, the easiest way being "discretizing" the map into a grid: cells are nodes that
are connected, for example, with nearest neighbours.
In an unweighted graph one can use a Breadth first search algorithm to explore the graph, enumerate
all possible paths and then find the shortest paths to the targets (2).
The graph can also be weighted, representing, for example, the cost of walking over different terrains.
The Uniform Cost Search algorithm (4) (similar to Dijkstra's algorithm) takes the weights into account
by enumerating all possible paths, but prioritizing the ones with the least cost.
Another possibility is the greedy best first search (3), that has a heuristic measure of distance to the
target and first explore the paths with the least distance. One such heuristic on a square grid can be, for
example, the Manhattan distance d = |x1 - x2| + |y1 - y2| . It is faster than the other approaches but it
is not guaranteed to find the optimal solution.
The A* algorithm (5) also prioritizes the search but it combines the calculated distance and the
heuristic distance. With the right heuristic itfinds the optimal solution, but exploring less paths than
Uniform cost algorithm.
Your task is to implement these algorithms, compare the time performance, optimality of solution
on different kind of maps. You should consider maps with normal cells with weight 1, walls, i.e. cells
that cannot be visited, and, "forest" cells with weight 5. Use these elements to create interesting geometries
showing different behaviours of the algorithms. As an implementation detail, std::queue and
std::priority_queue can be used to store the nodes to visit next.
(1) Pathfinding
(2) Breadthfirst search
(3) Greedy best first
(4) Uniform cost search
(5) A* algorithm
After cloning the repository, or making changes in the sourcecode, just do
/gros_MidtermProject$ make
if this succeeds without errors, there will be an executable "pathfinder".