foundations of computational agents
The third edition of Artificial Intelligence: foundations of computational agents, Cambridge University Press, 2023 is now available (including full text).
Consider the crossword puzzle shown in Figure 4.14.
You must find six three-letter words: three words read across (1-across, 4-across, 5-across) and three words read down (1-down, 2-down, 3-down). Each word must be chosen from the list of 18 possible words shown. Try to solve it yourself, first by intuition, then by hand using first domain consistency and then arc consistency.
There are at least two ways to represent the crossword puzzle shown in Figure 4.14 as a constraint satisfaction problem.
The first is to represent the word positions (1-across, 4-across, etc.) as variables, with the set of words as possible values. The constraints are that the letter is the same where the words intersect.
The second is to represent the nine squares as variables. The domain of each variable is the set of letters of the alphabet, . The constraints are that there is a word in the word list that contains the corresponding letters. For example, the top-left square and the center-top square cannot both have the value , because there is no word starting with .
Give an example of pruning due to domain consistency using the first representation (if one exists).
Give an example of pruning due to arc consistency using the first representation (if one exists).
Are domain consistency plus arc consistency adequate to solve this problem using the first representation? Explain.
Give an example of pruning due to domain consistency using the second representation (if one exists).
Give an example of pruning due to arc consistency using the second representation (if one exists).
Are domain consistency plus arc consistency adequate to solve this problem using the second representation?
Which representation leads to a more efficient solution using consistency-based techniques? Give the evidence on which you are basing your answer.
Suppose you have a relation that is true if there is a vowel (one of: a, e, i, o, u) as the -th letter of word . For example, is true because there is a vowel (“a”) as the second letter of the word “cat”; is false, because the third letter of “cat” is “t”, which is not a vowel; and is also false because there is no fifth letter in “cat”.
Suppose the domain of is and the domain of is added, blue, fever, green, stare.
Is the arc arc consistent? If so, explain why. If not, show what element(s) can be removed from a domain to make it arc consistent.
Is the arc arc consistent? If so, explain why. If not, show what element(s) can be removed from a domain to make it arc consistent.
Consider the crossword puzzles shown in Figure 4.15.
The possible words for (a) are:
ant, big, bus, car, has, book, buys, hold, lane, year, ginger, search, symbol, syntax.
The available words for (b) are
at, eta, be, hat, he, her, it, him, on, one, desk, dance, usage, easy, dove, first, else, loses, fuels, help, haste, given, kind, sense, soon, sound, this, think.
Draw the constraint graph nodes for the positions (1-across, 2-down, etc.) and words for the domains, after it has been made domain consistent
Give an example of pruning due to arc consistency.
What are the domains after arc-consistency has halted?
Consider the dual representation, in which the squares on the intersection of words are the variables. The domains of the variable contain the letters that could go in these positions. Give the domains after this network has been made arc consistent. Does the result after arc consistency in this representation correspond to the result in part (c)?
Show how variable elimination solves the crossword problem. Start from the arc-consistent network from part (c).
Does a different elimination ordering affect the efficiency? Explain.
Consider the complexity for generalized arc consistency beyond the binary case considered in the text. Suppose there are variables, constraints, where each constraint involves variables, and the domain of each variable is of size . How many arcs are there? What is the worst-case cost of checking one arc as a function of , and ? How many times must an arc be checked? Based on this, what is the time complexity of GAC as a function of , and ? What is the space complexity?
Consider how stochastic local search can solve Exercise 3. You should use the “stochastic local search” AIspace.org applet or the book’s Python code to answer this question. Start with the arc-consistent network.
How well does random walking work?
How well does hill climbing work?
How well does the combination work?
Which (range of) parameter settings works best? What evidence did you use to answer this question?
Consider a scheduling problem, where there are five activities to be scheduled in four time slots. Suppose we represent the activities by the variables , , , , and , where the domain of each variable is and the constraints are , , , , , , , and .
[Before you start this, try to find the legal schedule(s) using your own intutions.]
Show how backtracking solves this problem. To do this, you should draw the search tree generated to find all answers. Indicate clearly the valid schedule(s). Make sure you choose a reasonable variable ordering.
To indicate the search tree, write it in text form with each branch on one line. For example, suppose we had variables , , and with domains , and constraints and . The corresponding search tree is written as:
X=t Y=t failure Y=f Z=t solution Z=f failure X=f Y=t Z=t failure Z=f solution Y=f failure
[Hint: It may be easier to write a program to generate such a tree for a particular problem than to do it by hand.]
Show how arc consistency solves this problem. To do this you must
draw the constraint graph;
show which elements of a domain are deleted at each step, and which arc is responsible for removing the element;
show explicitly the constraint graph after arc consistency has stopped; and
show how splitting a domain can be used to sove this problem.
Which of the following methods can
determine that there is no model, if there is not one
find a model if one exists
find all models?
The methods to consider are
arc consistency with domain splitting
variable elimination
stochastic local search
genetic algorithms.
Modify arc consistency with domain splitting to return all of the models and not just one. Give the algorithm.
Give the algorithm for variable elimination to return one of the models rather than all of them. How is finding one easier than finding all?
Explain how arc consistency with domain splitting can be used to count the number of models. If domain splitting results in a disconnected graph, how can this be exploited by the algorithm?
Modify VE to count the number of models, without enumerating them all. [Hint: You do not need the backward pass, but instead you can pass forward the number of solutions there would be.]
Consider the constraint graph of Figure 4.16 with named binary constraints. is a relation on and , which we can write as , and similarly for the other relations. Consider solving this network using VE.
Suppose you were to eliminate variable . Which constraints are removed? A constraint is created on which variables? (You can call this ).
Suppose you were to subsequently eliminate (i.e., after eliminating ). Which relations are removed? A constraint is created on which variables?
Pose and solve the crypt-arithmetic problem as a CSP. In a crypt-arithmetic problem, each letter represents a different digit, the leftmost digit cannot be zero (because then it would not be there), and the sum must be correct considering each sequence of letters as a base ten numeral. In this example, you know that and that , and so on.