Optimization Problems in AI
- 39Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What distinguishes optimization problems from classical search problems?
What distinguishes optimization problems from classical search problems?
39 questions
- 1
What distinguishes optimization problems from classical search problems?
- A
Optimization problems focus on finding the best solution from a set of possibilities, while classical search focuses on finding a path from start to goal.
- B
Optimization problems always involve minimizing cost, while classical search always involves maximizing reward.
- C
Optimization problems are only applicable when the solution is obvious, while classical search finds unknown goals.
- D
Optimization problems require maintaining multiple paths simultaneously, while classical search maintains a single node.
Correct answer
AOptimization problems focus on finding the best solution from a set of possibilities, while classical search focuses on finding a path from start to goal.
Explanation
Optimization is about choosing the best option from a set of possible options, whereas classical search problems (like maze-solving) focus on the path from start to goal. Local search algorithms maintain a single state, not multiple paths.
- A
- 2
In local search, what is the primary focus of the algorithm?
- A
Using heuristics to estimate distance to the goal.
- B
Maintaining a single current state and moving to neighboring states.
- C
Building a complete search tree of all possible states.
- D
Exploring multiple paths simultaneously to find the goal.
Correct answer
BMaintaining a single current state and moving to neighboring states.
Explanation
Local search algorithms maintain only a single node (current state) and move to neighboring nodes, unlike classical search which maintains many paths. The focus is on the solution itself, not the path.
- A
- 3
What is the objective function in a maximization problem?
- A
A function that determines the neighbors of a state.
- B
A function that measures how good a state is, to be maximized.
- C
A function that measures the cost of a state, to be minimized.
- D
A function that checks whether a state is a goal state.
Correct answer
BA function that measures how good a state is, to be maximized.
Explanation
An objective function assigns a value to each state representing its quality; the goal is to find a state with the highest value. For minimization, it's called a cost function.
- A
- 4
In the houses and hospitals example, what does a neighbor state represent?
- A
Swapping the locations of two hospitals.
- B
Moving a hospital diagonally to any adjacent square.
- C
Adding or removing a hospital from the map.
- D
Moving one hospital one square left, right, up, or down.
Correct answer
DMoving one hospital one square left, right, up, or down.
Explanation
A neighbor is defined by taking one hospital and moving it one square in a cardinal direction (left, right, up, down). This creates a new configuration (state).
- A
- 5
What terminates the steepest-ascent hill climbing algorithm?
- A
When a predefined number of iterations is reached.
- B
When no neighbor has a better value than the current state.
- C
When the current state has the global maximum value.
- D
When the algorithm has explored all possible states.
Correct answer
BWhen no neighbor has a better value than the current state.
Explanation
Hill climbing stops when all neighbors have lower (for maximization) or higher (for minimization) values than the current state; it's stuck at a local optimum.
- A
- 6
What is a local maximum in a state-space landscape?
- A
A flat region where all neighboring states have the same value.
- B
The highest possible value in the entire state space.
- C
A state whose value is higher than any of its neighbors but not necessarily the global maximum.
- D
A state from which no uphill move is possible because all neighbors are lower.
Correct answer
CA state whose value is higher than any of its neighbors but not necessarily the global maximum.
Explanation
A local maximum is a state with higher value than all its neighbors, but it may not be the global maximum. Hill climbing can get stuck here.
- A
- 7
Which hill climbing variant chooses randomly among all higher-valued neighbors?
- A
Stochastic hill climbing
- B
First-choice hill climbing
- C
Random-restart hill climbing
- D
Steepest-ascent hill climbing
Correct answer
AStochastic hill climbing
Explanation
Stochastic hill climbing selects a random neighbor that is better than the current state, rather than the best one. This can sometimes avoid local optima.
- A
- 8
In random-restart hill climbing, what is the purpose of restarting?
- A
To increase the chance of finding a global optimum by exploring more neighbors per step.
- B
To combine the results of multiple runs to improve efficiency.
- C
To reduce the risk of getting stuck at a local optimum by trying multiple initial states.
- D
To ensure the algorithm terminates within a time limit.
Correct answer
CTo reduce the risk of getting stuck at a local optimum by trying multiple initial states.
Explanation
Random-restart runs hill climbing multiple times from different random starting states, then picks the best result. This reduces the chance of being trapped in a local optimum.
- A
- 9
What distinguishes a local beam search from standard hill climbing?
- A
Local beam search keeps track of k states instead of one, generating neighbors from all k and selecting the k best.
- B
Local beam search is deterministic and always finds the global optimum.
- C
Local beam search only considers neighbors with the highest value.
- D
Local beam search uses a beam of light to visualize the search space.
Correct answer
ALocal beam search keeps track of k states instead of one, generating neighbors from all k and selecting the k best.
Explanation
Local beam search maintains k current states. In each step, it generates all neighbors of all k states and selects the k best among them. This provides more exploration.
- A
- 10
What is the key idea behind simulated annealing?
- A
Sometimes accepting worse states to escape local optima, with probability decreasing over time.
- B
Repeating the search multiple times with different temperature settings.
- C
Always moving to the best neighbor, like steepest ascent.
- D
Using a quantum annealing process to find the global optimum.
Correct answer
ASometimes accepting worse states to escape local optima, with probability decreasing over time.
Explanation
Simulated annealing allows moves to worse states with a probability that depends on a temperature parameter. Temperature is high initially (more exploration) and decreases over time (less exploration). This helps avoid local optima.
- A
- 11
In simulated annealing, what does DeltaE represent?
- A
The number of iterations remaining.
- B
The difference in value between the neighbor and the current state (neighbor minus current).
- C
The energy of the current state after heating.
- D
The temperature at a given time t.
Correct answer
BThe difference in value between the neighbor and the current state (neighbor minus current).
Explanation
DeltaE (delta E) is the change in 'energy' which equals the neighbor's value minus the current state's value. Positive DeltaE means the neighbor is better.
- A
- 12
What is the acceptance probability for a worse neighbor in simulated annealing, based on the pseudocode?
- A
e^{-rac{Delta E}{t}} where t is the current temperature.
- B
e^{rac{Delta E}{t}} where t is the current temperature.
- C
rac{Delta E}{t}
- D
1 - rac{t}{T_{ ext{max}}}
Correct answer
Be^{rac{Delta E}{t}} where t is the current temperature.
Explanation
The probability of accepting a worse neighbor is eDeltaE/t, where DeltaE is negative (worse neighbor). Since DeltaE is negative, this value is between 0 and 1. Higher temperature and smaller (less negative) DeltaE increase acceptance probability.
- A
- 13
What is the traveling salesman problem (TSP)?
- A
Find the longest path through all cities without repeating any city.
- B
Find the minimal spanning tree connecting all cities.
- C
Find the shortest possible route that visits each city exactly once and returns to the start.
- D
Find the optimal placement of salesmen in different cities.
Correct answer
CFind the shortest possible route that visits each city exactly once and returns to the start.
Explanation
The TSP asks for the shortest Hamiltonian cycle (route visiting each city once and returning to the starting city). It is NP-complete, and local search can find good approximations.
- A
- 14
In TSP, a common neighbor definition uses which operation?
- A
Swapping two edges in the current tour (2-opt move).
- B
Reversing the order of a subsequence of cities.
- C
All of the above are valid neighbor definitions.
- D
Removing a city and inserting it elsewhere.
Correct answer
ASwapping two edges in the current tour (2-opt move).
Explanation
A common neighbor move is '2-opt': select two edges, remove them, and reconnect the tour by reversing a segment. This often reduces tour length.
- A
- 15
What is a linear programming problem?
- A
Finding the shortest path in a graph with linear edge weights.
- B
Solving a system of linear equations with integer solutions.
- C
Minimizing or maximizing a linear objective function subject to linear constraints.
- D
Training a linear regression model on a dataset.
Correct answer
CMinimizing or maximizing a linear objective function subject to linear constraints.
Explanation
Linear programming involves optimizing a linear function (cost or profit) under linear inequality and equality constraints. It has efficient algorithms like simplex and interior-point methods.
- A
- 16
In a linear program, the objective function is typically of the form:
- A
sumi=1n​ci​xi2​
- B
prodi=1n​ci​xi​
- C
c1​x1​+c2​x2​+dots+cn​xn​
- D
ec1​x1​+c2​x2​+dots+cn​xn​
Correct answer
Cc1​x1​+c2​x2​+dots+cn​xn​
Explanation
Linear programming uses linear objective functions: a sum of variables multiplied by coefficients. No squares, products, or exponentials.
- A
- 17
How can a constraint like 10x1​+12x2​geq90 be converted into a standard linear programming format?
- A
Multiply both sides by -1: −10x1​−12x2​leq−90.
- B
Add slack variables: 10x1​+12x2​−s=90.
- C
Subtract 90 from both sides: 10x1​+12x2​−90geq0.
- D
It cannot be converted; linear programming only handles leq constraints.
Correct answer
AMultiply both sides by -1: −10x1​−12x2​leq−90.
Explanation
Multiplying a geq constraint by -1 flips it to leq. Many linear programming solvers accept geq constraints directly, but converting to leq is common.
- A
- 18
Which algorithms can solve linear programming problems?
- A
Backtracking search and AC-3.
- B
Breadth-first search and A*.
- C
Hill climbing and simulated annealing.
- D
Simplex and interior-point methods.
Correct answer
DSimplex and interior-point methods.
Explanation
Simplex (which moves along edges of the feasible region) and interior-point methods are the most common linear programming algorithms.
- A
- 19
What is a constraint satisfaction problem (CSP)?
- A
A problem defined by a set of variables, each with a domain, and a set of constraints restricting variable values.
- B
A problem of satisfying all customer demands with limited resources.
- C
A problem that requires satisfying multiple objective functions simultaneously.
- D
A problem involving searching a graph with constraints on paths.
Correct answer
AA problem defined by a set of variables, each with a domain, and a set of constraints restricting variable values.
Explanation
A CSP consists of variables, domains (possible values for each variable), and constraints (restrictions on value combinations). The goal is to assign a value to each variable such that all constraints are satisfied.
- A
- 20
In the exam scheduling CSP, what are the variables?
- A
The exam days (Monday, Tuesday, Wednesday).
- B
The constraints between courses.
- C
The courses (A, B, C, D, E, F, G).
- D
The students (1, 2, 3, 4).
Correct answer
CThe courses (A, B, C, D, E, F, G).
Explanation
Variables are the courses that need to be scheduled. Their domain is the days (Monday, Tuesday, Wednesday). Constraints prevent two courses with a common student from being on the same day.
- A
- 21
What is a unary constraint?
- A
A constraint involving a single variable.
- B
A constraint involving exactly two variables.
- C
A constraint that must be satisfied for a correct solution.
- D
A constraint that is optional but preferred.
Correct answer
AA constraint involving a single variable.
Explanation
A unary constraint operates on one variable, e.g., 'A cannot be Monday'. It restricts the domain of that variable.
- A
- 22
What does it mean for a CSP to be node consistent?
- A
All binary constraints are satisfied for every pair of variables.
- B
Each variable's domain has at least one value.
- C
The constraint graph is connected.
- D
All values in each variable's domain satisfy that variable's unary constraints.
Correct answer
DAll values in each variable's domain satisfy that variable's unary constraints.
Explanation
Node consistency is achieved by removing from each variable's domain any value that violates a unary constraint on that variable. It ensures each domain is consistent with its own constraints.
- A
- 23
What is arc consistency?
- A
For every value in the domain of variable X, there exists a value in the domain of Y that satisfies the binary constraint between X and Y.
- B
All arcs in the constraint graph have the same cost.
- C
The constraint satisfaction problem has at least one solution.
- D
Variables are ordered such that all arcs point from higher-degree to lower-degree variables.
Correct answer
AFor every value in the domain of variable X, there exists a value in the domain of Y that satisfies the binary constraint between X and Y.
Explanation
Arc consistency for an arc (X,Y) means that for every value of X, there is some value of Y that satisfies the constraint. If not, the value of X is removed. AC-3 enforces this globally.
- A
- 24
What does the AC-3 algorithm do?
- A
Finds all solutions to a CSP using constraint propagation.
- B
Solves a CSP by backtracking search with inference.
- C
Enforces node consistency on each variable.
- D
Enforces arc consistency across the entire CSP by iteratively revising arcs.
Correct answer
DEnforces arc consistency across the entire CSP by iteratively revising arcs.
Explanation
AC-3 (Arc Consistency #3) maintains a queue of arcs. For each arc, it revises the domain of the first variable to be arc-consistent with the second. If changes occur, it re-adds arcs from neighbors. It runs until queue is empty or a domain becomes empty.
- A
- 25
What is the purpose of backtracking search for CSPs?
- A
To try assignments recursively, backtracking when a constraint is violated.
- B
To enforce arc consistency before any search.
- C
To find the globally optimal assignment using hill climbing.
- D
To generate all possible assignments and test them.
Correct answer
ATo try assignments recursively, backtracking when a constraint is violated.
Explanation
Backtracking search incrementally assigns values to variables. If an assignment leads to a violation, it undoes the assignment and tries another value. It is a depth-first search for CSPs.
- A
- 26
In backtracking search, after assigning a variable, what does the inference step typically do?
- A
Check if the current assignment is complete.
- B
Enforce arc consistency, possibly deducing new assignments or reducing domains.
- C
Select the next variable to assign.
- D
Order the values in the domain of the assigned variable.
Correct answer
BEnforce arc consistency, possibly deducing new assignments or reducing domains.
Explanation
Inference interleaved with backtracking uses propagation (like maintaining arc consistency) to reduce domains of unassigned variables. This can detect dead ends early and reduce search.
- A
- 27
What is the Minimum Remaining Values (MRV) heuristic?
- A
Choose the variable with the smallest domain (fewest legal values).
- B
Choose the variable with the largest domain (most legal values).
- C
Choose the variable with the highest degree in the constraint graph.
- D
Choose the value that rules out the fewest values for neighboring variables.
Correct answer
AChoose the variable with the smallest domain (fewest legal values).
Explanation
MRV selects the unassigned variable with the fewest remaining values. This reduces branching factor early, as a domain of size 1 forces the assignment.
- A
- 28
What is the degree heuristic?
- A
Choose the variable with the largest domain.
- B
Choose the variable that is least constrained.
- C
Choose the variable involved in the most constraints with other unassigned variables.
- D
Choose the value that leaves the most flexibility for future assignments.
Correct answer
CChoose the variable involved in the most constraints with other unassigned variables.
Explanation
The degree heuristic selects the variable with the highest degree (most constraints) among unassigned variables. This can be used as a tiebreaker for MRV. It helps constrain the search effectively.
- A
- 29
What is the Least Constraining Value (LCV) heuristic?
- A
Given a variable, choose the value that rules out the fewest choices for neighboring variables.
- B
Choose the variable with the smallest domain.
- C
Choose the value with the lowest index in the domain.
- D
Choose the value that is most likely to lead to a solution.
Correct answer
AGiven a variable, choose the value that rules out the fewest choices for neighboring variables.
Explanation
LCV orders values for a variable such that the value that eliminates the fewest options for other variables is tried first. This increases the chance of finding a solution without backtracking.
- A
- 30
Why does starting search with a high-degree variable like E in the exam scheduling problem often reduce backtracking?
- A
It is the least constrained variable, simplifying the search.
- B
It is the variable with the most values remaining.
- C
It has the largest domain, allowing more flexibility.
- D
It immediately constrains many other variables, pruning the search space.
Correct answer
DIt immediately constrains many other variables, pruning the search space.
Explanation
A high-degree variable is involved in many constraints. Assigning it restricts many other variables early, reducing the branching factor and potentially avoiding dead ends.
- A
- 31
What is a hard constraint in a CSP?
- A
A constraint that is optional and represents a preference.
- B
A constraint that must be satisfied for a solution to be valid.
- C
A constraint that involves more than two variables.
- D
A constraint that cannot be expressed mathematically.
Correct answer
BA constraint that must be satisfied for a solution to be valid.
Explanation
Hard constraints are mandatory; any valid assignment must satisfy all of them. Soft constraints are preferences and can be violated at a cost.
- A
- 32
In the traveling salesman problem, what is a common method to use local search?
- A
Use constraint satisfaction to assign each city a position in the tour.
- B
Use linear programming to minimize tour length.
- C
Use backtracking search to try all possible tours.
- D
Define states as tours, neighbors by operations like 2-opt, and use hill climbing or simulated annealing.
Correct answer
DDefine states as tours, neighbors by operations like 2-opt, and use hill climbing or simulated annealing.
Explanation
TSP can be formulated as a local search problem: states are possible tours, neighbors are tours that differ by a simple change (like swapping two edges), and the objective is to minimize total distance. Hill climbing or simulated annealing can find good solutions.
- A
- 33
In the hill climbing pseudocode, what does the function do when the best neighbor is not better than the current state?
- A
Move to the neighbor anyway to avoid local optima.
- B
Restart the algorithm with a new random state.
- C
Terminate the algorithm and declare failure.
- D
Return the current state.
Correct answer
DReturn the current state.
Explanation
Standard hill climbing does not accept worsening moves. If no neighbor is better, it stops and returns the current state, which is a local optimum.
- A
- 34
What does the 'revise' function do in the AC-3 algorithm?
- A
Removes all values from X's domain if no solution exists.
- B
Adds arcs to the queue for all neighbors of X.
- C
Makes variable X arc-consistent with respect to variable Y by removing values from X's domain that have no support in Y.
- D
Checks if X and Y are arc-consistent and returns a boolean.
Correct answer
CMakes variable X arc-consistent with respect to variable Y by removing values from X's domain that have no support in Y.
Explanation
Revise removes values from X's domain for which there is no value in Y's domain satisfying the binary constraint. It returns true if any value was removed.
- A
- 35
What is the effect of interleaving arc consistency with backtracking search?
- A
It ensures that the algorithm finds the global optimum.
- B
It increases the number of nodes visited because inference takes time.
- C
It reduces the search space by pruning inconsistent values early, potentially avoiding backtracking.
- D
It converts the CSP into a linear programming problem.
Correct answer
CIt reduces the search space by pruning inconsistent values early, potentially avoiding backtracking.
Explanation
Interleaving inference (like maintaining arc consistency) with search can detect dead ends earlier and reduce domains, leading to less backtracking and faster solutions.
- A
- 36
In the context of optimization, what is a 'cost function'?
- A
A function that maps a state to a value, which we seek to maximize.
- B
A function that determines how difficult it is to compute a solution.
- C
A function that calculates the distance between states.
- D
A function that maps a state to a cost, which we seek to minimize.
Correct answer
DA function that maps a state to a cost, which we seek to minimize.
Explanation
A cost function assigns a numerical cost to each state (e.g., distance, money). The goal is to find a state with the smallest cost.
- A
- 37
What is a 'plateau' in a state-space landscape?
- A
A valley that is the lowest point.
- B
A flat region of the state space where many neighboring states have the same value.
- C
A steep slope leading to a local optimum.
- D
A peak that is the highest point in the landscape.
Correct answer
BA flat region of the state space where many neighboring states have the same value.
Explanation
A plateau is an area where all neighboring states have equal value. Hill climbing can get stuck because no neighbor is strictly better, but it may be able to move sideways if allowed.
- A
- 38
In the production example (factory), what does the variable x1​ represent?
- A
The number of machines of type x1​ available.
- B
The number of hours machine x1​ is run.
- C
The cost per hour of running machine x1​.
- D
The number of units produced per hour by machine x1​.
Correct answer
BThe number of hours machine x1​ is run.
Explanation
Variables in linear programming represent decision quantities. Here x1​ is the runtime (hours) of machine x1​, and the objective is to minimize total cost 50x1​+80x2​.
- A
- 39
What is the purpose of the 'select_unassigned_variable' function in backtracking search?
- A
To enforce arc consistency for a specific variable.
- B
To select a value for the current variable.
- C
To choose which variable to assign next, often using a heuristic like MRV.
- D
To check if a variable is already assigned.
Correct answer
CTo choose which variable to assign next, often using a heuristic like MRV.
Explanation
This function picks an unassigned variable to assign next. Heuristics like MRV or degree heuristic can be used to make this choice efficiently.
- A

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