0% found this document useful (0 votes)
55 views5 pages

Assignment 2 - CSE 4131

The document outlines an assignment for an algorithms design course. It provides instructions for submitting the assignment by June 14th and notes that answers should be written with detail and proofs of correctness. It then lists 11 questions related to algorithms topics like planning problems, approximation algorithms, and NP-completeness. The questions cover concepts like formulating planning instances, analyzing approximation bounds, and applying algorithms to solve problems like vertex cover, facility location, and load balancing.

Uploaded by

Babio Gando
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)
55 views5 pages

Assignment 2 - CSE 4131

The document outlines an assignment for an algorithms design course. It provides instructions for submitting the assignment by June 14th and notes that answers should be written with detail and proofs of correctness. It then lists 11 questions related to algorithms topics like planning problems, approximation algorithms, and NP-completeness. The questions cover concepts like formulating planning instances, analyzing approximation bounds, and applying algorithms to solve problems like vertex cover, facility location, and load balancing.

Uploaded by

Babio Gando
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

Dept. of Comp. Sc. and Engg.

, ITER, S'O'A Deemed To Be University

CSE 4131: ALGORITHM DESIGN II

ASSIGNMENT 2:

Submission due date: 14th June 2023

--------------------------------------------------------------------------------------------------------------------------------------------------------

 Assignment scores/markings depend on neatness and clarity.


 Write your answers with enough detail about your approach and concepts used, so that the grader will be able to understand it easily. You should ALWAYS
prove the correctness of your algorithms either directly or by referring to a proof in the book.
 The marking would be out of 100.
 You are allowed to use only those concepts which are covered in the lecture class till date.
 Plagiarized assignments will be given a zero mark.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CO2: distinguishbetween computationally tractable and intractable problems.
-define and relate class-P, class-NP and class NP-complete, PSPACE, PSPACE-complete.
-given a problem in NP, define an appropriate certificate and the verification algorithm.
CO3: understand approximation algorithms and apply this concept to solve some problems for which polynomial
time exact solutions are probably unattainable.
CO6: identify and apply an appropriate algorithmic approach to solve a problem and explain the challenges to
solve it.

Sl.No. Question PO Level

1. Using the (conditions, operators) model, formulate a planning instance for the L2, L3
fifteen-puzzle problem — a 4 × 4 grid with fifteen movable tiles labeled as 1, 2, . . . PO1,
, 15, and a single hole, with the goal of moving the tiles around so that the numbers PO2
on the tiles end up in ascending order.

2. Given an instance of 8-puzzle game as follows. L2, L3, L4

1 2 3
4 5 8
PO1,
7 6 PO2

a. Map the problem into an instance of planning problem.


b. Identify each operators and their corresponding prerequisite list, add list
and delete list.
c. Can we achieve the goal state from the current configuration? Justify your
answer.

3. Prove the following statement. “If a Planning instance with n conditions has a PO1, L2, L3, L4
solution, then it has one using at most 2𝑛𝑛 − 1 steps.” PO2
4. Given an instance of the QSAT problem as follows. L2, L3, L4

𝜑𝜑 = (𝑥𝑥1 ∨ 𝑥𝑥2 ∨ 𝑥𝑥3 ) ∧ (𝑥𝑥1 ∨ 𝑥𝑥 ���2 ∨ 𝑥𝑥3 ) ∧ (𝑥𝑥1 ∨ 𝑥𝑥


���2 ∨ 𝑥𝑥 3 ∧ (𝑥𝑥
���) ���1 ∨ ���
𝑥𝑥4 ∨ 𝑥𝑥
���)
5
∧ (𝑥𝑥
���1 ∨ 𝑥𝑥2 ∨ 𝑥𝑥4 ) ∧ (𝑥𝑥2 ∨ 𝑥𝑥3 ∨ 𝑥𝑥5 ) ∧ (𝑥𝑥 ���2 ∨ 𝑥𝑥4 ∨ ���)𝑥𝑥5 ∧ (𝑥𝑥 ���3 ∨ 𝑥𝑥5 )
���2 ∨ 𝑥𝑥
∧ (𝑥𝑥2 ∨ 𝑥𝑥 ���3 ∨ 𝑥𝑥4 ) ∧ (𝑥𝑥3 ∨ ���
𝑥𝑥4 ∨ 𝑥𝑥5 ) PO1,
PO3
∀𝑥𝑥1 ∃𝑥𝑥2 ∀𝑥𝑥3 ∃𝑥𝑥4 ∀𝑥𝑥5 𝜑𝜑 (𝑥𝑥1 , 𝑥𝑥2 , 𝑥𝑥3 , 𝑥𝑥4 , 𝑥𝑥5 )?

Draw the recursion tree that leads to all possible truth assignments for the given
QSAT. Check each assignment for the solution of 𝜑𝜑.

