0% found this document useful (0 votes)
16 views

Assignment #6 CS4/531, Fall 2023

This document provides instructions for Assignment #6 for the CS4/531 course in Fall 2023. It states that the assignment is due on December 11th and is worth a total of 40 points. It provides guidelines for submitting the homework, including printing your name and student ID on the first page, clearly labeling problems, and uploading a single PDF file to the learning management system. It also addresses policies around consulting external sources and disclosing any websites used. Students are permitted to find solutions online but must understand the solutions and be able to explain them.

Uploaded by

nocay71497
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)
16 views

Assignment #6 CS4/531, Fall 2023

This document provides instructions for Assignment #6 for the CS4/531 course in Fall 2023. It states that the assignment is due on December 11th and is worth a total of 40 points. It provides guidelines for submitting the homework, including printing your name and student ID on the first page, clearly labeling problems, and uploading a single PDF file to the learning management system. It also addresses policies around consulting external sources and disclosing any websites used. Students are permitted to find solutions online but must understand the solutions and be able to explain them.

Uploaded by

nocay71497
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/ 5

Assignment #6 CS4/531, Fall 2023

Due Date: Mon., Dec 11, 2023


Total Points: 40
• UNSUPPORTED SOLUTIONS RECEIVE NO CREDIT.
• You must submit your homework to UB Learn, by 11:59pm, on Mon. Dec.
11, 2023.
• The points of the problems indicate their relative weight.
• The problems marked 0 points will not be collected nor graded. However, it
is very important for you to do these problems as if they were to be graded.
(Because similar problems will appear in exams). Detailed solutions to all
problems (including 0 point problems) will be provided.
• HW assignments, HW solutions, Exams, Exam solutions are all copy-right
materials. Do not upload them to third-party websites. If you do and get
caught, we will take proper actions against you.
• Guideline for all homework assignments.

– Print your name, and UB number on the first page.


– The solutions can be hand-written, but must be legible.
– Present the solutions in sequential order. Make sure the problem number is clearly
marked, and leave at least 1 inch space between problems.
– When presenting an algorithm, you may just provide a detailed description of the
algorithm, rather than the psuedo code. However, your description should contain
enough details so that its operation is clear, and its correctness and runtime can be
derived. It often also helps to briefly explain the main ideas of your algorithm, before
detailed description. In many cases, this (well explained and detailed description) is
the preferred way to present an algorithm (as the psudo-code often obscures the main
ideas of the algorithm and makes it harder to understand).
– You should upload your solution to UB Learn before deadline. A single pdf file is
preferred. Multiple files, and png, jpg, jpeg format files are also acceptable (but NOT
a zip file).
– If you do not follow these guidelines, TA may deduct up to 20% of points.

Note: You are permitted to consult websites to find solutions. If you do so, you MUST
disclose this information, by disclosing the http address of the documents you used. If you
don’t and get caught, it will be considered cheating. If you do disclose the website, no
penalty will be given. However, you must make sure you really understand the solution
in this case. I may ask you detailed questions about the solution. If you cannot answer, it
will be considered cheating also.
If you do so, you MUST disclose this information, by disclosing the http address of the
documents you used. If you don’t and get caught, it will be considered cheating. If you
do disclose the website, no penalty will be given. However, you must make sure you really
understand the solution in this case. I may ask you detailed questions about the solution.
If you cannot answer, it will be considered cheating also.
Even though you are permitted to do so, it is NOT a good idea to do it, for the following
reasons:

1
– You spend lots of time searching Internet, not knowing if you can find anything. Even
when you find something, you need to make sure the problem you find is indeed the
problem in our HW.
– Quite often, the solutions you find are wrong and you do not know. In that case, for
sure you cannot explain it as you take a wrong solution as a correct one. Then, it is
automatically cheating.
– When you try to solve a problem by yourself, you will go through the thinking process,
and know what work and what do not. This process is very important for learning
algorithms. Exams may contain problems similar to homework problems. If you went
through the thinking process, it is easier to find similar solutions. If you get your
solution from a website, you forfeit this advantage. It will be harder to find solutions
for similar problems quickly in exams.

