Optimization Problems in AI
- 40Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
- spaceFlip card
- KI knew it
- DI didn't know it
- ←Previous card
- →Next card
What is the key difference between local search and classical search algorithms like breadth-first search or A*?
Local search maintains only a single state and moves to neighboring states, while classical search maintains multiple paths simultaneously.
Or swipe the card
40 cards
What is the key difference between local search and classical search algorithms like breadth-first search or A*?
Local search maintains only a single state and moves to neighboring states, while classical search maintains multiple paths simultaneously.
In what types of problems is local search most applicable?
Problems where the path to the solution is irrelevant and only the final solution matters, such as facility location or the traveling salesman problem.
What is a state-space landscape?
A diagram where each vertical bar represents a state and its height represents the value of that state according to an objective or cost function.
What is an objective function and what is a cost function?
An objective function measures how good a state is (to be maximized). A cost function measures how bad a state is (to be minimized).
What is a global maximum and a global minimum in a state-space landscape?
A global maximum is a state with the highest value among all states; a global minimum is a state with the lowest value among all states.
What is the basic idea of the hill-climbing algorithm?
Start at an initial state, repeatedly move to the highest-valued neighbor (or lowest for minimization) until no neighbor is better, then terminate.
What is the pseudocode for the basic hill-climbing algorithm (steepest ascent)?
function HillClimb(problem): current = problem.initial_state while True: neighbor = highest-valued neighbor of current if neighbor.value <= current.value: return current current = neighbor
What are the limitations of basic hill climbing?
It can get stuck at local maxima/minima, plateaus (flat areas), and shoulders (flat areas with a slope).
What is steepest-ascent hill climbing?
A variant where from the current state, we consider all neighbors and move to the one with the highest value (for maximization) or lowest (for minimization).
What is stochastic hill climbing?
A variant where from the current state, we choose randomly from among all better neighbors, rather than picking the best.
What is first-choice hill climbing?
A variant where we generate neighbors one by one and move to the first neighbor that is better than the current state, without evaluating all neighbors.
What is random-restart hill climbing?
Repeatedly run hill climbing from random initial states, and keep the best result found across all runs.
What is the main idea of simulated annealing?
It sometimes accepts worse moves with a probability based on a temperature parameter that decreases over time, allowing escape from local optima.
How does the temperature schedule work in simulated annealing?
Temperature starts high (more likely to accept worse moves) and decreases over time (less likely to accept worse moves).
What is the acceptance probability for a worse move in simulated annealing?
eTΔE where ΔE is the change in value (negative for worse) and T is the current temperature.
In the pseudocode for simulated annealing, when do we always accept a neighbor?
When the neighbor is better than the current state (ΔE>0).
What is the traveling salesman problem (TSP)?
Find the shortest route that visits a set of cities exactly once and returns to the starting city.
Give an example of a neighbor definition for the traveling salesman problem in local search.
Swap two edges (2-opt): remove two edges and reconnect the path in a different way.
What is linear programming?
A method to optimize (minimize or maximize) a linear objective function subject to linear equality and inequality constraints.
What is the standard form of a linear program?
Minimize c1x1+c2x2+⋯+cnxn subject to constraints of the form ai1x1+⋯+ainxn≤bi and xj≥0.
How can a greater-than-or-equal-to constraint be converted to a less-than-or-equal-to constraint in linear programming?
Multiply both sides of the inequality by -1.
Name two algorithms for solving linear programs.
Simplex algorithm and interior-point methods.
In the scipy.optimize.linprog function, what information must be provided?
The coefficients of the objective function as an array, the coefficients of the inequality constraints as a matrix, and the upper bounds for each constraint as an array.
Define a constraint satisfaction problem (CSP).
A CSP consists of a set of variables X1,…,Xn, each with a domain of possible values, and a set of constraints that specify allowed combinations of values.
Give an example of a CSP from the lecture.
Exam scheduling: variables are courses, domain is exam days (Mon, Tue, Wed), constraints ensure no two courses with a common student have exams on the same day.
What is a unary constraint?
A constraint that involves only a single variable, e.g., A=Monday.
What is a binary constraint?
A constraint that involves two variables, e.g., A=B.
What is node consistency in a CSP?
All values in a variable's domain satisfy its unary constraints.
How do you enforce node consistency for a variable?
Remove from the variable's domain any value that does not satisfy a unary constraint.
What is arc consistency between two variables X and Y?
For every value x in X's domain, there exists some value y in Y's domain such that the binary constraint between X and Y is satisfied.
What does the Revise function do in the AC-3 algorithm?
It removes from X's domain any value that has no supporting value in Y's domain for the binary constraint. It returns true if the domain was changed.
What is the AC-3 algorithm for enforcing arc consistency?
Maintain a queue of arcs; while queue not empty: pop an arc (X,Y), call Revise, if revised and X's domain is empty return false, else add all arcs (Z,X) for Z in neighbors of X except Y to queue.
How can a CSP be formulated as a search problem?
States are partial assignments; actions assign a value to an unassigned variable; goal test checks if all variables are assigned and constraints satisfied; path cost is irrelevant.
What is backtracking search for CSPs?
A depth-first search that assigns values to variables one by one, and when a partial assignment violates constraints, it backtracks to the previous variable and tries a different value.
Give the pseudocode for the basic backtracking function.
function Backtrack(assignment, csp): if assignment is complete: return assignment var = SelectUnassignedVariable(csp, assignment) for value in OrderDomainValues(csp, var, assignment): if value is consistent with assignment: add {var=value} to assignment result = Backtrack(assignment, csp) if result != failure: return result remove {var=value} from assignment return failure
What is the purpose of interleaving inference (like arc consistency) with backtracking search?
Every time we make an assignment, we enforce arc consistency to reduce domains and deduce new forced assignments, reducing the search space.
What is the Minimum Remaining Values (MRV) heuristic?
Select the unassigned variable with the smallest domain (fewest remaining values).
What is the degree heuristic for variable selection?
Select the unassigned variable that is involved in the most constraints with other unassigned variables (highest degree).
What is the Least Constraining Value (LCV) heuristic?
When ordering values for a variable, choose the value that rules out the fewest choices for neighboring variables.
In the exam scheduling example, why did starting with variable E (highest degree) avoid backtracking?
E has the most constraints (with B, D, F, C), so assigning it early greatly restricts other variables, often reaching a solution without backtracking.

Ask anything
We've read this whole study set, so questions about it get the best answers.