0% found this document useful (0 votes)
7 views2 pages

Homework 5

The document outlines Homework #5 for CSC510, focusing on backtracking and branch and bound algorithms. It includes two main problems: the 5-Queens problem, requiring analysis of state space trees and backtracking solutions, and the traveling salesperson problem, involving a directed complete graph and the application of branch and bound with best-first search. Each problem consists of multiple parts, assessing understanding of algorithmic concepts and their application to specific scenarios.

Uploaded by

liza201357637
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Homework 5

The document outlines Homework #5 for CSC510, focusing on backtracking and branch and bound algorithms. It includes two main problems: the 5-Queens problem, requiring analysis of state space trees and backtracking solutions, and the traveling salesperson problem, involving a directed complete graph and the application of branch and bound with best-first search. Each problem consists of multiple parts, assessing understanding of algorithmic concepts and their application to specific scenarios.

Uploaded by

liza201357637
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CSC510 Homework #5 Backtracking & Branch and Bound (100 pts Total)

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.

e) (10pts) Explain why the node [1,5] was considered non-promising.

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

[1,2] [1,3] [1,4] [1,5]


Bound = ? Bound =21 Bound=29 Bound=41

[1,3,2] [1,3,4] [1,3,5] [1,4,2] [1,4,3] [1,4,5]


Bound=21 Bound=26 Bound=38 Bound=? Bound=37 Bound=29

[1,3,2,4]= [1,3,2,5]= [1,3,4,2]= [1,3,4,5]= [1,4,5,2]= [1,4,5,3]=


[1,3,2,4,5,1] [1,3,2,5,4,1] [1,3,4,2,5,1] [1,3,4,5,2,1] [1,4,5,2,3,1] [1,4,5,3,2,1]
Length=36 Length=30 Length=42 Length=33 Length=29 Length=47

© Kaz Okada

You might also like