1. (2+3 = 5 points)
(a) State if the following statement is true or false. If it is true, give a short explanation. If
it’s false, give a counter example.
Let G be a (basic) flow-network with source s and sink t. Each directed edge e of G
has a positive integer capacity c(e). If f is a max-flow of G, then f saturates every
edge out of s. (Namely, for every edge e = s → v, f (e) = c(e).)

(b) State if the following statement is true or false. If it is true, give a short explanation. If
it’s false, give a counter example.
Let G be a (basic) flow-network with source s and sink t. Each directed edge e of G
has a positive integer capacity c(e). Let (S, T ) be a minimum capacity st-cut with
respect to the capacity function c(∗). Now suppose that we add 1 to the capacity of
every edge e. Namely, we define a new capacity function c′ (e) = c(e) + 1 for every
edge e in G. Then (S, T ) is still a minimum capacity st-cut of G with respect to the
new capacity function c′ (∗).

2. (7 pts) Doctor Scheduling Problem.:


A large hospital needs to make a vacation schedule that satisfies the following requirements.
• There are k vacation periods. Each period spans several contiguous days. (Example: the
week of Christmas, Thanksgiving weekend, July 4th weekend etc). Let Dj be the set of
days in the jth vacation period. The set of vacation days is the union of all Dj ’s.
• There are n doctors at the hospital. The doctor i has a set Si of vacation days when
he is available to work. (This may include certain days from a vacation period, but not
others. For example, a doctor may be able to work on Friday, Saturday and Sunday during
Thanksgiving weekend, but not on the Thursday).
• We have a parameter c. Each doctor should be assigned to work at most c vacation days
total and only days when he or she is available.
• For each vacation period Dj , each doctor should be assigned to work at most one of the
days in Dj . (For example, a doctor can be assigned to work 1 day during Thanksgiving
weekend and 1 day during July 4th weekend. But he cannot be assigned to work 2 days
during the Thanksgiving weekend).

2
• The hospital needs to assign one doctor to work on each vacation day.
Describe a polynomial time algorithm that determine whether all above requirements can
be satisfied. (Hint: Convert it to a max-flow problem.)
Note: This is very similar to the Ad assignment problem we discussed in class.

3. (0 points) Image Segmentation Problem.


A central problem in image processing is the segmentation of an image into various coherent
regions. For example, you may have an image representing a picture of three people standing in
front of a complex background scene. A natural but difficult goal is to identify the three people
as coherent objects in the scene.
One of the most basic problems along these lines is that foreground/background segmentation:
We wish to label each pixel in an image as belonging to either the foreground of the scene or
the background of the scene. The following is the description of the problem.
Let V be the set of pixels in the underlying image. Certain pairs of pixels are neighbors, and
we use E to denote the set of all pairs of neighboring pixels. In this way, we have an undirected
graph G = (V, E). We will be deliberately vague on what exactly we mean by a ”pixel”, or what
we mean by the ”neighbor” relation. For a regular digital image, G is a grid graph as shown in
Figure 1. But for this problem, G can be any graph. This makes the problem more general.

Figure 1: The graph for a regular digital image.

For each pixel i, we have a likelihood ai that it belongs to the foreground; and a likelihood bi
that it belongs to the background. The values of ai and bi are determined by other means. For
us, they are just non-negative numbers provided as part of the input. They simply specify how
desirable it is to have pixel i in the background or foreground.
In isolation, we would want to label all pixel i as belonging to foreground if ai > bi , and
background otherwise. However, decisions that we make about the neighbors of i should also
affect our decision about i. If many of i’s neighbors are labeled ”background”, for example, we
should be more inclined to label i as background too. Thus, for each pair (i, j) of neighboring
pixels i and j, there is a separation penalty pij ≥ 0 for placing one of i and j in foreground and
another in background. Now we can specify our problem formally as follows:
Input: An undirected graph G = (V, E). Each vertex i ∈ V is associated with two numbers
ai ≥ 0 and bi ≥ 0. Each edge (i, j) ∈ E is associated with one number pij ≥ 0.
Goal: Partition V into two subsets A and B (A and B are the foreground and background
pixels, respectively), so as to maximize the following quantity:
X X X
q(A, B) = ai + bj − pij
i∈A j∈B
(i, j) ∈ E
one of i, j is in A, another is in B

