CS6212 |
June 20, 2011 |
Homework 4
Due Date: June 29, 2011
Problem 1: (15 points)
Let G = (V,E) be the following undirected graph: V = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11}, and E = {(3,4) , (4,8) , (3,8) , (8,9) , (8,6) , (9,6), (7,1) , (7,2)
, (10,11) , (10,7) , (11,7) , (1,2) , (6,5) , (5,10) , (6,10)}.
Use backtracking to color G with 3 colors only. Find 2 solutions.
Problem 2: (20 points)
a) Let E={1,2,3,...,n}, and let k be a positive integer
< n. Write a backtracking algorithm that generates all the subsets of E such
that each subset has at least k elements. Your algorithm must not generate any
subset more than once.
b) Write a backtracking algorithm to generate all the
arrays X[1..2n] such that each X[i] is in {0,1,2,3,5,6} and for all
i=1,2,...,2n, X[i] is even if and only if i is odd.
c) Write a backtracking algorithm that generates all
the adjacency matrices of undirected graphs of n nodes such that the degree of
every node is at least 3.
Problem 3: (15 points)
Apply the branch and bound algorithm of the minimum job assignment problem to
the following matrix:
2 |
5 |
3 |
10 |
4 |
5 |
1 |
2 |
3 |
showing the value of the approximate
cost function of every node. Make sure you use the best approximate cost
function developed in class. Give the solution produced by the algorithm for
this problem.
Problem 4: (25 points)
Suppose you have two processors
1 and 2 such that processor 1 is three times as fast as processor 2. Assume
that you have n programs and that the i-th program takes ti time
units to execute on processor 1 (and hence it takes 3ti time units
to execute on processor 2). A schedule S of the n programs on the 2 processors
is an assignment (i.e., a mapping) that assigns (maps) every program to one of
the processors. That is, S is a mapping of {1,2,...,n} to {1,2} where
"S(i)=j" means that program i is assigned to processor j. Let T1
be the time that processor 1 needs to carry out a schedule S, that is, T1
is the sum of the times ti of the programs assigned to processor 1.
Define T2 similarly, that is, T2 is the sum of the times
3ti of the programs assigned to processor 2. The cost of a schedule
S is max(T1,T2). An optimal schedule is a schedule of
minimum cost.
a) Give an approximate cost function for a branch and
bound algorithm that would compute an optimal schedule. Also, prove the
legitimacy of your approximate cost function.
b) Apply your algorithm on the following 5 programs of
times t1=4, t2= 8, t3= 3, t4= 2, t5=4.
You should show the tree and the value of the approximate cost function of
every node. Also point out the resulting optimal schedule. Note: whenever you
have a tie while choosing an E-node, break the tie by selecting the deepest
E-node in the tree.
Problem 5: (25 points)
Consider a graph G=(V,E) such that every node i has a positive weight wi.
The weight of a k-clique is the product of the weights of the nodes of
the clique. Give a branch and bound algorithm to find a minimum weight
k-clique.