5. Given a new problem P, being a student of Algorithm Design, discuss in detail, the L2, L3, L4
PO1,
possible options/approaches you will explore to solve the problem using a
PO4
computer.

6. Prove that, COMPETITIVE-FACILITY-LOCATION ∈ PSPACE-complete. PO1, L2, L3, L4


PO2

7. Consider a statement - “The intractability of Vertex Cover decision problem only L2, L3, L4
sets in for real, once k grows as a function of n.” (Where n is the number of nodes PO1,
in the graph, and k is the allowable size of a vertex cover.) Justify the statement PO2
with proper reasoning.

8. The Uncapacitated facility location problem can be defined as follows. L2, L3, L4

Given a set D of clients and a set F of potential facility locations, a distance


function d ∶ D × F → 𝑅𝑅 + is defined which denotes a cost 𝑑𝑑𝑖𝑖𝑖𝑖 of assigning client j
to facility i, and a cost function f ∶ F → 𝑅𝑅 + associated with each facility i ∈ F.
The goal is to choose a subset of facilities S ⊆ F so as to minimize the total cost of
the facilities in S and the cost of assigning each client j ∈ D to the nearest facility in PO1,
S. i.e., PO2,
Output: S ⊆ F that minimizes ∑𝑖𝑖∈𝑆𝑆 𝑓𝑓𝑖𝑖 + ∑𝑗𝑗∈𝐷𝐷 (min 𝑑𝑑𝑖𝑖𝑖𝑖 ) where 𝑓𝑓𝑖𝑖 : cost of facility 𝑖𝑖
𝑖𝑖∈𝑆𝑆 PO3
and 𝑑𝑑𝑖𝑖𝑖𝑖 is the distance function value between client i and facility j.

a. Give an 𝑂𝑂(log|𝐷𝐷|) approximation algorithm for the given Uncapacitated


facility location problem.

b. Prove the bound on the approximation ratio.

9. Greedy-Balance (n, m, t[1...n]) { PO1, L1, L2,


Start with no jobs assigned PO2, L3, L4
PO3
Set 𝑇𝑇𝑖𝑖 = 0 and A(i) = ∅ for all machines 𝑀𝑀𝑖𝑖
Dept. of Comp. Sc. and Engg., ITER, S'O'A Deemed To Be University

For j = 1, . . . , n do {
Let 𝑀𝑀𝑖𝑖 be a machine that achieves the minimum load min 𝑇𝑇𝑘𝑘
𝑘𝑘

Assign job j to machine 𝑀𝑀𝑖𝑖


Set A(i) ← A(i) ∪ { j }
Set 𝑇𝑇𝑖𝑖 ← 𝑇𝑇𝑖𝑖 + 𝑡𝑡𝑗𝑗
}
return A[1], A[2],…, A[m]
}
(a) Show that the algorithm Greedy-Balance produces an assignment of jobs to
machines with a makespan T ≤ 2𝑇𝑇 ∗ .
(b) What will be the resulting makespan of running this greedy algorithm on a
sequence of six jobs with processing times 2, 3, 4, 6, 2, 2 for three identical
machines?
(c) In the load balancing problem, suppose we have m machines and n = m(m − 1)
+ 1 jobs. Each of the first m(m − 1) = n − 1 jobs require time 𝑡𝑡𝑗𝑗 = 1. The last job is
much larger with processing time 𝑡𝑡𝑛𝑛 = 𝑚𝑚. What does our above greedy
approximation algorithm do with this sequence of jobs? Show that the
approximation ratio is close to a factor of 2 when m is large.

10. Greedy-Center-Selection(S, d, k) L2, L3, L4

Assume that 𝑘𝑘 ≤ |𝑆𝑆| (If not then return )


Select any site s ∈ 𝑆𝑆 and let 𝐶𝐶 ← {𝑠𝑠}
While |𝐶𝐶| < 𝑘𝑘
Select a site s ∈ 𝑆𝑆 that maximizes 𝑑𝑑(𝑠𝑠, 𝐶𝐶) PO1,
Add s to C: 𝐶𝐶 ← 𝐶𝐶 ∪ {s} PO2
End while
return 𝐶𝐶 as the set of selected centers

Show that Greedy-Center-Selection algorithm returns a set 𝐶𝐶 of k centers such that


the covering radius 𝑟𝑟(𝐶𝐶) ≤ 2𝑟𝑟(𝐶𝐶 ∗ ), where 𝐶𝐶 ∗ is an optimal set of k centers.

