This is our project for Lab 1 - Searching algorithms of the course Introduction to AI at HCMUS.
Content:
In this project, we mentioned about 2 types of searching algorithms:
- Uninformed Search:
- Depth First Search (DFS)
- Breadth First Search (BFS)
- Uniform-Cost Search (UCS)
- Informed Search:
- Greedy Best First Search (GBFS)
- A*
About the maze, we have 3 types:
-
Normal maze: We need to find the optimal path from the START node (orange) and END node (blue).
-
Bonus maze: There will be some nodes with bonus point on the maze, called bonus nodes. The output path should have the cost as low as possible.
-
Intermediate maze: There will be some nodes that we have to reach before ending the path.
-
Teleport maze: This type of maze will have some teleport nodes (from
(x, y)
to(x', y')
and vice versa).
With Manhattan distance as heuristic function
With Euclidean distance as heuristic function
With Manhattan distance as heuristic function
With Euclidean distance as heuristic function
- We used A* algorithm with the following heuristic function, calculated on the current node
$n$ :
-
With:
-
Animated output examples below:
- Map #1:
- Map #2:
- We also used A* algorithm with the following heuristic function, calculated on the current node
$n$ :
-
With:
-
$Inters$ is the set of nodes, included all the intermediated nodes presented at the moment we calculated the value of$h(n)$ . -
$M(n, b)$ and$end$ are mentioned above.
-
-
Animated output examples below:
- Map #1:
- Map #2:
-
In this maze, when we are at node
$n$ with coordinate$(i,j)$ , we are able to reach up to 5 other nodes instead of 4, included$(i, j+1)$ ,$(i, j-1)$ ,$(i+1, j)$ ,$(i-1, j)$ , and$(i', j')$ is the relevant teleport nodes. -
We simply choose the BFS algorithm to search for the path in this scenario because it seems to work very well.
-
We also used A* algorithm with the following heuristic function, calculated on the current node
$n$ :
-
With:
-
$M(n, b)$ and$end$ are mentioned above. -
$t'$ is the teleport node paired with node$t$ . -
$Specials$ is the set of nodes, included all the teleport nodes and the END node (noted that this set included both node$t$ and node$t'$ ).
-
-
Animated output examples below:
- Map #1:
With BFS algorithm
With A* algorithm
- Map #2:
With BFS algorithm
With A* algorithm