Skip to content

Commit 596bf8b

Browse files
Practice Problems
1 parent 32c8b11 commit 596bf8b

29 files changed

Lines changed: 276 additions & 78 deletions

OMSCS/Courses/GA/06.5 - NP - Graph Problems.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ $IS \rightarrow VC$
321321
- [[8.4 - Clique 3]]
322322
- [[8.10 - NP-Completeness by Generalization]]
323323
- [[8.14 - Clique + IS (TODO)]]
324-
- [[8.19 - Kite (TODO)]]
324+
- [[8.19 - Kite]]
325325

326326
Remember for all of these practice problems, and for future homeworks in this course.
327327
- Follow this general procedure

OMSCS/Courses/GA/Office Hours/2026-03-15 - TA Office Hours - Exam 2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This OH covers the following strategies, outlined below. It also covers the foll
3434

3535
## Max-Flow Strategies
3636
- Convert to flow network
37-
- [[7.3 - Cargo Plane (TODO)]]
37+
- [[7.3 - Cargo Plane]]
3838
- Adding new source and sink
3939
- Updating capacities
4040
- infinite capacity

OMSCS/Courses/GA/Practice Problems/7.1 - Dual LP Optimality (TODO).md

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
tags:
3+
- OMSCS
4+
- Algorithms
5+
- Practice
6+
---
7+
# 7.1 - Geometric Solution for an LP
8+
9+
Consider the following LP
10+
11+
- $\max 5x + 3y$
12+
- $5x-2y\ge0$
13+
- $x+y \le 7$
14+
- $x \le 5$
15+
- $x,y \ge 0$
16+
17+
Plot the feasible region and identify the optimal solution.
18+
19+
## Normal Form
20+
- $\max 5x + 3y$
21+
- $-5x+2y\le0$
22+
- $x+y \le 7$
23+
- $x \le 5$
24+
- $0 \le x,y$
25+
26+
## Plot
27+
The green line is $5x+3y=31$. This line intersects the shaded region at $(x=5,y=2)$. This solution satisfies all constraints and is optimal.
28+
29+
![[Pasted image 20260403203210.png]]

OMSCS/Courses/GA/Practice Problems/7.3 - Cargo Plane (TODO).md renamed to OMSCS/Courses/GA/Practice Problems/7.3 - Cargo Plane.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tags:
44
- Algorithms
55
- Practice
66
---
7-
# 7.3 - Cargo Plane (TODO)
7+
# 7.3 - Cargo Plane
88
![[Pasted image 20260317223151.png]]
99

1010
The cargo plane has a capacity. Maximum of 100 tons and 60 $m^3$. There are 3 materials which can be transported:
@@ -22,3 +22,23 @@ The cargo plane has a capacity. Maximum of 100 tons and 60 $m^3$. There are 3 ma
2222
- 20 cubic meters available
2323
- $12,000 per cubic meter
2424

25+
## Standard Form
26+
- Objective: $\max \space (1000)m_1+(1200)m_2+(12000)m_3$
27+
- Constraints
28+
- $m_1,m_2,m_3 \ge 0$
29+
- $m_1 \le 40$
30+
- $m_2 \le 30$
31+
- $m_2 \le 20$
32+
- $2m_1+m_2+3m_3 \le 100$
33+
- $m_1+m_2+m_3 \le 60$
34+
35+
## Geometric View
36+
![[Pasted image 20260403205315.png]]
37+
38+
![[Pasted image 20260403205324.png]]
39+
40+
![[Pasted image 20260403205422.png]]
41+
42+
![[Pasted image 20260403205433.png]]
43+
44+
![[Pasted image 20260403205441.png]]