11. Consider an example scenario of Center-Selection problem with only two sites s L2, L3, L4
and z, and the number of centers k = 2. Assume that s and z are located in the plane, PO1,
with distance equal to the standard Euclidean distance in the plane, and that any PO2
point in the plane is an option for placing a center. Let d be the distance between s
and z. Then find the best location for (i) Case1: a single center c1 and (ii) Case2:
then subsequent best location for second center c2. In each case, also find the
optimal covering radius r(C).

12. Given an approximation algorithm for weighted-set-cover problem as below: L2, L3, L4
Greedy-Set-Cover (U, 𝑆𝑆1 , … , 𝑆𝑆𝑚𝑚 , w) {
Start with 𝑅𝑅 ← 𝑈𝑈 (No element is covered yet)
Initialize 𝐶𝐶 ← ∅ (No set is selected yet)
While 𝑅𝑅 ≠ ∅
𝑤𝑤𝑖𝑖
Select a set 𝑆𝑆𝑖𝑖 that minimizes |𝑆𝑆 ∩𝑅𝑅|
𝑖𝑖

Add 𝑆𝑆𝑖𝑖 to C: 𝐶𝐶 ← 𝐶𝐶 ∪ {𝑆𝑆𝑖𝑖 }


PO1,
Delete the elements of 𝑆𝑆𝑖𝑖 from 𝑅𝑅
PO2,
End while PO3
Return 𝐶𝐶 as the set cover

Using the above algorithm, find the solution C for the following set-cover problem
instance and compare this solution with the optimal solution C*.
A Set-Cover instance is given as, U={1,2,3,4,5,6,7,8}, and list of subsets
S1={1,3,5,7}, S2={2,4,6,8}, S3={1}, S4={2}, S5={3,4}, S6={5,6,7,8} and the
weight array w[ ] = {1+ε, 1+ε, 1,1,1,1,1,1}, where ε is a very small value between 0
and 1.

13. Given an approximation algorithm for weighted-vertex-cover problem as below:


Vertex-Cover-Approx( G, w ) {
Set 𝑝𝑝𝑒𝑒 = 0 for all e ∈ E
While (there is an edge e = (i, j) such that neither i nor j is tight) {
Select such an edge e
PO1,
Increase 𝑝𝑝𝑒𝑒 without violating fairness PO2,
} PO3
Let S be the set of all tight nodes
Return S
}
Using the above algorithm, find the weighted-vertex-
Dept. of Comp. Sc. and Engg., ITER, S'O'A Deemed To Be University

cover for the given graph with four vertices having vertex weights/costs 2, 2, 4 and
9. Compare your solution with the optimal solution for this example.

14. Prove that: “For any vertex cover S, and any nonnegative and fair prices 𝑝𝑝𝑒𝑒 , we PO1, L2, L3
have Σ 𝑝𝑝 ≤ 𝑤𝑤(𝑆𝑆).” (Fairness lemma) PO2
e∈E 𝑒𝑒

15. Show that “the set S returned by the algorithm (mentioned in Q13) is a vertex PO1, L2, L3
cover, and its cost is at most twice the minimum cost of any vertex cover.” PO2

16. Give a critical comparison between the two versions of the Dynamic Programming L2, L3
based solutions described as follows to solve the Knapsack problem.
i. The first version formulate the structure of the sub problems as OPT(i, w):
the sub problem to compute the maximum value of any solution using a PO1,
subset of items 1,…,i and a knapsack of capacity w. PO2
ii. The second version formulate the structure of the sub problems as OPT(i, v):
the sub problem of finding the minimum weight of a knapsack for which we
can obtain a solution of value at least v using a subset of items 1,…,i.

17. Give a comparison between Approximation algorithm, Approximation scheme and PO1, L2, L3
Fully polynomial-time approximation scheme with examples. PO2

18. Though Vertex-Cover ≤𝑝𝑝 Set-Cover, why do they have different lower bounds on PO1, L2, L3
the approximability? PO2

19. Compare the fairness conditions used in the approximation solutions for Weighted- PO1, L2, L3
Set-Cover and Weighted-Vertex-Cover problems. PO2

20. Show that the approximation algorithm we studied in the class for the Knapsack L2, L3
PO1,
problem always runs in polynomial time even if the values and weights are large
PO2
and achieves the approximation ratio (1+ε).

Submission and Grading:

Submit the hard copy of your assignment by the due date, i.e. 14.06.2023.

Part of your assignment grade comes from its "external correctness." This is based on correct output on various sample inputs.

The rest of your assignment's score comes from "internal correctness." Internal correctness includes:
1. Use of methods to minimize the number of steps.
2. Appropriate use of rules, axioms, and suitable diagrams to enhance readability of your responses.

Send a zip folder (name of the zip folder must be your registration number_AD2) containing the code and output file/screen-shot of each program
implementation mentioned to the official email id of your AD2 class teacher. On the top of each program, you must mention your full name, registration
number, title of the program and date.

You might also like