• 沒有找到結果。

Artificial Intelligence 2007 Spring Homework 3 Solution

N/A
N/A
Protected

Academic year: 2022

Share "Artificial Intelligence 2007 Spring Homework 3 Solution"

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

Artificial Intelligence 2007 Spring Homework 3 Solution

April 15, 2007

1. Constrain Satisfaction Problem

We have only four variables: A, B, C and D and each of them have only two legal values, which we will write as: A1, A2 (for variable A), B1, B2 (for variable B), C1, C2 (for variable C) and D1, D2 (for variable D). The only legal assignments for each pair of variables are:

A-B: A1-B1, A2-B1 A-C: A1-C1, A2-C2 B-D: B1-D1

C-D: C2-D1 B-C: No constraint.

A-D: No constraint.

No other combination of variable values is legal. Let’s say that that ”an assignment is generated” every time a variable in the problem gets a new (tentative) assignment. We assume that the variables are examined in alphabetical order and the values in numerical order . Below, we ask you to solve this problem using pure backtracking and also by using backtracking with forward checking. Stop when a valid solution is found.

The search tree for this problem is given below. Each node (except the root) is labeled with the value involved in the assignment, the variable involved is obvious given the value. Your answers will be a space-separated sequence of these values involved in the assignments as they are generated during the appropriate search. For example, A1 B1 etc.

(a) Pure backtracking: How many total assignments are made before finding an answer?

(b) Pure backtracking: Show the assignments in order.

(c) Backtracking with forward checking: How many assignments are made before finding an answer?

(d) Backtracking with forward checking: Show the assignments in order.

Ans.

To formulate this problem as a CSP. We can represent it using a graph as Figure 1:

(a),(b) The steps that examine these variables in alphabetical order and assign values in numerical order to these variables using pure backtracking are in Table 1:

(c),(d) Using backtracking with forward checking can find illegal states earlier than pure backtracking. The steps are shown in Table 2.

1

(2)

Constraints:

A-B: A1-B1, A2-B1 A-C: A1-C1, A2-C2 B-D: B1-D1

C-D: C2-D1 A, B, C, D ∈{1,2}

Figure 1: Formulate this problem as a CSP.

step1 A1 step2 A1 B1 step3 A1 B1 C1

step4 A1 B1 C1 D1 ×

step5 A1 B1 C1 D2 ×

step6 A1 B1 C2 ×

step7 A1 B2 ×

step8 A2 step9 A2 B1

step10 A2 B1 C1 × step11 A2 B1 C2

step12 A2 B1 C2 D1 DONE!

Table 1: Assign values using pure backtracking strategy

A B C D

init 1,2 1,2 1,2 1,2

step1 A1 1 1 1 1,2

step2 A1 B1 1 1 1 1

step3 A1 B1 C1 × 1 1 1

step4 A2 2 1 2 1,2

step5 A2 B1 2 1 2 1

step6 A2 B1 C2 2 1 2

step7 A2 B1 C2 D1 DONE! 2 1 2 1

Table 2: Assign values using backtracking with forward checking

2

參考文獻

相關文件

Using struct to maintain word database that consists word, word count, and occurrence (line number and the order in the line) called word database.. Using fixed array to store

Trace the operation of the A* search algorithm applied to the problem of getting to Bucharest from Lugoj using the straight-line distance heuristic.. That is, show the sequence of

Show a state space with varying step costs in which GRAPH-SEARCH using iterative deepening finds a suboptimal

Suppose there is a differentiable function g(T ) (an estimator of some parameter) for which we want an approximate estimate of variance...

The image of the set  is the region  shown in the ­plane, a parallelogram bounded by these four line segments.. The transformation maps the boundary of  to the boundary of

After students have had ample practice with developing characters, describing a setting and writing realistic dialogue, they will need to go back to the Short Story Writing Task

These schools developed their own school-based pull-out gifted programmes and school visits, lesson observation and sharing sessions were arranged among the teachers and students

In order to understand the influence level of the variables to pension reform, this study aims to investigate the relationship among job characteristic,