-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnotes.txt
More file actions
52 lines (39 loc) · 1.45 KB
/
notes.txt
File metadata and controls
52 lines (39 loc) · 1.45 KB
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
How to solve a problem:
{
0: Don't Panic,
1: What are the inputs?,
2: What are the outputs?,
3: Work through some examples by hand (future test cases),
4: Simple mechanical solution,
5: Develop incrementally and test as you go
}
Don't optimize prematurely!
Definition of a Problem
- Initial State
- Actions(s)
- Result
- Goal Test(s)
- Path Cost
- Step Cost
Example with Problem: flight from Arad to Bucharest
Initial State: in Arad
Goal Test: True if in Bucharest
Actions: Follow path to connected city
Arad: 0, Zerind: 1, Sibiu: 1, Rimnicu: 2, etc.
Uniform Cost Search (cheapest path first)
- pick the path with lowest cost
- keep going and summing subtotal costs
- explored, frontier, unexplored
https://www.youtube.com/watch?time_continue=1&v=MoyBcrw-n_M
Uniform Cost search
- expands out equally in all directions, may expend additional effort getting to a fairly direct path to the goal.
Greedy best-first search
- expands outward toward locations estimated as closer to the goal. If a direct path is available, expends much less effort than Uniform Cost; however, it does not consider any routes in which it may need to temporarily take a further away path in order to arrive at an overall shorter path.
A* Search
- utilizes both of these - will try to optimize with both the shortest path and the goal in mind.
A* Search
f = g + h
g(path) = path cost
h(path) = h(state) = estimated distance to goal
minimize g: keeps path short
minimize h: keeps focus on goal