Docsity

Artificial Intelligence Programming - Midterm Exam Questions | CS 662, Exams of Computer Science

Toggle sidebar
bg1
Name:
Student ID #:
CS 662 Midterm answers
Total: 150 pts
Instructions: You will have 105 minutes to complete this midterm. The test is closed book; no notes,
computers, or calculators are allowed. Please show all relevant work and calcuations in order to receive
partial credit (when appropriate). Many of the questions on this test are short answer, and are designed to
get you to think about or explain the topics we have covered. You should answer these at an appropriate
length and explain your reasoning when asked to do so. A one-word answer is usually too short; a one-page
answer is usually too long. You may use the backs of the pages if you need extra space.
1 True/False, plus corrections
35 pts, 5 pts each
Each of the following statements is either true or false. If it is true, mark it true. If it is false, correct
the statement so that it is true. Note: Adding “not” or otherwise negating the sentence is not acceptable.
You must change the facts in the sentence if it is false. For example:
Question: The Turing Test is a test of whether a computer program is rational.
Bad answer, no credit: The Turing Test is not a test of whether a computer program is rational.
Good answer: The Turing Test is a test of whether a computer program is indistinguishable from a
human.
•A stochastic environment is one in which an action may have more than one result.
True.
•The Schema Theorem says that more fit bitstrings will be selected with exponentially increasing like-
lihood.
False. The Schema Theorem says that more fit, low order schema will be selected with
exponentially increasing likelihood.
•A rational agent is an agent that does what a human would do in any situation.
False. A rational agent is an agent that selects actions that maximize its performance
measure (or utility).
•A toy problem is a problem used to illustrate or study the performance of an algorithm.
True
•A complete algorithm is one that always finds all possible solutions to a problem.
False. A complete algorithm is one that will always find a solution to a problem if one
exists.
1
pf3
pf4
pf5

Partial preview of the text

Download Artificial Intelligence Programming - Midterm Exam Questions | CS 662 and more Exams Computer Science in PDF only on Docsity!

Name:

Student ID #:

CS 662 Midterm answers

Total: 150 pts

Instructions: You will have 105 minutes to complete this midterm. The test is closed book; no notes, computers, or calculators are allowed. Please show all relevant work and calcuations in order to receive partial credit (when appropriate). Many of the questions on this test are short answer, and are designed to get you to think about or explain the topics we have covered. You should answer these at an appropriate length and explain your reasoning when asked to do so. A one-word answer is usually too short; a one-page answer is usually too long. You may use the backs of the pages if you need extra space.

1 True/False, plus corrections

35 pts, 5 pts each

Each of the following statements is either true or false. If it is true, mark it true. If it is false, correct the statement so that it is true. Note: Adding “not” or otherwise negating the sentence is not acceptable. You must change the facts in the sentence if it is false. For example: Question: The Turing Test is a test of whether a computer program is rational. Bad answer, no credit: The Turing Test is not a test of whether a computer program is rational. Good answer: The Turing Test is a test of whether a computer program is indistinguishable from a human.

  • A stochastic environment is one in which an action may have more than one result.

True.

  • The Schema Theorem says that more fit bitstrings will be selected with exponentially increasing like- lihood.

False. The Schema Theorem says that more fit, low order schema will be selected with exponentially increasing likelihood.

  • A rational agent is an agent that does what a human would do in any situation.

False. A rational agent is an agent that selects actions that maximize its performance measure (or utility).

  • A toy problem is a problem used to illustrate or study the performance of an algorithm.

True

  • A complete algorithm is one that always finds all possible solutions to a problem.

False. A complete algorithm is one that will always find a solution to a problem if one exists.

  • Mutation in genetic algorithms and temperature in simulated annealing both improve performance by eliminating suboptimal solutions.

False. Mutation in GAs and temperature in simulated annealing both improve solution quality by helping to escape from local optima.

  • A Goal-based agent selects actions that are likely to maximize its utility.

False. A goal-based agent selects actions that are most likely to achieve its goal.

2 Agents and environments

a. 24 pts, 6 pts each

For each of the following agents and environments, characterize the environment according to the six properties used in R & N (static vs dynamic, discrete vs. continuous, fully vs. partially observable, deter- ministic vs stochastic, episodic vs. sequential, single-agent vs. multi-agent). If necessary, you may want to give a brief justification of your answers.

  • The game of checkers.

Static, discrete, fully observable, deterministic, sequential, multi-agent.

  • An autopilot that successfully lands a plane.

Dynamic, continuous, partially observable, stochastic, sequential, single-agent

  • An handwriting recognition agent that reads the addresses on envelopes and places each of them in the appropriate mailbox.

Static, discrete, fully observable, deterministic, episodic, single-agent

  • A music-playing accompanist agent that can play along with a human piano player.

