Midterm Review - Department of Computer Science, …lyan/csc384/Midterm Review.pdfMidterm Review...
Transcript of Midterm Review - Department of Computer Science, …lyan/csc384/Midterm Review.pdfMidterm Review...
Midterm Review
Exam time: 3:15-4:45 (90 minutes) (no aids allowed)
Search o Uninformed search: BFS, UCS, DFS, Depth-limited, Iterative Deepening depth-first search
§ How to perform: search order criteria § Evaluation: criteria
Criterion BFS UCS DFS
Complete? Y(i) Y(ii) N
Optimal? Y Y N
Time O(bd) O(b1+[C*/ε]) O(bm)
Space O(bd) O(b1+[C*/ε]) O(bm)
o Heuristic search: v Greedy best-first search:
Always expand node with lowest h-value v A*:
§ f = g + h § Properties:
o Admissibility: h <= h* (optimistic) o Monotonicity: h(n1) <= c(n1,n2) + h(n2) (triangle inequality) o Simple proof: i.e. f value non-decreasing, etc.
b: maximum branching factor of the search tree d: depth of the least-cost solution m: maximum depth of the state space (may be ∞) i: complete if b is finite; ii: complete if step costs ≥ ε (positive ε)
Example: Trace the execution of A* for the graph shown below.
• Show the successive configurations of the frontier where the elements on the frontier are paths. That is, the path n1 -> n2 -> n3 would be written [n1,n2,n3]. Under each element of the frontier, indicate the f, g and h values of the final node in the path (e.g., if g(m) = 5 and h(m) = 7 write “12=5+7” underneath m, Remember to get the order right, g(m) followed by h(m).
• Indicate the path that is expanded at each stage.
• Finally show the path to the goal found by A*.
• Is the heuristic admissible? Is it monotonic?
A
B
C
E
D
G
F
J
H
K
L
0+9=9
1+4=4
1+5=6
2+3=5
2+3=5
3+2=5
2+7=9
4+0=4
3+10=13
3+5=8 3+7=10
3+8=11
I
A: 9 G: 3 B: 4 H: 5 C: 5 I: 8 D: 7 J: 2 E: 3 K: 0 F: 10 L: 7
CSP o Problem formalization:
§ Variables: definition § Domain: possible values § Set of constraints (variable scopes): Binary/higher-order constraints
Example: Sudoku § Variables: V11, V12, …, V21, V22, …, V91, …, V99 § Domains:
o Dom[Vij] = {1-9} for empty cells o Dom[Vij] = {k} a fixed value k for filled cells.
§ Constraints: o Row constraints:
§ All-Diff(V11, V12, V13, …, V19) § All-Diff(V21, V22, V23, …, V29) § ...., All-Diff(V91, V92, …, V99)
o Column Constraints: § All-Diff(V11, V21, V31, …, V91) § All-Diff(V21, V22, V13, …, V92) § ...., All-Diff(V19, V29, …, V99)
o Sub-Square Constraints: § All-Diff(V11, V12, V13, V21, V22, V23, V31, V32, V33) § All-Diff(V14, V15, V16,…, V34, V35, V36)
o Forward Checking algorithm: with heuristics
§ Minimum Remaining Values (MRV) § Generalized Arc Consistency (GAC):
Enforced GAC during search, prune all GAC inconsistent values GAC enforced example:
Domains: Dom[X, Y, Z]={1,2,3,4} Dom[W] = {1,2,3,4,5} Constraints: C1: X = Y + Z C2: W > X C3: W =X+Z+Y Give the resultant GAC consistent variable values.
Games o General sum game: i.e. two-player
§ Min-max strategy § Min-max game search tree: alpha-beta pruning
§ Alpha cuts § Beta cuts
Example: game tree search (slides 38 in week 5)