-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab2_notes.txt
62 lines (47 loc) · 1.3 KB
/
lab2_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
initial state:
(0, 0) = 0 && (m, n) = 0 => by convention
(0 0 0 0 .... 0
0 0 0 0 .... 0
.
.
0 0 0 0 .... 0)
transition:
(1 0 0 0 .... 0
0 0 0 0 .... 0
.
.
0 0 0 0 .... 0)
transition:
(1 1 0 0 .... 0
0 0 0 0 .... 0
.
.
0 0 0 0 .... 0)
final state:
(1 1 0 0 .... 0
0 1 0 0 .... 0
.
.
0 0 1 1 .... 1) - a matrix representing valid a path from (0,0) to (m,n)
(0, 0) = 1 && (m, n) = 1
MAZE GENERATION:
mxn matrix with possible values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
1 - North
2 - South
4 - East
8 - West
e.g.: 7 = 1 + 2 + 4 => North, South, East are free to explore
9 = 1 + 8 => North, West are free to explore
=> this means it would be very easy to create a tree which sould explore all the possible routes
BACKTRACKING:
- create the tree and explore all the possible routes in order (in depth)
BFS:
- create the tree and explore all the possible routes in breadth-wise order
HILLCLIMBING:
- h(n) = abs(Xfininsh - Xcurrent) + abs(Yfinish - Ycurrent)
- h(n') = abs(Xfininsh - Xtarget) + abs(Yfinish - Ytarget)
SIMULATED ANNEALING:
- start with a score of mxn (i.e. for n=5 and m=6, initial score=30)
- loss applies if i am forced to make a "bad" move (all possible following states are "worse")
- loss value for h(n') < h(n) is h(n)-h(n')
- probability = e^(-loss/score)