Skip to content

Commit 52928d8

Browse files
More PPs
1 parent a34bf91 commit 52928d8

5 files changed

Lines changed: 100 additions & 31 deletions

File tree

OMSCS/Courses/GA/Practice Problems/7.99.2 - Feasibility and Boundedness (TODO).md

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
tags:
3+
- OMSCS
4+
- Algorithms
5+
- Practice
6+
---
7+
# 7.99.2 - Feasibility and Boundedness
8+
Check whether this LP is feasible/unbounded using the processes from [[07.3 - LP - Geometry]] and [[07.4 - LP - Duality]].
9+
10+
- $\max \space 3x_1+x_2$
11+
- s.t.
12+
- $x_1-2x_2 \le -2$
13+
- $-x_1 \le -2$
14+
- $-x_1+x_2 \le 8$
15+
- $x_1,x_2 \ge 0$
16+
17+
Geometrically, this one appears to be feasible and unbounded.
18+
19+
https://www.desmos.com/calculator/nzgrihtw2b
20+
21+
This problem has the same conditions from [[7.99.1 - Feasibility and Boundedness]], but the objective function differs. We can skip the feasibility check and move on to checking for boundedness.
22+
23+
The dual is
24+
25+
- $\min \space -2y_1 - 2y_2 + 8y_3$
26+
- s.t.
27+
- $y_1-y_2-y_3 \ge 3$
28+
- $-2y_2 + y_3 \ge 1$
29+
- $y_1,y_2,y_3 \ge 0$
30+
31+
For this one, I don't see any obvious tricks, so we just need to exhaustively go through the motions.
32+
33+
EQs
34+
1. $y_1=0$
35+
2. $y_2=0$
36+
3. $y_3=0$
37+
4. $y_1-y_2-y_3 = 3$
38+
5. $-2y_1+y_3 = 1$
39+
40+
| EQs | Point | Within Constraints ? |
41+
| ----- | ------------- | -------------------- |
42+
| 1,2,3 | (0,0,0) | No (#4, #5) |
43+
| 1,2,4 | (0,0,-3) | No (#3) |
44+
| 1,2,5 | (0,0,1) | No (#4) |
45+
| 1,3,4 | (0,-3,0) | No (#2) |
46+
| 1,3,5 | (0,?,0) | No solution. |
47+
| 1,4,5 | (0,-4,1) | No (#2) |
48+
| 2,3,4 | (3,0,0) | No (#5) |
49+
| 2,3,5 | (-0.5,0,0) | No (#1) |
50+
| 2,4,5 | (4,0,9) | No (#4) |
51+
| 3,4,5 | (-0.5,-3.5,0) | No (#1, #2) |
52+
Given that the feasible region is empty for the Dual LP, that implies that the Primal LP is either infeasible or unbounded. Given that the Primal LP has been shown to be feasible, this implies that **the Primal LP is unbounded.**
53+

OMSCS/Courses/GA/Practice Problems/8.9 - Hitting Set (TODO).md

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
tags:
3+
- OMSCS
4+
- Algorithms
5+
- Practice
6+
---
7+
# 8.9 - Hitting Set
8+
> In the HITTING SET problem, we are given a family of sets $\{S_1,S_2,...,S_n\}$ and a budget b, and we wish to find a set H of size $\le b$ which intersects every $S_i$, if such an $H$ exists. In other words, we want $H∩S_i \ne ∅$ for all $i$.
9+
>
10+
> Show that HITTING SET is NP-complete.
11+
12+
## HS is in NP
13+
The HS problem can be verified by the following process.
14+
15+
We first check to make sure that $|H| \le b$. This requires $O(b)$ time. We assert that the problem is trivial if $b=0$ or $b \ge n$, so we simplify $O(b) = O(n)$.
16+
17+
We next check to make sure that $\forall_i H \cap S_i \ne \emptyset$. This requires that we scan each $S_i$ to see if it contains at least one element in $H$. We define $m$ to be the number of unique elements across all sets. In the worst case, every $S_i$ contains all $m$ elements in ascending order, and $H$ contains the last $n$ of the $m$ elements. The first $m-n$ elements of each of the $n$ sets will need to be compared against all $n$ elements of $H$. This requires $O((m-n)n^2)$ time.
18+
19+
Therefore, the overall runtime for validating a solution to an HS problem is polynomial in the size of the input, proving that HS is in NP.
20+
21+
## Reduction from VC
22+
We will now demonstrate a reduction from the VC problem to the HS problem, which proves that the HS problem is in NP-Hard.
23+
24+
### Input Transformation
25+
First, set the budget for the HS problem to the budget of the VC problem. ($O(1)$).
26+
27+
Next, for each edge $(u,v)$ in $G$, create a new set $S_{uv}$ which contains $u$ and $v$. This will generate $|E|$ sets each with exactly 2 members.
28+
29+
The time complexity for this transformation is $O(n+m)$.
30+
31+
### Output Transformation
32+
If there is no solution to the HS problem, return "no" as the solution to the VC problem.
33+
34+
If there is a solution $H$, return $S=H$ as the solution to the VC problem without modification. The time complexity for this transformation is $O(1)$.
35+
36+
### Justification
37+
We model the edges of $G$ as sets of vertices. A Hitting Set (HS) across those sets represents a subset of the vertices V which intersects with all sets. Since the sets are a representation of the edges of G, this means the HS covers the edges of G.
38+
39+
As an interesting and irrelevant note, the degree of each vertex v in G equates to the number of sets that in which it appears in the HS problem instance.
40+
41+
If there exists a solution to the HS problem, then there exists a subset H of V of size $b$ which intersects with all of the sets in the HS problem. The sets in the HS problem map to the edges of G in the VC problem. The values in the sets in the HS problem map to the vertices of G in the VC problem. Therefore, $H$ is also a VC in $G$.
42+
43+
If there does not exist a solution to the HS problem, there there does not exist a subset H of V of size $b$ which intersects with all of the sets in the HS problem. Therefore, there does not exist a solution to the VM problem, since we've already demonstrated that we can model the VC problem as an HS problem.
44+
45+
## Conclusion
46+
The HS problem has a polynomial-time verification algorithm, which proves that the HS problem is in NP. The VC problem can be reduced to the HS problem, proving that the HS problem is in NP-Hard. Therefore, the HS problem is in NP-Complete.

OMSCS/Courses/GA/Practice Problems/Homework 10 Practice Problems.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tags:
77
# Homework 10 Practice Problems
88
## NP Theory
99
- **[DPV] Problem 8.9** (Hitting Set)
10-
- [[8.9 - Hitting Set (TODO)]]
10+
- [[8.9 - Hitting Set]]
1111
- **[DPV] Problem 8.19** (Kite)
1212
- [[8.19 - Kite]]
1313
## Linear Programming

0 commit comments

Comments
 (0)