OMSCS/Courses/GA/Practice Problems/7.4 - LP for Duff Beer (TODO).md

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
tags:
3+
- OMSCS
4+
- Algorithms
5+
- Practice
6+
---
7+
# 7.4 - LP for Duff Beer
8+
> Moe is deciding how much Regular Duff beer and how much Duff Strong beer to order each week. Regular Duff costs Moe $1 per pint and he sells it at $2 per pint; Duff Strong costs Moe $1.50 per pint and he sells it at $3 per pint. However, as part of a complicated marketing scam, the Duff company will only sell a pint of Duff Strong for each two pints or more of Regular Duff that Moe buys. Furthermore, due to past events that are better left untold, Duff will not sell Moe more than 3,000 pints per week. Moe knows that he can sell however much beer he has. Formulate a linear program for deciding how much Regular Duff and how much Duff Strong to buy, so as to maximize Moe’s profit. Solve the program geometrically.
9+
10+
- Variables
11+
- $dr:$ Pints of Duff Regular
12+
- $ds:$ Pints of Duff Strong
13+
14+
The complicated part of this problem is "the Duff company will only sell a pint of Duff Strong for each two pints or more of Regular Duff that Moe buys". This essentially says:
15+
16+
- $ds \le \frac{1}{2}dr$
17+
- $ds - 0.5dr \le 0$
18+
- If $ds-0.5dr = 0$, then Moe bought 2x as much Regular Duff as he did Strong Duff.
19+
- If $ds-0.5dr < 0$, then Moe bough the more than 2x Regular Duff than he did Strong Duff.
20+
- If $ds - 0.5dr > 0$, then Moe is in breach of contract.
21+
- I guess it wasn't that complicated.
22+
- (Turns out it was a little complicated. I originally had $ds \le 2dr$, which had the opposite effect.)
23+
24+
## Standard Form
25+
- Objective, maximize weekly profit: $\max \space (2-1)dr + (3-1.50)ds$
26+
- Constraints
27+
- $dr,ds \ge 0$
28+
- $dr+ds \le 3000$
29+
- $ds - 0.5dr \le 0$
30+
31+
## Geometric Solution
32+
![[Pasted image 20260403215232.png]]
33+
34+
The purple line is $dr+1.5ds=3500$, which intersects the region of feasibility at $(dr=2000,ds=1000)$. This meets the specified constraints and maximizes profit.

OMSCS/Courses/GA/Practice Problems/7.5 - LP for Canine Products (TODO).md

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
tags:
3+
- OMSCS
4+
- Algorithms
5+
- Practice
6+
---
7+
# 7.5 - LP for Canine Products
8+
> The Canine Products company offers two dog foods, Frisky Pup and Husky Hound, that are made from a blend of cereal and meat. A package of Frisky Pup requires 1 pound of cereal and 1.5 pounds of meat, and sells for $7. A package of Husky Hound uses 2 pounds of cereal and 1 pound of meat, and sells for $6. Raw cereal costs $1 per pound and raw meat costs $2 per pound. It also costs $1.40 to package the Frisky Pup and $0.60 to package the Husky Hound. A total of 240,000 pounds of cereal and 180,000 pounds of meat are available each month. The only production bottleneck is that the factory can only package 110,000 bags of Frisky Pup per month. Needless to say, management would like to maximize profit.
9+
>
10+
> (a) Formulate the problem as a linear program in two variables.
11+
>
12+
> (b) Graph the feasible region, give the coordinates of every vertex, and circle the vertex maximizing profit. What is the maximum profit possible?
13+
14+
- Variables
15+
- $f$ - Frisky Pup
16+
- $h$ - Husky Hound
17+
- costs
18+
- cereal costs $1
19+
- meat costs $2
20+
- Availability
21+
- 240,000 cereal
22+
- 180,000 meat
23+
- 110,000 Frisky Bags
24+
- $f$
25+
- requires 1 cereal ($\$1$)
26+
- requires 1.5 meat ($1.5*\$2=\$3$)
27+
- sells for $\$7$
28+
- ingredient cost: $\$4$
29+
- packaging costs: $\$1.40$
30+
- profit: $\$7-\$4-\$1.4=\$1.6$
31+
- $h$
32+
- requires 2 cereal ($\$2$)
33+
- requires 1 meat ($\$2$)
34+
- sells for $\$6$
35+
- ingredient cost: $\$4$
36+
- packaging cost: $\$0.6$
37+
- profit: $\$6-\$4-\$0.6=\$1.4$
38+
- Timespan: Monthly
39+
40+
## Standard Form
41+
- Objective: $\max \space 1.6f+1.4h$
42+
- Constraints:
43+
- $f,h \ge 0$
44+
- $f \le 1.1*10^5$
45+
- $f+2h \le 2.4*10^5$
46+
- $1.5f+h \le 1.8*10^5$
47+
48+
## Graph
49+
$f$ is on the x-axis. $h$ is on the y-axis. Purple is at $p=\$2.22*10^5$, which intersects the feasible region at $(h=9*10^4,f=6*10^4)$.
50+
51+
![[Pasted image 20260403221422.png]]
52+
53+
All of the vertex pairs are:
54+
55+
| f | h | Profit |
56+
| ------- | ------- | ------------ |
57+
| 0 | 0 | 0 |
58+
| 110,000 | 0 | $176,000 |
59+
| 110,000 | 15,000 | $197,000 |
60+
| 60,000 | 90,000 | **$222,000** |
61+
| 0 | 120,000 | $168,000 |
62+
63+
These coordinates can be determined by taking the intersection of pairs of constraint boundaries, and checking whether that point is feasible against the other constraints.

OMSCS/Courses/GA/Practice Problems/7.6 - Unbounded Feasible LP (TODO).md

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)