Homework 5
Homework 5
1. (40 pts) Regarding the 5-Queens problem (n-Queen problem with n = 5), answer
following questions:
a) (10 pts) Complete state space tree is a state space built by DFS without calling
any nodes as non-promising so that no pruning of tree branches occurs. Suppose
you solve a 5-Queens problem with DFS without pruning to construct the
complete state space tree. How many nodes are there in this tree?
b) (10 pts) How many potential solutions (including wrong ones) are there by using
the strategy in (a) where DFS is used without pruning?
c) (10 pts) Now let’s attempt to solve the 5-Queens problem by using the
backtracking algorithm with DFS and treating any nodes as non-promising if it is
along any column or diagonal of previously placed queens. Suppose we visit
children of a node in left-to-right order. Show a sketch of the portion of the
pruned state space tree that would lead to the first solution.
d) (10 pts) Display the first solution found by (c) and answer how many nodes you
visited to reach this solution from the root node in the pruned state space tree.
2. (60 pts) Consider the traveling salesperson problem with five cities which are
represented by vertices v1, v2, v3, v4, and v5 in a directed complete graph whose
weights are given in the following adjacency matrix W:
W v1 v2 v3 v4 v5
v1 0 13 3 9 19
v2 14 0 7 8 7
v3 4 5 0 7 16
v4 11 7 9 0 2
v5 18 7 17 4 0
Let’s solve this problem by using the branch and bound algorithm with best-first search
using the exact algorithm described during the lecture. Answer the following questions
using the portion of the pruned state space tree shown below.
a) (10 pts) Show how the bound at the root node is computed
b) (10pts) Compute the bound for node [1,2] representing all tours that begin with
v1 → v2. Show your work.
© Kaz Okada
c) (10pts) Compute the bound for node [1,4,2] representing all tours that begin
with v1 → v4 → v2. Show your work.
d) (10pts) Show the order in which the branch and bound algorithm with best-first
search visits the nodes in the below pruned state space tree.
f) (10pts) Show the solution of this instance of the traveling salesperson problem
by the above algorithm, as well as the total distance travelled by the tour.
[1]
Bound = 20
© Kaz Okada