AI Search · Exam notes

AO*: AND-OR Graphs, Expansion Order, S Values

One AO* comprehension per paper, three sub-questions on one graph: first three nodes expanded? S value after each? final S? One chain answers all: expand down the marked best path, AND sums, OR takes min, backpropagate to S.

Points 1 to 3 are the rules. Point 4 applies them to the 2024T2 graph. Point 5 has three more graphs to solve with a pen.

1. AND-OR graphs in one table

NodeMeaningCost rule
AND (arc joins its edges)all children neededsum over children of (edge + child value)
OR (no arc)one child neededmin over children of (edge + child value)
Primitive (double circle)already solved, never expandedits value is actual cost

Each node carries a heuristic \(h\). Unexpanded nodes use \(h\); expanded nodes recompute from children; primitives use actual cost. Edge cost is stated per question (2 units in all four graphs below, always recheck).

2. The AO* loop

  1. Expand S first. Recompute its value from its options and mark the cheapest option.
  2. Next expansion: walk down the marked option to the first unsolved node and expand it. At an AND group with two unsolved branches, take the highest cost branch first (tie-breaker 2).
  3. Recompute the expanded node (AND sums, OR mins), then backpropagate up to S. Re-mark the cheapest option at every ancestor.
  4. Ties in cost anywhere: smaller node label first (tie-breaker 1). Stop when S is solved through solved children.

3. What the three questions want, plus the fourth

  1. First three expanded: always starts with S, then two nodes found by walking the marked path. Primitives are never expanded.
  2. S after 1st, 2nd, 3rd: write down S right after each backpropagation. Three numbers, in order.
  3. Final S: keep expanding down the marked path until every node on it is solved. The last S is the answer.
  4. Admissible or not (asked in some papers): \(h\) is admissible iff \(h(n)\) never exceeds the true cheapest cost of solving \(n\), for every node. Solve the graph first, then check each \(h\) against its true cost. One violation means inadmissible.

Official keys seen on four papers: admissible twice, inadmissible twice; the sometimes admissible option was never the key. On all four graphs below, every \(h\) sits at or below its true cost (checked by script), so each of them is admissible: 2024T2 FN (S 10 against 56, C 10 against 56, B 10 against 44), 2024T1 FN (B 30 against 36 is the tightest), 2024T3 FN (E 12 against exactly 12 is the tightest), 2024T3 AN (B 8 against 16, E 10 against 12).

4. Worked example: 2024T2 FN, Q65 to Q67

4a. The graph as a table (solve from this, then check the animation)

NodehType and options (edge cost 2)Children
S10OR over [ AND(A,B), C ]A, B, C
A14OR over [ D, E ]D, E
B10AND over [ E, F ]E, F
C10AND over [ F, G ]F, G
D40 primsolved-
E20 primsolved-
F20 primsolved-
G32 primsolved-

Cover the animation. Expand three nodes down the marked path and track S after each. Official answers: S,C,A; 12,28,36; 56.

4b. Animation: values update, best path in thick lines

Step 0 | double ring = primitive (solved), black = expanded, outline = current, thick edge = marked best option, small arc = AND group

Why this step

S value tracker

4c. The three questions

AND-OR graph above, edge cost 2. Tie-breaker 1: node labels. Tie-breaker 2: AND takes the highest cost unsolved branch.

  1. First three nodes expanded, including S, in order. Primitives are not expanded.
  2. S value after the 1st, 2nd and 3rd expansion.
  3. Final value of S.

4d. Solution

  1. Expand S. Options: AND(A,B) = (2+14)+(2+10) = 28; C = 2+10 = 12. S = 12 via C.
  2. Expand C (on the marked path). C = AND(F,G) = (2+20)+(2+32) = 56. Backprop: S = min(28, 56) = 28 via AND(A,B).
  3. Expand A. Marked AND branches cost A: 2+14 = 16 vs B: 2+10 = 12. Highest first: A. A = OR = min(2+40, 2+20) = 22 via E. AND(A,B) = (2+22)+(2+10) = 36. S = min(36, 56) = 36. First three: S,C,A. S values: 12,28,36.
  4. Finish. A solved via E; expand B: B = AND(E,F) = (2+20)+(2+20) = 44. AND(A,B) = (2+22)+(2+44) = 70. S = min(70, 56) = 56 via C, all solved. Final: 56.

5. Practice: three more graphs

Expand three nodes down the marked path, track S after each, then run to termination with a pen before opening the answer.

Graph P1: 2024T1 FN, Q108 to Q110 (edge cost 2)

NodehType and optionsChildren
S10OR over [ A, B ]A, B
A20AND over [ C, D, G ]C, D, G
B30OR over [ E, F ]E, F
E20AND over [ G, H ]G, H
F40AND over [ H, I ]H, I
C20 primsolved-
D30 primsolved-
G10 primsolved-
H20 primsolved-
I30 primsolved-

