Understanding Utility Functions through the 4×4 N-Queens Problem
Compare Classical Search vs Local Search approachesPlace 4 queens on a 4×4 chessboard so that no two queens attack each other.
Backtracking approach:
Hill climbing approach:
Total Attacking Pairs
Goal: Minimize f(state) to 0 (no conflicts)
Local search cares about final solution quality, not the path taken to reach it.
Uses utility functions to measure and improve solution quality iteratively.
Requires constant memory regardless of problem size, unlike classical search.