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

2023 Spring Solution

The document outlines the instructions and content for CSCI-570 Spring 2023 Exam 2, which includes true/false questions, multiple choice questions, and sections on linear programming, network flow, NP completeness, and approximation algorithms. Each section has specific points allocated and requires students to demonstrate their understanding of various concepts in computer science. The exam is closed book, lasts 140 minutes, and emphasizes the importance of clear and complete answers.

Uploaded by

shank
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 views19 pages

2023 Spring Solution

The document outlines the instructions and content for CSCI-570 Spring 2023 Exam 2, which includes true/false questions, multiple choice questions, and sections on linear programming, network flow, NP completeness, and approximation algorithms. Each section has specific points allocated and requires students to demonstrate their understanding of various concepts in computer science. The exam is closed book, lasts 140 minutes, and emphasizes the importance of clear and complete answers.

Uploaded by

shank
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/ 19

CSCI-570 Spring 2023

Exam 2

INSTRUCTIONS
• The duration of the exam is 140 minutes, closed book and notes.
• No space other than the pages on the exam booklet will be scanned
for grading!
• If you require an additional page for a question, you can use the extra
page provided at the end of this booklet. However please indicate
clearly that you are continuing the solution on the additional page.

1
1. True/False Questions (10 points)
Mark the following statements as T or F. No need to provide any
justification.

a) (T/F). In the Ford-Fulkerson algorithm, the choice of augment-


ing paths can affect the number of iterations.
True
b) (T/F). If all edges in a graph have capacity 1, then the Ford-
Fulkerson algorithm runs in polynomial time.
True
c) (T/F). If an LP problem has a solution at all, it will have a
solution at some corner of the feasible region.
True. If an LP problem has an optimal solution, then it must oc-
cur at one of the corner points (or vertices) of the feasible region.
In other words, the optimal solution of an LP problem always lies
at the intersection of two or more constraint boundaries.
d) (T/F). The weak duality theorem in LP implies that if the pri-
mal LP problem is infeasible, then the dual LP problem is also
infeasible.
False. The weak duality theorem in LP does not make any state-
ment about the feasibility of the primal or dual LP problems.
e) (T/F). In LP, if the primal problem has a unique optimal solu-
tion, the dual problem also has a unique optimal solution.
False
f) (T/F). If a primal LP has an unbounded solution, then the dual
of that problem is infeasible.
True
g) (T/F). If SAT ≤p 2-Coloring, then P = N P .

2
True
h) T/F If a problem is NP-hard, it is also N P -complete.
False. If the solution can be verified in polynomial time, only
then
i) T/F A 1.01-approximation vertex cover algorithm must find the
optimal solution for graph with vertices less than 100
True. ALG ≤ 1.01OPT < OPT + 1
j) T/F To solve bin packing with a first-fit approach, items must
be first sorted in order to get a constant approximation.
False. The first-fit approach is 2-approximation algorithm.

3
2. Multiple Choice Questions (20 points)
Please select the most appropriate choice. Each multiple choice ques-
tion has a single correct answer.

a) What would be the running time of the Ford-Fulkerson algorithm


if we always choose the augmenting path with the least number
of edges?
a) O(E)
b) O(E V )
c) O(E 2 V )
d) O(E V 2 )
c)
b) Which of the following statements is true?
a) The capacity of a cut is the sum of the capacities of all the
edges that cross the cut.
b) For every node in a network, the total flow into that node
equals the total flow out of that node.
c) The max flow in a network is less than or equal to the total
capacity of all edges directly connected to the sink.
d) The max flow in a network is less than the total capacity of
the edges in the min cut.
c)
c) Which of the following statements is correct?
a) An edge connecting s to t is always saturated when maximum
flow is reached.
b) If all capacities in a flow network are integers, then every max-
imum flow has integer flows on edges.
c) If in a flow network all edge capacities are distinct, then there
exists a unique min-cut.

4
d) If f is a maximum s − t flow in a flow network, then for all
edges out of s are saturated.
a)
d) Let X be a problem that belongs to the class N P . Which one of
the following is true?
a) X cannot be solved deterministically in polynomial time.
b) If X can be solved deterministically in polynomial time, then
P = NP .
c) X may be undecidable.
d) X can be solved in nondeterministic polynomial time.
d)
e) Which of the following statements is true?
a) If X and Y are reducible to each other, then X and Y are
N P -Complete.
b) If X and Y are N P -Complete, then X and Y are reducible to
each other.
c) N P -Hard is a subset of N P -Complete.
d) 2-SAT problem is N P -Complete.
b)
f) Let X, Y, Z be the problems which can be solved in time O(log n),
O(n3 ), O(2n ) respectively (where n denotes the input size). Then,
we can NOT conclude that
a) Y is reducible to X.
b) Y is reducible to Z.
c) Z is reducible to Y .
d) If Z is reducible to Y , then Z is reducible to X.
c)
g) Consider the linear program