Q: First three expanded? S after 1st, 2nd, 3rd? Final S?

Step 0

Why this step

S value tracker

Answer P1 (all official)

S,A,B; 22,32,24; 38. Expand S: A costs 2+20 = 22, B costs 2+30 = 32. S = 22 via A. Walk the marked path to A, expand it: A = AND(C,D,G) = (2+20)+(2+30)+(2+10) = 66. S = min(2+66, 2+30) = min(68, 32) = 32 via B. Marked path to B, expand it: B = OR = min(2+20, 2+40) = 22 via E. S = min(68, 2+22) = min(68, 24) = 24. Finish: E unsolved on the marked path, expand it: E = AND(G,H) = (2+10)+(2+20) = 34. B = min(2+34, 2+40) = 36 via E. S = min(68, 2+36) = 38, all solved.

Graph P2: 2024T3 FN, Q74 to Q76 (edge cost 2)

NodehType and optionsChildren
S10OR over [ AND(A,B), C ]A, B, C
A8OR over [ D, E ]D, E
B10OR over [ E, I, F ]E, I, F
C14AND over [ F, G ]F, G
D16OR over [ H ]H
E12OR over [ H, I ]H, I
F20AND over [ I, J ]I, J
G10OR over [ J ]J
H20 primsolved-
I10 primsolved-
J10 primsolved-

Q: First three expanded? S after 1st, 2nd, 3rd? Final S?

Step 0

Why this step

S value tracker

Answer P2 (all official)

S,C,B; 16,22,24; 30. Expand S: AND(A,B) = (2+8)+(2+10) = 22; C = 2+14 = 16. S = 16 via C. Marked path to C, expand it: C = AND(F,G) = (2+20)+(2+10) = 34. S = min(22, 34) = 22 via AND(A,B). Marked AND branches cost A: 2+8 = 10 vs B: 2+10 = 12. Highest first: expand B. B = OR = min(2+12, 2+10, 2+20) = 12 via I. AND = (2+8)+(2+12) = 10+14 = 24. S = min(24, 34) = 24. Finish: marked AND, B solved via I, A unsolved: expand A: A = OR = min(2+16, 2+12) = 14 via E. AND = (2+14)+(2+12) = 16+14 = 30. Marked AND, A via E unsolved: expand E: E = OR = min(2+20, 2+10) = 12 via I. A = min(18, 14) = 14, solved. AND = 30, both solved. S = min(30, 34) = 30, solved.

Graph P3: 2024T3 AN, Q74 to Q76 (edge cost 2)

NodehType and optionsChildren
S10OR over [ AND(A,B), C ]A, B, C
A10OR over [ D, E ]D, E
B8OR over [ E, F ]E, F
C14AND over [ F, G ]F, G
D16OR over [ H ]H
E10OR over [ H, I ]H, I
F20AND over [ I, J ]I, J
G10OR over [ J ]J
H20 primsolved-
I10 primsolved-
J10 primsolved-

Q: First three expanded? S after 1st, 2nd, 3rd? Final S?

Step 0

Why this step

S value tracker

Answer P3 (all official)

S,C,A; 16,22,24; 32. Expand S: AND(A,B) = (2+10)+(2+8) = 22; C = 2+14 = 16. S = 16 via C. Marked path to C, expand it: C = AND(F,G) = (2+20)+(2+10) = 34. S = min(22, 34) = 22 via AND(A,B). Marked AND branches cost A: 2+10 = 12 vs B: 2+8 = 10. Highest first: expand A. A = OR = min(2+16, 2+10) = 12 via E. AND = (2+12)+(2+8) = 14+10 = 24. S = min(24, 34) = 24. Finish: marked AND, A via E unsolved: expand E: E = OR = min(2+20, 2+10) = 12 via I. A = min(18, 14) = 14, solved. AND = (2+14)+(2+8) = 16+10 = 26. S = min(26, 34) = 26. Marked AND, A solved, B unsolved: expand B: B = OR = min(2+12, 2+20) = 14 via E. AND = 16+(2+14) = 16+16 = 32. S = min(32, 34) = 32, all solved.

6. Exam checklist (write this on the rough sheet)

  1. Read edge cost, both tie-breakers, and mark AND arcs before computing anything.
  2. Expand S first. Recompute with AND sums and OR mins, mark the cheapest option.
  3. Each next expansion: walk the marked option down; at an AND split take the highest cost unsolved branch; ties by label.
  4. Write S down after every backpropagation. That list is two of the three answers.
  5. Stop when the marked option runs only through solved nodes. That S is final.