Kanishk Mishra-CS3346-Assignment 1
Kanishk Mishra-CS3346-Assignment 1
251173609
CS3346: Assigment 1
1. A* Search
a. Shortest Path using Djikstra’s algorithm S → T. The red represents the lowest cost
path to reach each state, the blue represents other paths as a point of comparison.
S A B C D T
0 2 6 4 6 14
Therefore, the shortest path with A* is S → C → D → T, where the distance cost g(n) is 17.
c. The results of (a) and (b) are different, specifically the difference is that (a) goes
through state B (S → C → B → T), while (b) goes through state D (S → C → D → T).
The reason for this is because h(B) has a substantially high value, while h(D) is tied
for the lowest h(s) value. Due to the h(B) value being so high it appeared easier to go
to T than to reach B, which resulted in the shorter path not being found. This is a
case of poor chosen heuristic values resulting in a suboptimal conclusion.
2. DFS, BFS, IDS
d. DFS Tree, the action Up occurs first (when possible) it will cycle endlessly:
e. IDS Tree:
3. S = ((3,1), (3,6), (8,6), (6,5), (7,2), (7,0)), f(s) = 5 + 5 + 2.24 + 3.16 + 2 + 4.12 = 21.52
a. The sample solution above with the operator can generate 6*5 = 30 paths by
swapping any one of 6 points, with one of the other 5 points in the list.
b. Subsets by swapping (8, 6) in initial, f(s) is length of path.
f(s) = 5 + 7.21 + 5.1 + 3.16 + 4.12 + 7.07 = 31.66 f(s) = 5 + 5.66 + 3.16 + 2.24 + 6.08 + 4.12 = 26.26
f(s) = 5 +3.16 + 2.24 + 4.12 + 2 + 4.12 = 20.64 f(s) = 7.07 + 5 + 3.16 + 3.16 + 2 + 4.12 = 24.51
Sl = ((3,1), (6,5), (3,6), (8,6), (7,2), (7,0)) Sr = ((3,1), (7,2), (6,5), (8,6), (3,6), (7,0))
f(Sl) = 5 + 3.16 + 5 + 4.12 + 2 + 4.12 = 23.4 f(Sr) = 5 + 2.24 + 3.16 + 4.12 + 4.12 + 7.21 = 25.85
n=2 n=6
Rl=? Rr=?
In the left image the route consists of the minimal number of crosses through the river, this
suggests that Rl is a positive value or a very small negative value that is not worth the extra travel to
collect. For this solution to work any single swap by the operator must have a higher or equal cost
than this, this can’t be the case as by swapping (6,5) and (3,6) we get the following:
This has a smaller travel path but an equal n so it should be better no matter what the value of Rl is.
In the right image n is maximized, every path crosses the river, so n must be a significant
negative value. Other variations of n=6 exist, but if we want to reduce length a smaller n value will
occur, the sample of this question is a good example of this. By swapping (3,6) and (7,2) we can turn
Sr into the sample S.
4n + 21.52 = 6n + 25.85
21.52 – 25.85 = 6n – 4n
-4.33 = 2n
-2.165 =n
This means that Rr must be less than -2.165 for Sr to be the solution.