5
max(31x + 55y)
subject to:
2x − y ≤ 80
y≥x
x≥0
y≥0
Which of the following statement(s) are true?
a) the linear program has a single optimal solution.
b) the linear program has infinitely many optimal solutions.
c) the linear program has no optimum solution.
c)
h) What is the feasible region in linear programming?
a) The set of all optimal solutions to the LP problem
b) The feasible region is the set of all feasible solutions that satisfy
the constraints of the LP problem.
c) The set of all feasible solutions that satisfy the objective func-
tion
d) The set of all solutions that satisfy the objective function
b). The feasible region is the set of all feasible solutions that
satisfy the constraints of the LP problem. It is the common re-
gion determined by all the constraints in the linear programming
problem.
i) Consider a linear program having an objective max cT x, and let
its dual have the objective min bT y. Let x and y be some feasible
solutions of the primal and dual respectively. Then,
a) cT x ≥ bT y.

6
b) cT x ≤ bT y.
c) cT x = bT y.
d) Any definitive comparison for the objectives is not possible.
b)
j) A feasible solution of Linear Programming
a) Must satisfy all the constraints.
b) Does not need satisfy all the constraints, but only some of
them.
c) Must be a corner point of the feasible region.
d) Must be the maximum of the objective function.
a)

7
3. Linear Programming (15 points)
A company produces three products, Product X, Product Y, and Prod-
uct Z. The company has a limited amount of resources, including pro-
duction time, labor, and materials. The goal is to maximize profits
subject to resource constraints. The following information is available:

• Each unit of Product X requires 1 hour of production time, 1 hour


of labor, and 2 units of raw materials. Each unit of Product Y
requires 2 hours of production time, 2 hours of labor, and 3 units
of raw materials.
• Each unit of Product Z requires 3 hours of production time, 4
hours of labor, and 2 units of raw materials.
• The company has 200 hours of production time, 250 hours of
labor, and 150 units of raw materials available.
• The profit per unit of Product X is $50, the profit per unit of
Product Y is $60, and the profit per unit of Product Z is $80.
• The company must produce at least 50 units of Product X, 75
units of Product Y, and 25 units of Product Z. The company can
only produce a maximum of 125 units in total.

Formulate a linear programming model to help the company maximize


profits. You do not have to solve the resulting LP.

a) Describe what your LP variables represent (3 points).


b) Show your objective function (3 points).
c) Show your constraints (9 points).

solution:

8
a) Let x be the number of units of Product X to produce, y be the
number of units of Product Y to produce, and z be the number
of units of Product Z to produce.
b) The objective function to maximize profits can be expressed as:

M aximize 50x + 60y + 80z

c) The constraints are as follows:


x + 2y + 3z ≤ 200 (production time constraint)
x + 2y + 4z ≤ 250 (labor constraint)
2x + 3y + 2z ≤ 150 (raw materials constraint)
x ≥ 50 (minimum production of Product X)
y ≥ 75 (minimum production of Product Y)
z ≥ 25 (minimum production of Product Z)
x + y + z ≤ 125 (total production capacity constraint)
x, y, z ≥ 0 (non-negativity constraint)

Rubrics (15 points):

• Define the correct LP variables (3 pts)


• Define the correct objective function (3 pts)
• Define the correct constraints (9 pts). -1 pt for each missing
constraint.

9
Figure 0.1: Question 4

4. Network Flow (20 points)


In the network above, the demand values are shown on vertices (supply
values are negative). Lower bounds on flow and edge capacities are
shown as (lower bound, capacity) for each edge. Determine if there
is a feasible circulation in this graph. Please complete the following
three steps below.

a) Turn the circulation with lower bounds problem into a circulation


problem without lower bounds (8 points).
b) Turn the circulation with demands problem into the max-flow
problem (7 points).
c) Does a feasible circulation exist? Explain your answer (5 points).

10
a)

b)
c) No, a feasible solution does not exist. Because the max-flow ver-
sion of the problem has a max flow of 9, which is less than the
sum of positive demands in the circulation problem w/o lower
bounds.

11
5. NP Completeness (20 points)
An organization is arranging an event spread over n days, namely
D1 , D2 , . . . , Dn , and needs volunteers to manage the event. On day
i, at least vi volunteers are needed. A total of m people, namely
P1 , P2 , . . . , Pm , have applied to volunteer with each applicant indicates
the availability. An applicant, if selected, must work on all the days
that he or she has indicated. The organization wants to select as few
volunteers as possible. Please complete the following five questions.

a) Phrase the above optimization problem as a decision problem and


show that it belongs to NP. (5 points)
b) Show a polynomial time construction using a reduction from Ver-
tex Cover.(6 points)
c) Write down the claim that the Vertex Cover problem is polyno-
mially reducible to the original problem. (3 points)
d) Prove the claim in the direction from the reduced problem to the
Vertex Cover problem. (3 points)
e) Prove the claim in the direction from the Vertex Cover problem
to the reduced problem. (3 points)

a) Given the Event Management instance and a number k, is it