3
Thus we are rewarded for having high likelihood values and penalized for having pairs (i, j)
with one pixel in A and another pixel in B.
Describe how to solve this problem by using max-flow/min-cut techniques.

4. (2+3+2+3=10 points). The Graph Edge Coloring (GEC) problem is defined as follows.
The input is an undirected graph G = (V, E) with n vertices and m edges. An edge coloring
of G is an assignment of colors to the edges of G so that for any two edges e1 , e2 , if e1 and e2
share a common end vertex, then e1 and e2 must have different colors. The problem is: Given
G, determine the smallest integer k such that G has an edge coloring using k colors.
(a) Describe the decision version of the GEC problem.
(b) Suppose that we have an algorithm A for solving the decision version of the GEC problem
with run time T (n, m). Describe an algorithm B for solving the optimization version of the GEC
problem. Analyze the run time of B (in terms of T (n, m).)
(c) What is the “certificate” of the GEC problem?
(d) Consider the following Time Table (TT) problem. In a school, there are p teachers
X1 , X2 , . . . , Xp and q classes Y1 , Y2 , . . . , Yq . For each i (1 ≤ i ≤ p) and j (1 ≤ j ≤ q), the teacher
Xi meets the class Yj tij times. Obviously, during any period, each teacher can meet only one
class, and each class can meet only one teacher. The problem is to schedule a complete timetable
using the minimum possible number of periods.
Describe how to convert the TT problem to the GEC problem.
4. (7 points) An eye-glass graph of order 2n is a graph consisting of two cycles (each with n
vertices) connected by an edge. The graph shown in Figure 2 is an eye-glass graph of 8 vertices.

Figure 2: The eye-glass graph with 8 vertices

Consider the following problem: Given an undirected graph G = (V, E) and a number 2n,
decide if G has an eye-glass graph of order 2n as a subgraph.
Show this problem is NP-complete.
6. (7 points) Let G = (V, E) be an undirected graph. A Hamiltonian Path (HP) of G is a
path that visits each vertex of G exactly once. A Hamiltonian Cycle (HC) of G is a cycle
that visits each vertex of G exactly once.
The Hamiltonian Cycle (HC) problem is: Given an undirected graph G, decide if G has a
Hamiltonian Cycle or not. The Hamiltonian Path (HP) problem is: Given an undirected graph
G, decide if G has a Hamiltonian path or not.
We discussed in class that HC problem is NP-complete. Show HP-problem is NP-complete,
by showing that HC ≤P HP .
7. (0 points) Input: A set S and a collection {S1 , S2 , . . . , Sm } of subsets of S. (Namely each Si
is a subset of S), and an integer k.

4
Question: Is there a subset X ⊆ S so that |X| ≤ k and, for each Si (1 ≤ i ≤ m), Si and X
have at least one common element?
Interpretation: S= the set of UB students. Each Si (1 ≤ i ≤ m) is a student club. We want
to select a committee X so that X consists of at most k students, and each club Si has at least
one member in the committee (if a student belongs to more than one club, then he can represent
all clubs he belongs to). Is this possible?
Show Hitting Set Problem is N P-hard.
8. (4 points) Briefly answer the following questions.

(a) For NP-Complete theory, we consider decision problems only. What are they? Why we
consider these problems only? With this restriction, would NPC-theory not applicable to
general optimization problems?

(b) To prove Cook’s Theorem, we introduced Turing machine. Why we do this?

(c) If a decision problem Y is N P-complete and is in P, then P = N P. True or False? Why?

(d) Let X and Y be two decision problems. If X ≤P Y and X is in P, then Y is in P. True


or False? Why?

You might also like