• Home
  • Textbooks
  • Artificial Intelligence. A Modern Approach [Global Edition]
  • Constraint Satisfaction Problems

Artificial Intelligence. A Modern Approach [Global Edition]

Stuart Russell, Peter Norvig

Chapter 6

Constraint Satisfaction Problems - all with Video Answers

Educators


Chapter Questions

01:35

Problem 1

How many solutions are there for the map-coloring problem in Figure 6.1? How many solutions if four colors are allowed? Two colors?

Christopher Stanley
Christopher Stanley
Numerade Educator
03:03

Problem 2

6.2 Consider the problem of constructing (not solving) crossword puzzles: ${ }^5$ fitting words into a rectangular grid. The grid, which is given as part of the problem, specifies which squares are blank and which are shaded. Assume that a list of words (i.e., a dictionary) is provided and that the task is to fill in the blank squares by using any subset of the list. Formulate this problem precisely in two ways:
a. As a general search problem. Choose an appropriate search algorithm and specify a heuristic function. Is it better to fill in blanks one letter at a time or one word at a time?
b. As a constraint satisfaction problem. Should the variables be words or letters?

Which formulation do you think will be better? Why?

Jennifer Hudspeth
Jennifer Hudspeth
Numerade Educator
02:17

Problem 3

Give precise formulations for each of the following as constraint satisfaction problems:
a. Rectilinear floor-planning: find non-overlapping places in a large rectangle for a number of smaller rectangles.
b. Class scheduling: There is a fixed number of professors and classrooms, a list of classes to be offered, and a list of possible time slots for classes. Each professor has a set of classes that he or she can teach.
c. Hamiltonian tour: given a network of cities connected by roads, choose an order to visit all cities in a country without repeating any.

AG
Ankit Gupta
Numerade Educator

Problem 4

Solve the cryptarithmetic problem in Figure 6.2 by hand, using the strategy of backtracking with forward checking and the MRV and least-constraining-value heuristics.

Check back soon!
03:01

Problem 5

Show how a single ternary constraint such as " $A+B=C$ " can be turned into three binary constraints by using an auxiliary variable. You may assume finite domains.Next, show how constraints with more than three variables can be treated similarly. Finally, show how unary constraints can be eliminated by altering the domains of variables. This completes the demonstration that any CSP can be transformed into a CSP with only binary constraints.

Sriram Soundarrajan
Sriram Soundarrajan
Numerade Educator
00:53

Problem 6

Consider the following logic puzzle: In five houses, each with a different color, live five persons of different nationalities, each of whom prefers a different brand of candy, a different drink, and a different pet. Given the following facts, the questions to answer are "Where does the zebra live, and in which house do they drink water?"
The Englishman lives in the red house.
The Spaniard owns the dog.
The Norwegian lives in the first house on the left.
The green house is immediately to the right of the ivory house.
The man who eats Hershey bars lives in the house next to the man with the fox.
Kit Kats are eaten in the yellow house.
The Norwegian lives next to the blue house.
The Smarties eater owns snails.
The Snickers eater drinks orange juice.
The Ukrainian drinks tea.
The Japanese eats Milky Ways.
Kit Kats are eaten in a house next to the house where the horse is kept.
Coffee is drunk in the green house.
Milk is drunk in the middle house.
Discuss different representations of this problem as a CSP. Why would one prefer one representation over another?

AA
Arwa Ali
Numerade Educator

Problem 7

Consider the graph with 8 nodes $A_1, A_2, A_3, A_4, H, T, F_1, F_2, A_i$ is connected to $A_{i+1}$ for all $i$, each $A_i$ is connected to $H, H$ is connected to $T$, and $T$ is connected to each $F_i$. Find a 3-coloring of this graph by hand using the following strategy: backtracking with conflict-directed backjumping, the variable order $A_1, H, A_4, F_1, A_2, F_2, A_3, T$, and the value order $R, G, B$.

Check back soon!
02:09

Problem 8

Explain why it is a good heuristic to choose the variable that is most constrained but the value that is least constraining in a CSP search.

Dominador Tan
Dominador Tan
Numerade Educator

Problem 9

Generate random instances of map-coloring problems as follows: scatter $n$ points on the unit square; select a point $X$ at random, connect $X$ by a straight line to the nearest point $Y$ such that $X$ is not already connected to $Y$ and the line crosses no other line; repeat the previous step until no more connections are possible. The points represent regions on the map and the lines connect neighbors. Now try to find $k$-colorings of each map, for both $k=3$ and $k=4$, using min-conflicts, backtracking, backtracking with forward checking, and backtracking with MAC. Construct a table of average run times for each algorithm for values of $n$ up to the largest you can manage. Comment on your results.

Check back soon!

Problem 10

Use the AC-3 algorithm to show that arc consistency can detect the inconsistency of the partial assignment $\{W A=r e d, V=b l u e\}$ for the problem shown in Figure 6.1.

Check back soon!

Problem 11

What is the worst-case complexity of running AC-3 on a tree-structured CSP?

Check back soon!
01:03

Problem 12

AC-3 puts back on the queue every arc $\left(X_k, X_i\right)$ whenever any value is deleted from the domain of $X_i$, even if each value of $X_k$ is consistent with several remaining values of $X_i$. Suppose that, for every arc $\left(X_k, X_i\right)$, we keep track of the number of remaining values of $X_i$ that are consistent with each value of $X_k$. Explain how to update these numbers efficiently and hence show that arc consistency can be enforced in total time $O\left(n^2 d^2\right)$.

Raj Bala
Raj Bala
Numerade Educator

Problem 13

The TREE-CSP-SOLVER (Figure 6.10) makes arcs consistent starting at the leaves and working backwards towards the root. Why does it do that? What would happen if it went in the opposite direction?

Check back soon!

Problem 14

We introduced Sudoku as a CSP to be solved by search over partial assignments because that is the way people generally undertake solving Sudoku problems. It is also possible, of course, to attack these problems with local search over complete assignments. How well would a local solver using the min-conflicts heuristic do on Sudoku problems?

Check back soon!
01:31

Problem 15

Define in your own words the terms constraint, commutativity, arc consistency, backjumping, min-conflicts, and cycle cutset.

KF
Kyle Findley
Numerade Educator

Problem 16

Suppose that a graph is known to have a cycle cutset of no more than $k$ nodes. Describe a simple algorithm for finding a minimal cycle cutset whose run time is not much more than $O\left(n^k\right)$ for a CSP with $n$ variables. Search the literature for methods for finding approximately minimal cycle cutsets in time that is polynomial in the size of the cutset. Does the existence of such algorithms make the cycle cutset method practical?

Check back soon!

Problem 17

Consider the problem of tiling a surface (completely and exactly covering it) with $n$ dominoes $(2 \times 1$ rectangles). The surface is an arbitrary edge-connected (i.e., adjacent along an edge, not just a corner) collection of $2 n 1 \times 1$ squares (e.g., a checkerboard, a checkerboard with some squares missing, a $10 \times 1$ row of squares, etc.).
a. Formulate this problem precisely as a CSP where the dominoes are the variables.
b. Formulate this problem precisely as a CSP where the squares are the variables, keeping the state space as small as possible.
c. Construct a surface consisting of 6 squares such that your CSP formulation from part (b) has a tree-structured constraint graph.
d. Describe exactly the set of solvable instances that have a tree-structured constraint graph.

Check back soon!