• Non ci sono risultati.

Fundamentals of Artificial Intelligence

N/A
N/A
Protected

Academic year: 2021

Condividi "Fundamentals of Artificial Intelligence"

Copied!
17
0
0

Testo completo

(1)

Fundamentals of Artificial Intelligence

Laboratory

Dr. Mauro Dragoni

Department of Information Engineering and Computer Science Academic Year 2020/2021

(2)

Exercise 3.1

page 02

 Give a complete problem formulation for each of the following. Choose a formulation that is precise enough to be implemented.

Using only four colors, you have to color a planar map in such a way that no two adjacent regions have the same color.

A 3-foot-tall monkey is in a room where some bananas are suspended from the 8-foot ceiling. He would like to get the bananas. The room contains two stackable, movable, climbable 3-foot-high crates.

You have a program that outputs the message “illegal input record” when fed a certain file of input records. You know that processing of each record is independent of the

other records. You want to discover what record is illegal.

You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons, and a water faucet.

You can fill the jugs up or empty them out from one to another or onto the ground. You need to measure out exactly one gallon.

(3)

Exercise 3.2

page 03

 In the following graphs, assume that if there is ever a choice amongst multiple nodes, both the BFS and DFS algorithms will choose the left-most node first.

 Starting from the green node at the top, which algorithm will visit the least number of nodes before visiting the yellow goal node?

(4)

Exercise 3.2

page 04

A. BFS B. DFS

C. Neither BFS nor DFS will ever encounter the goal node in this graph.

D. BFS and DFS encounter same number of nodes before encounter the goal node

(5)

Exercise 3.2

page 05

A. BFS B. DFS

C. Neither BFS nor DFS will ever encounter the goal node in this graph.

D. BFS and DFS encounter same number of nodes before encounter the goal node

(6)

Exercise 3.2

page 06

 For BFS algorithm, visiting a node’s siblings before its children, while in DFS

algorithm, visiting a node’s children before its siblings. Before countering goal node F:

 BFS algorithm encounters nodes: ABCDE

 DFS algorithm encounters nodes: ABDHLIEJMC

(7)

Exercise 3.3

page 07

 In the following graphs, assume that if there is ever a choice amongst multiple nodes, both the BFS and DFS algorithms will choose the left-most node first.

 Starting from the green node at the top, which algorithm will visit the least number of nodes before visiting the yellow goal node?

(8)

Exercise 3.3

page 08

A. BFS B. DFS

C. Neither BFS nor DFS will ever encounter the goal node in this graph.

D. BFS and DFS encounter same number of nodes before encounter the goal node

(9)

Exercise 3.3

page 09

A. BFS B. DFS

C. Neither BFS nor DFS will ever encounter the goal node in this graph.

D. BFS and DFS encounter same number of nodes before encounter the goal node

(10)

Exercise 3.3

page 010

 For BFS algorithm, visiting a node’s siblings before its children, while in DFS

algorithm, visiting a node’s children before its siblings. Before countering goal node G:

 BFS algorithm encounters nodes: ABCDEF

 DFS algorithm encounters nodes: ABD

(11)

Exercise 3.4

page 011

 Consider the following graph. If there is ever a decision between multiple

neighbor nodes in the BFS or DFS algorithms, assume we always choose the

letter closest to the beginning of the alphabet first. In what order will the nodes be visited using a Breadth First Search? In what order will the nodes be visited using a Depth First Search?

(12)

Exercise 3.4

page 012

 In what order will the nodes be visited using a Breadth First Search?

The answer is: ABDCEGHF

 In what order will the nodes be visited using a Depth First Search?

The answer is: ABCEHFGD

(13)

Exercise 3.5

page 013

(14)

Exercise 3.6

page 014

(15)

Exercise 3.7

page 015

(16)

Exercise 3.8

page 016

(17)

Exercise 3.9

page 017

Riferimenti

Documenti correlati

Arcs are labeled with the cost of traversing them and the estimated cost to a goal (i.e., the h function) is reported inside nodes (so lower scores are better). Apply

Department of Information Engineering and Computer Science Academic Year 2020/2021...

Department of Information Engineering and Computer Science Academic Year 2020/2021... Algorithms

 The next step is to transform each well-formed formula into Prenex Normal Form, skolemize, and rewrite as clauses in conjunctive normal

So, here we have that garbage is mutex with not clean and with not quiet (the only way to make garbage true is to maintain it, which is mutex with carry and with dolly)...

If you bring in as many team-mates as you like to help David, reallocating some of the tasks to these folk (but nobody is over-allocated work), what is the earliest finish time of

 Represent the following seven sentences using and extending the representations developed in the chapter:.. The water in John’s water bottle

page 015 In terms of the CPTs, you just needed to make sure that adding multiple causes increased the probability of a thing - for instance, if the neighbor’s dog is howling AND