(30 points) Problem 1: AI topics and subfields by a library search. (Library search.)Advice: Problems 6 and 7 are straightforward, do them quickly. Problems 4 and 5 should be very easy, do them as soon as you have read the relevant sections. Problems 1, 2 and 3 require some library search: do not delay until the last moment as books may be missing from the library.
(10 points) Problem 2: What is AI about. (Your opinion.)
(10 points) Problem 3: AI in the media. (Library search.)
(20 points) Problem 4: Intelligent Agents. (Exercise from AIMA.)
(20 points) Problem 5: Problem solving. (Exercise from AIMA.)
(05 points) Problem 6: Tutorial to debugging tools. (Courtesy of B.V. Faltings, AILab, Swiss Federal Institute of Technology in Lausanne.)
(05 points) Problem 7: Getting help with the command fi:clman. (Courtesy of B.V. Faltings, AILab, Swiss Federal Institute of Technology in Lausanne.)
Problem I: AI topics and subfields by a library search (Please do not check the proceedings out of the library as your colleagues need to access them too. )
The following conferences are general AI conferences:
Task 1: Major general-purpose AI Conferences.
Problem 2: What is AI about.
Consider the 8 definitions of AI cited in AIMA, page 5, Figure 1.1. When applicable:
AIMA, Exercise 1.6, Page 30.
AIMA, Exercise 2.4, Page 50.
AIMA, Exercise 3.2, Page 87.
The n-Queens Problem consists of putting n queens on a n x n chess board such that no two queens can attack each other (we will say conflict). Two queens conflict if they are on the same row, the same column or the same diagonal. The following LISP program has two functions, and allows to test a new position for a new queen conflicts with other queens already on the board. The board is a list of a pair of numbers representing the positions on the chess board of the already placed queens. For instance: ((0 1) (1 3)) means that two queens have be positioned on the chess board; the first queen is on line 0 and column 1 and the second on line 1 and column 3.
This code has two rather simple errors that we will try to detect using the LISP functions trace and step.(defun threatens (line-1 column-1 line-2 column-2) (or (= line-1 line-2) (= column-1 column-2) (= (- line-1 column-1)(+ line-2 column-2)) (= (+ line-1 column-1)(+ line-2 column-2))))(defun conflict (line column board) (cond ((endp board) nil) ((threatens line column (first (first board))(second (first board))) t) (t (conflict line column board))))
[1] at the head of the prompt means that we are at level 1 of the execution stack. Use the command :zoom to check the whole execution stack. You will then see:Error: EXCL::=_2OP: `A' is not of the expected type `NUMBER' [condition type: TYPE-ERROR] [1] USER(xx):
The arrow indicates the current level in the execution stack. You can use :up <n> and :dn <n> to move around this stack. At each level, you can examine the content of the parameters and local variables using the command :loc. Further, the command :eval :context T entered once and for all, make the local environment accessible. This means that the local variables are read and write accessible with their names.Evaluation stack: (ERROR TYPE-ERROR :DATUM ...) ->(= A 0) (OR OR (= LINE-1 LINE-2) ...) (THREATENS A 2 ...) (COND COND (# NIL) ...) (CONFLICT A 2 ...) ..
Infinite loop
Evaluate the expression : (conflict 1 2 '((0 1))). Nothing
happens, and the LISP interpreter does not seem to stop. In order
to stop it, you have to type C-c C-c (you may have to do so several times
before the interpreter reacts). Clearly, the program is entering an infinite
loop. Since conflict is a recursive function, it may
be the case that the condition to end the recursive call is never verified.
In such cases, we may choose to "trace"
the function to check the calls as well as the values returned by the function.
Type (trace conflict) then re-execute the function. To stop the
interpreter, use C-c C-c. The ending condition (board
= NIL) is not verifiable because board has always the
same value. We must thus change the recursive call so that we give only
the rest of board at each call. The function trace
is used to verify that the value of arguments are really what we want
them to be. To exit from the trace mode, we have to call the function (untrace
<function name>). If we do not put the name of the function,
all functions being trace will no longer be. Modify the function
conflict and exit the trace mode.
Step execution
After making the correction above, make the call again (conflict
1 2 '((0 1))). The result of this call is not correct since the result
is NIL while the queens are obviously in conflict. The function
that test whether two queens can attack each other is buggy. In this
situation, we can use the stepper to run the execution of the code step
by step. Warning: the stepper works only on interpreted code and
not on compile code. Type (step threatens), then make
the following call again (conflict 1 2 '((0 1))). In the
stepping mode, three commands are important:
Use the stepper to localize and correct the error. In general, the step
function is a last-chance tool when we really do not see what is happening
in the code and that trace is not providing enough information.
Problem 7: getting help with the command fi:clman
M-x fi:clman is an on-line LISP manual. Check it out for the
function member (type the command then the name of the function).
What is member useful for? What is the result of the following:
(member 'a '(d e a f g))Verify in the LISP interpreter.
(member 'g '(d e a f g))
(member 'x '(d e a f g))