COMP 3200 - Intro to Artificial Intelligence - Lecture 03 - Problem Solving + Search Algorithms
Watch on YouTube →
Overview
Dave Churchill develops a reusable framework for AI problem solving: define initial and goal states, legal actions, transition rules, and costs, then search a tree of nodes representing paths through the environment. He shows how breadth-first search, uniform-cost search, depth-first search, depth-limited search, and iterative deepening differ mainly in how they select nodes from the fringe, and compares their completeness, optimality, time, and memory costs. He closes by introducing graph search’s closed list, which prevents repeated state expansion but can compromise optimality if a better path to a visited state is discarded.
Key takeaways
- A search-tree node represents an entire path through the problem, not just its current environment state; parent pointers and stored actions make it possible to reconstruct the route to a goal.
- BFS minimizes the number of actions, not total cost: in Churchill’s weighted example, it can return a two-action path costing 11 even though a three-action path costs only 7.
- The shared search framework isolates the main difference between BFS and DFS in fringe selection: BFS removes the oldest node from a queue, while DFS removes the newest node from a stack.
- Iterative deepening runs depth-limited DFS at successively larger limits, achieving O(b^d) time and O(bd) space while finding the shallowest goal.
- A closed list prevents repeated state expansion and can reduce work from exponential tree growth to O(number of states), but discarding later paths to visited states can break cost optimality.
- Action depth and path cost are different quantities: depth counts actions, whereas g(n) sums their costs, so the shallowest solution is not necessarily the cheapest.
Chapters
- Dave Churchill distinguishes satisficing—finding any sequence that reaches a goal—from this course’s focus on minimizing path cost or maximizing performance.
- A solution can be an ordered sequence such as moving right, right, left, then up; action order can change the result.
- A travel agent starting in St. John’s might aim for either St. Anthony or Port aux Basques, subject to limits such as a week of travel or a $300 budget.
- Problem formulation translates an English task into states and actions an algorithm can reason about.
- For Newfoundland travel, towns connected by roads are a more useful state representation than every square meter of the province.
- The representation determines action granularity: moving between towns differs from moving one meter at a time, while a simple video-game map may work well as a grid.
- A problem specifies an initial state, legal actions, a transition or successor function, goal states or a goal test, and an action-cost function.
- Churchill assumes every action has cost greater than zero; path cost is the sum of the costs of the actions taken.
- A tourist may minimize travel time rather than distance: a longer highway route can be faster than a shorter, slower road.
- A solution is an ordered action path, and an optimal solution is any path with the lowest total cost; multiple paths can tie.
- In the example graph, A is the initial state, C is the goal, and an edge indicates a legal move whose label gives its cost.
- The example’s states are fully observable, static, discrete, deterministic, single-agent, and sequential.
- Churchill introduces search as a systematic way to explore possible action sequences and compare their costs.
- Search expands a node by generating a child for each legal action, then continues until it selects a goal or exhausts the available nodes.
- A search-tree node represents the path used to reach its current state; a node labeled B may encode A→D→B, not merely state B.
- The environment graph can be finite while the search tree is infinite: reversible moves such as A→B→A can generate an unbounded sequence of nodes.
- A search node can store its current state, parent pointer, incoming action, path cost g(n), and depth.
- Parent pointers and stored actions allow the algorithm to reconstruct a solution by walking backward from a goal and reversing the actions.
- The root has g(n)=0; a child’s cost is its parent’s cost plus the cost of the latest action.
- Depth counts actions, while g(n) totals their costs, so a two-action path can cost more than a three-action path.
- The fringe, later called the open list, contains generated nodes that have not yet been expanded; selecting and expanding one is the core search loop.
- General uninformed tree search initializes the fringe with a node for the initial state, checks for an empty fringe, selects a node by a strategy, tests its state for the goal, then adds its children.
- Uninformed or blind search uses only the problem definition and does not guide expansion toward the goal.
- Node expansion applies every legal action, creates successor nodes, and updates their parent, action, path cost, and depth.
- Completeness asks whether an algorithm is guaranteed to find a solution when one exists; optimality asks whether it is guaranteed to find a minimum-cost solution.
- Time complexity counts generated nodes, while space complexity measures the maximum number of nodes that must be stored.
- Search complexity commonly uses branching factor b and solution depth d; a full tree grows on the order of b^d, which is exponential.
- Uninformed search contrasts with informed or heuristic search, which uses estimates to prioritize promising nodes.
- Breadth-first search (BFS) expands every node at one depth before moving to the next, using a first-in, first-out queue for the fringe.
- BFS is complete and finds a shallowest goal, but it is not generally cost-optimal unless action costs are equal or path cost is nondecreasing with depth.
- In the weighted example, BFS can choose a two-action path costing 11 over a three-action path costing 7.
- BFS has O(b^d) time and space; with branching factor 10, depth 12 can require roughly 35 years of processing and 10 petabytes of memory under the lecture’s assumptions.
- Uniform-cost search (UCS) selects the fringe node with the smallest g(n), rather than the earliest-added node.
- With positive action costs, UCS is complete and optimal for varying costs; when all costs are equal, its behavior matches BFS.
- UCS is closely related to Dijkstra’s algorithm for finding a route to a single goal.
- Its time complexity is more complicated than BFS’s and is measured in terms of path cost; Churchill emphasizes that optimality can require additional computation.
- Depth-first search (DFS) selects the most recently added fringe node, typically using a last-in, first-out stack, and follows a branch as deeply as possible.
- When DFS reaches a dead end, it backtracks to an earlier branching point; reversible paths can instead send it into an infinite loop.
- DFS is not complete in unbounded search spaces and does not guarantee an optimal solution.
- Its worst-case time is O(b^m), where m is maximum depth, while its space use is O(bm) because it stores a narrow path rather than the full tree.
- Depth-limited search (DLS) adds a limit L and does not generate children beyond that depth.
- DLS stops DFS from following an infinite path, with time O(b^L) and space O(bL).
- A limit that is too small can miss a real solution—for example, a search limited to depth 10 cannot find a goal at depth 15.
- The limit introduces three distinguishable outcomes: finding a goal, exhausting the reachable search, or hitting the cutoff without knowing whether a deeper solution exists.
- Iterative deepening depth-first search repeatedly runs DLS with limits 1, 2, 3, and onward until it finds a solution or establishes failure.
- Because each iteration searches all shallower depths first, it is complete and finds the shallowest goal; it is cost-optimal when action costs are equal.
- Its time complexity remains O(b^d), while its space complexity is O(bd), like DFS.
- It repeats work at shallow levels—often generating about twice as many nodes in practice—but avoids BFS’s exponential memory requirement.
- The strategy comparison highlights BFS’s completeness, UCS’s cost optimality, DFS’s low memory use, and iterative deepening’s combination of shallow-goal coverage and DFS-like space.
- Tree search can revisit a state along many different paths, wasting work and potentially looping through reversible actions.
- Graph search adds a closed list of visited states; before expanding a node, it checks whether that node’s state has already been expanded.
- The open list stores candidate nodes, while the closed list stores states, commonly in a set, hash table, or dictionary for efficient lookup.
- With a closed list, each state is expanded at most once, reducing worst-case work to O(number of states) and limiting stored search data to the state-space scale.
- A closed list can sacrifice optimality if the first, more expensive path to a state is recorded and a later, cheaper path is prevented from revisiting it.
- For COMP 3200 Assignment 1, Churchill recommends following the course’s shared pseudocode framework: BFS and DFS differ primarily in queue-versus-stack fringe selection.
- The lecture recap restates the core formulation—initial state, goals, actions, and costs—and the four evaluation criteria: completeness, optimality, time, and space.
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Dave Churchill.