Dynamic, continuous, patially observable, deterministic, sequential, multi-agent.

b. 6 pts

Consider the following problem: We want to build an agent that can play word games. For our first task, we would like to build an agent that can recognize palindromes. (A palindrome is a word or phrase that reads the same backwards as forwards excpeting punctuation, such as “Anna” or “Madam, I’m Adam”, or “A man, a plan, a canal - Panama!”)

Assume that our agent receives its input one letter at a time. That is, at time t=0 it sees ’a’, and and time t=1 it sees ’n’, and so on. Once the string is seen completely, the agent must output ’yes’ or ’no’.

Can a reflex agent solve this problem? If so, provide pseudocode for how such an agent might work. (You may use the back of the page if needed.) If not, explain precisely why it cannot solve this problem.

No, a reflex agent cannot solve this problem. The agent must be able to remember a sequence of characters and say whether a condition (namely that the sequence is reversible)

b) 18 points - 6 points for each search

Trace BFS, DFS, and A* on the following graph. Uninformed search methods should expand nodes from left-to-right. (B should be visited before C.) Both g1 and g2 are goal states; your algorithm may stop as soon as either is expanded. Show the order in which nodes are visited. For A, also show the f,g, and h costs for each node visited. For A, the costs for each edge are indicated next to the edge, and the heuristic costs for each state are in parentheses next to the state.

A

B C

D E

F

G

H G

BFS: A,B,C,D,E,F,H,G

DFS: A,B,D,H,G

A: A [B (g = 3, h = 6, f = 9), C (g = 5, h = 7, f = 12)] B [D (g = 5, h = 3, f = 8), E (g = 7, h = 4, f = 11), C (g = 5, h = 7, f = 12)] D [H (g = 10, h = 1, f = 11), E (g = 7, h = 4, f = 11), C (g = 5, h = 7, f = 12)] H [E (g = 7, h = 4, f = 11), G1 (g = 12, h = 0, f = 12), C (g = 5, h = 7, f = 12)] E [H (g = 9, h = 1, f = 10), G1 (g = 12, h = 0, f = 12), C (g = 5, h = 7, f = 12)] H [G1 (g = 11, h = 0, f = 11), C (g = 5, h = 7, f = 12)] G1. Goal. Optimal Path: A, B, E, H, G () Note: E and H can be enqueued in either order since they have the same f-value. Both answers are correct.

4 Heuristics

a. 4 pts

Consider the Tower of Hanoi problem. There are three towers, with N disks of increasing size stacked on the leftmost tower. The problem is to move the disks from the left-hand to the right-hand tower, with the constraint that a larger disk can never be placed on top of a smaller disk.

To begin, let h be the number of disks that still need to be moved. Is this heuristic admissible? If so, prove it. If not, provide a counterexample.

This heuristic is admissible. Since we can move one disk at a time, it will take at least as many moves as there are misplaced disks to solve the problem (more, due to the problem constraints). Therefore, the heuristic will never overestimate the number of moves to the goal, and is admissible.

b. 6 pts

Next, consider the following heuristic: Number the disks according to size, where 1 is the smallest disk and n is the number of the largest disk. h is the sum of the numbers of each misplaced disk.

Which heuristic should be used? Justify your answer with a precise technical argument, using the appropriate terminology.

The second heuristic provides a better estimate of the number of moves needed. To place the disk numbered n will require 2 n^ − 1 moves. Since this number is larger than the number of misplaced disks, we say that this heuristic dominates the first one. A few people noted that the second heuristic is inadmissible, due to its overestimate in the case where disk 2 is on the first post, disk 1 is on the second post, and all other disks are in place. This requires two moves to solve, and the heuristic gives an estimate of 3. Full credit was given for noting this and not using h2 because of it. We could correct this heuristic to be admissible by numbering the disks from 0 to n − 1.

5 pts

c. Use an admissibility argument to show that uniform cost search is optimal. Recall that A* search is optimal when an admissible heuristic is used. An admissible heuristic is one that always underestimates the cost to the goal. Uniform cost search expands nodes only according to their cost so far, so it uses h = 0. By definition, this will always be less than or equal to the cost to the goal (we assume step costs are positive), so therefore, the heuristic is admissible, and uniform cost search is optimal.

6 Adversarial Search

10 pts

For the following tree, give the backed-up minimax value for each node, assuming that the Max player chooses first at node A, and can choose B or C. What is the optimal sequence of plays?

A

B (^) C

D (^) E F G H

I J K L^ M^ N^ O^ P^ Q^ R 2 3 8 5 7 6 0 1 5 2

MAX

MIN

MAX

Node values: A: 3 B: 3 C: 1 D:3 E:8 F: 7 G: 1 H: 5 Optimal sequence of plays: A,B,D,J