From 6a841f0c4e65c08484a31e96a9f86e81e4ae18b5 Mon Sep 17 00:00:00 2001 From: Mohamed Adel <124937844+MuhammedAdelTaha@users.noreply.github.com> Date: Fri, 24 Nov 2023 14:35:25 +0200 Subject: [PATCH] Update README.md --- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d9fc504..7783eb3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This project discusses the main differences between the different types of AI Se - Data Structure: Stack
- Completeness: Not complete
- Optimality: Not optimal
-- Time: O(b ^ m)
+- Time: O(bm)
- Space: O(b * m)
- b is the branching factor
- m is the maximum possible search tree depth
@@ -29,8 +29,8 @@ This project discusses the main differences between the different types of AI Se - Data Structure: Queue
- Completeness: Complete
- Optimality: Optimal
-- Time: O(b ^ s)
-- Space: O(b ^ s)
+- Time: O(bs)
+- Space: O(bs)
- b is the branching factor
- s is the level where the goal state is present
- BFS is not very well dealing with space
@@ -43,7 +43,7 @@ This project discusses the main differences between the different types of AI Se - Optimality: Optimal
- A* Search Always finds the optimal solution
- A* Search considers the past cost and the upcoming heuristic cost
-- Manhattan distance = |x1 - x2| + |y1 - y2| +- Manhattan distance = |x1 - x2| + |y1 - y2| # A* Search with Euclidean heuristic @@ -52,12 +52,59 @@ This project discusses the main differences between the different types of AI Se - Optimality: Optimal
- A* Search Always finds the optimal solution
- A* Search considers the past cost and the upcoming heuristic cost
-- Euclidean distance = sqrt((x1 - x2) ^ 2 + (y1 - y2) ^ 2) +- Euclidean distance = √((x1 - x2)2 + (y1 - y2)2) # Test Cases & Comparisons - - - - - - +

Test #1 (Input: 1 2 3 4 5 6 8 7 0) (Unsolvable test case)

+ +| | DFS | BFS | A* M | A* E | +| -------- | ------- | ------- | ------- | ------- | +| Cost | | | | | +| Depth | 66906 | 31 | 34 | 32 | +| Ex nodes | 181440 | 181440 | 181440 | 181440 | +| Time | 0.38774 | 0.67555 | 1.06707 | 1.32079 | + +

Test #2 (Input: 1 2 5 3 4 0 6 7 8)

+ +| | DFS | BFS | A* M | A* E | +| -------- | ------- | ------- | ------- | ------- | +| Cost | 157 | 3 | 3 | 3 | +| Depth | 157 | 3 | 3 | 3 | +| Ex nodes | 158 | 10 | 4 | 4 | +| Time | 0.0 | 0.0 | 0.0 | 0.0 | + +

Test #3 (Input: 1 0 2 7 5 4 8 6 3)

+ +| | DFS | BFS | A* M | A* E | +| -------- | ------- | ------- | ------- | ------- | +| Cost | 17881 | 23 | 23 | 23 | +| Depth | 17881 | 24 | 23 | 23 | +| Ex nodes | 18601 | 122117 | 2714 | 4306 | +| Time | 0.03459 | 0.42513 | 0.01753 | 0.03551 | + +

Test #4 (Input: 8 0 6 5 4 7 2 3 1)

+ +| | DFS | BFS | A* M | A* E | +| -------- | ------- | ------- | ------- | ------- | +| Cost | 57329 | 31 | 31 | 31 | +| Depth | 57329 | 31 | 31 | 31 | +| Ex nodes | 67802 | 181439 | 16582 | 35007 | +| Time | 0.13396 | 0.77618 | 0.10551 | 0.28074 | + +

Test #5 (Input: 1 4 2 6 5 8 7 3 0)

+ +| | DFS | BFS | A* M | A* E | +| -------- | ------- | ------- | ------- | ------- | +| Cost | 51618 | 8 | 8 | 8 | +| Depth | 51618 | 9 | 8 | 8 | +| Ex nodes | 59137 | 203 | 13 | 13 | +| Time | 0.11829 | 0.001 | 0.0 | 0.0 | + +

Observation

+ +- DFS has Longest paths and the least time in case of no solution + +- A* Manhattan time is less than time of A* Euclidean + - Reasoning: that Manhattan distance and Euclidean are both admissible but Manhattan distance is larger than Euclidean distance + +- A* Manhattan/Euclidean heuristics decreases the number of expanded nodes so much than in BFS.