possible to satisfy the complete volunteering requirement with at
most k applicants?
To show in NP, the certificate is the set of at most k applicants to
be selected. Assigning them to all the respective available days
and checking if each day has vi volunteers can be trivially done
in polynomial time.

12
b) Construction: We have a graph G = (V, E) as an input to the
VC problem.
- For each edge e in E, we construct a day De . (1 point)
- For each node v in V, we construct an applicant Pv . (1 point)
- Each applicant is available for all the days(edges) incident on
the corresponding vertex (equivalently, for each day De where
e = (u, v), only the two applicants Pu and Pv are available). (1.5
points)
- vi for each day Di is simply 1. (1.5 points)
The construction is done trivially in polynomial time.
c) Claim: VC instance has a vertex cover of size at mostk, if Event
Management can be done with at most k volunteers.
d) If the event management can select at most k applicants, we pick
the vertices corresponding to these applicants. Since for each
edge at least 1 applicant available that day was chosen, the cor-
responding vertex covers that edge, thus, the k vertices cover all
the selected nodes.
e) If the VC instance has a cover of size k, we simply select the
applicants corresponding to these nodes. For each day, we have
satisfied its requirement of 1 volunteer since the corresponding
edge is covered by at least one of the selected k vertices.

a) 5 points for correct answer. 3 points if incorrect/missing NP


argument or decision version of the problem.
b) 6 points for correct answer, -1.5 points for missing vi = 1. 3 points
for partially correct answer. 0 for incorrect answer.
c) 3 points for correct argument, 1.5 for partially correct answer or
d) 3 points if correct, provided part b) is also correct, else zero

13
e) 3 points if correct, provided part b) is also correct, else zero.

14
6. Approximation Algorithm (15 points)
There are N products with infinite supply available and the price of
each one of product i is pi , 1 ≤ pi ≤ 100. You have a $100 gift card,
and to better utilize it, you try to buy a bunch of products to maximize
the total value, subject to the limit $100. For example, if there are 3
products with prices $49.99, $89.99, $50, then the optimal solution is
to buy two product 3, and the total value is $100.

a) Suppose every price is more than 50, that is, for every i we have
50 < pi ≤ 100. Prove that you can find the optimal solution in
O(N ) time. (4 points)
b) Suppose there exists a price no more than 50, that is, there exists
an i so that 1 ≤ pi ≤ 50. Prove that buying ⌊100/pi ⌋ product
i alone is a 32 -approximation algorithm. Here ⌊x⌋ is the greatest
integer less than or equal to x, for example, when pi = 30, you
buy ⌊100/30⌋ = 3 product i. (6 points)
c) Without the assumptions in a) and b), design a 23 -approximation
algorithm that runs in O(N ). Prove your results. (5 points)

a) Since every price is more than 50, we can only buy one product
with amount 1.Thus, the optimal solution is buying one product
with the highest price, which can be found in O(N ) time.
b) We consider two cases: pi > 100 100 100
3 or pi ≤ 3 . If pi > 3 , we have
⌊100/pi ⌋ = 2 as 3pi > 100 and 2pi ≤ 100 by the assumption that
pi ≤ 50. Therefore, the approximation ratio is
2pi 2pi 200/3 2
≥ ≥ = .
OPT 100 100 3

15
On the other hand, by the definition of the floor function, we have

pi (⌊100/pi ⌋ + 1) ≥ 100 ⇒ pi ⌊100/pi ⌋ ≥ 100 − pi ,


100
so the approximation ratio is (recall that pi ≤ 3 in this case)

pi ⌊100/pi ⌋ pi ⌊100/pi ⌋ 100 − pi 200/3 2


≥ ≥ ≥ = .
OPT 100 100 100 3
c) Consider the following algorithm: if there exists an i so that 1 ≤
pi ≤ 50, buy ⌊100/pi ⌋ product i; otherwise, buy one product
with the highest price. The algorithm runs in O(N ) as both
finding i and the highest price can be done in linear time. From
b) we know that this is a 32 approximation if such an i exists;
otherwise, we know that the solution is optimal from the solution
of a). Therefore, we conclude the algorithm is a 23 approximation
overall.

• a) 4 points; 1 point for saying amount ≤ 1, 2 points for the algo-


rithm and mentioning that buying one product with the highest
price is optimal, 1 point for the runtime (no explanation is fine
but must say the runtime is O(N )/ linear)
• b) 6 points; 3 points for pi > 100 100
3 and 3 points for pi ≤ 3 ; in
pi > 100
3 , 1 point for ⌊100/pi ⌋ = 2 and 2 points for the remaining
inequalities; in pi ≤ 100
3 , 1 point for the total value ≥ 100 − pi and
2 points for the remaining inequalities; give 3 points if identify
the worst case is 1003 (or 34, 33.33) and correctly calculate the
approximation ratio
• c) 5 points; 2 points for the algorithms, 1 point for the runtime,
and 2 points for the proof; no more deduction on the algorithm

16
if the wrong algorithm in a) is used; no deduction for using the
approximation in b) even if the proof in b) is missing or wrong

17
Additional space

18
Additional space

19

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy