Search Problem Formulation
Context: FIT1061_MOC Β· Block Aβs shared vocabulary (AI Algorithm Blocks (Search, Uncertainty, Learning)) β every W2βW5 algorithm inherits this structure and differs only in strategy
Quick Revision
- π― Objective: name states Β· actions Β· successor Β· goal test β any puzzle, route or game collapses to a Graph one algorithm can search.
- β οΈ Key Constraint: the tree is never built β states are generated on demand, because makes storage impossible past trivial depth.
π Core
- States β configurations of the world β a board position, a grid cell, a road intersection.
- Actions β legal transitions out of a state β a legal chess move, a tile slide, driving one edge.
- Successor function β which state lands in; the only operation an algorithm needs is given a node, return its neighbours.
- Goal test β predicate deciding βdoneβ β checkmate? tiles sorted? at ?
- Path cost β price of the route taken; uniform per step this week β edge weights and arrive with weighted search.
- Game tree β node state, edge action, root start position, leaf state with no move left (someone wins, or the board is full).
- Branching factor β actions available per state β depth- level holds states.
- Grids are graphs β each walkable cell is a node, each edge a step to a -neighbour; walls are simply nodes that do not exist. Direction is irrelevant β the graph is undirected.
Three instantiations
| Problem | States | Actions | Goal test | Cost |
|---|---|---|---|---|
| 8-puzzle | tile configurations | slide blank up/down/left/right | tiles in sorted order? | per slide |
| GPS routing | intersections β | drive along an edge | at ? | edge travel time |
| Chess | board positions | legal moves () | checkmate? | per move |
Why the tree explodes
| Depth | Tic-tac-toe (shrinking ) | Chess () |
|---|---|---|
| full / | (whole game) |
- Solved vs unsearchable β at ops/s all tic-tac-toe leaves take s β tic-tac-toe is solved; takes years, and a real game runs moves deep.
- Consequence β exhaustive checking is off the table β every later algorithm is a rule for deciding what to explore first.
β οΈ Common Mistakes
- π‘ Formulating the algorithm, not the problem β βuse BFSβ earns nothing; marks come from naming states, actions and goal test for this domain.
- π‘ Reading as the tree size β is the count at one depth; the tree to depth is , dominated by the last layer.
- π‘ Assuming constant β tic-tac-toeβs branching shrinks (); is an average, and the chess figure is an estimate.
π§ Active Recall
Why does one formulation cover chess, the 8-puzzle and GPS routing β three problems with nothing physical in common?
Answer
- Short answer: the algorithm never sees the domain, only the successor function.
- Why: Interface, not content β BFS asks exactly one question β given this node, what are its neighbours? β so any domain that can answer it is searchable. The four parts are that interface β states supply the nodes, actions plus successor supply the edges, the goal test supplies termination, path cost supplies the ranking. Swapping chess for a grid changes the neighbour lookup and nothing else.
Deep Blue evaluated positions per second and still could not search a chess game to the end. Why is more hardware not the fix?
Answer
- Short answer: the tree grows exponentially in depth, hardware grows linearly.
- Why: Exponent beats constant β each extra ply multiplies the work by , so a faster machine buys one extra move of lookahead. Depth of a -move game is positions β years at nodes/s, and the full game is unimaginably larger. The escape is a better strategy β heuristics and pruning β not a bigger machine.