Skip to content

Commit

Permalink
wrote something
Browse files Browse the repository at this point in the history
  • Loading branch information
anaclumos committed Dec 2, 2023
1 parent 3251790 commit 44af252
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 17 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ everything I know! [Dive down the rabbit hole now](https://cho.sh/random)!

## Last updated

Thu Nov 30 22:16:03 PST 2023
Fri Dec 1 20:09:54 PST 2023

## Stats

```
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Blanks Comments Code Complexity
───────────────────────────────────────────────────────────────────────────────
Markdown 2271 57683 14989 0 42694 0
Markdown 2273 57877 15052 0 42825 0
CSS 70 20359 792 36 19531 0
TypeScript 59 18720 178 49 18493 165
TypeScript 59 18731 178 49 18504 165
JSON 16 1632 0 0 1632 0
YAML 12 17547 1882 3 15662 0
SVG 9 9 0 0 9 0
Expand All @@ -47,13 +47,13 @@ TypeScript Typings 2 15 1 4 10 0
gitignore 2 296 69 69 158 0
JavaScript 1 19 3 12 4 0
───────────────────────────────────────────────────────────────────────────────
Total 2454 117255 17984 203 99068 248
Total 2456 117460 18047 203 99210 248
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $3,367,637
Estimated Schedule Effort (organic) 21.82 months
Estimated People Required (organic) 13.71
Estimated Cost to Develop (organic) $3,372,706
Estimated Schedule Effort (organic) 21.83 months
Estimated People Required (organic) 13.73
───────────────────────────────────────────────────────────────────────────────
Processed 5528312 bytes, 5.528 megabytes (SI)
Processed 5535484 bytes, 5.535 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────
```
Binary file added Research/assets/BCFFB7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion Research/journals/2023-11-29.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ slug: '/2023-11-29'

- [[Project Impruneta]]
- [[Borrowing a Book from USC]]
- [[Person 4F439C]]
- [[Person 4460DA]]

![[BCFFB7.png]]
7 changes: 7 additions & 0 deletions Research/journals/2023-12-01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
date: '2023-12-01'
lang: 'en'
slug: '/2023-12-01'
---

- [[Discrete Mathematics]]
185 changes: 185 additions & 0 deletions Research/pages/Discrete Mathematics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
---
lang: 'en'
slug: '/21FE92'
---

## Dynamic Programming

- **Optimal substructure**. The optimal solution to a problem consists of optimal solutions to subproblems.
- **Overlapping subproblems**. few subproblems in total, many recurring instances of each.

## Bellman-Ford

shortest path, negative possible.

$$
\text{OPT}[v,k] = \min(\text{OPT}[v, k-1], \text{OPT}[u, v] + w(u,v))
$$

## Chain Matrix Multiplication

$$
\text{OPT}[i, j] = \text{OPT}[i, k] + \text{OPT}[k+1, j] + \text{combine}
$$

## Min Cut

The set of vertices reachable from source s in the residual graph is one part of the [[partition]]. Cut capacity $\text{cap}(A, B) = \sum_{\text{out A}} c(e)$.

$$
|f| = \sum_{e~\text{out of X}} f(e) - \sum_{e~\text{into X}} f(e)
$$

- maxflow = Min $\text{cap}(A, B)$.

## Ford-Fulkerson

Given $(G, s, t, c \in \mathbb{N}+)$, start with $f(u,v)=0$ and $G_f =G$. While an augmenting path is in $G_f$, find a bottleneck. Augment the flow along this path and update the residual graph $G_f$. $\mathcal{O}(|f| (V+E))$.

## Edmond-Karp

Ford-Fulkerson, but choose the shortest augmenting path.

For any flow $f$ and any $(A,B)$ cut, $|f| ≤ \text{cap}(A,B)$. For any flow $f$ and any $(A,B)$ cut, $$|f| = \sum_f (s, v) = \sum_{u \in A,~v \in B} f(u, v) - \sum_{u \in A,~v \in B} f(v, u)$$

## Solving by Reduction

To reduce a problem $Y$ to a problem $X$ ($Y \leq_{p} X$) we want a function $f$ that maps $Y$ to $X$ such that $f$ is a polynomial time computable and $\forall y \in Y$ is solvable if and only if $f(y) \in X$ is solvable.

## Reduction to NF

Describe how to construct a flow network. Claim "This is feasible if and only if the max flow is …". Prove both directions.

## Bipartite to Max Flow

- Max Matching ⟹ Max Flow. If k edges are matched, then there is a flow of value k.
- Max matching ⟸ Max flow. If there is a flow f of value k, there is a matching with k edges.
- $\mathcal{O}(|f| (E' + V'))$
- $|f| = V$
- $V' = 2V + 2$
- $E' = E + 2V$
- $\mathcal{O}(V (E + 2V + 2V + 2)) = \mathcal{O}(V E + V^2) = \mathcal{O}(V E)$

## Circulation

- $d(v) > 0$ if demand
- $d(v) < 0$ if supply
- Capacity Constraint $0 \leq f(e) \leq c(e)$
- Conservation Constraint $f^{\text{in}} (v) - f^{\text{out}} (v) = d(v)$.
- For every feasible circulation $\sum_{v \in V} d(v) = 0$, there is a feasible circulation with demands $d(v)$ in $G$ if and only if the maximum $s-t$ flow in $G'$ has value $D = \sum_{d(v)>0} d(v)$.

## Circulation with Demands and Lower Bounds.

- Capacity Constraint $l(e) \leq f(e) \leq c(e)$
- Conservation Constraint $f^{\text{in}} (v) - f^{\text{out}} (v) = d(v)$
- Given $G$ with lower bounds, we subtract the lower bound $l(e)$ from the capacity of each edge.
- Subtract $f_0^{\text{in}}(v) − f_0^{\text{out}}(v) = L(v)$ from the demand of each node.
- Solve the circulation problem on this new graph to get a flow $f$.
- Add $l(e)$ to every $f(e)$ to get a flow for the original graph.

## Existence of Linear Programming Solution.

- Given an Linear Programming problem with a feasible set and an objective function $P$.
- If $S$ is empty, Linear Programming has no solution.``
- If $S$ is unbounded, Linear Programming may or may not have the solution.
- If $S$ is bounded, Linear Programming has one or more solutions.

## Standard Form Linear Programming

- $\max (c_1x_1 + \cdots + c_nx_n)$
- subject to
- $a_{11}x_1 + \cdots + a_{1n}x_n ≤ b_1$
- all the way to
- $a_{m1}x_1 + \cdots + a_{mn}x_n ≤ b_m$.
- Also, $x_1 \geq 0, \cdots, x_n \geq 0$.

## Matrix Form Linear Programming

- $\max(c^T x)$
- subject to
- $Ax \leq b$
- $x \geq 0$
- $x \in \mathbb{R}$

## Integer Linear Program

- all variables $\in \mathbb{N}$
- is NP-Hard

## Dual Program

- $\min(b^T y)$
- subject to
- $A^T y \geq c$
- $y \geq 0$
- $y \in \mathbb{R}$

### Weak Duality

- The optimum of the dual is an upper bound to the optimum of the primal.
- $\text{OPT}(\text{primal}) ≤ \text{OPT}(\text{dual})$.

### Strong duality

- Let P and D be primal and dual Linear Programming correspondingly. If P and D are feasible, then $c^T x = b^T y$.

If a standard problem and its dual are feasible, both are feasibly bounded. If one problem has an unbounded solution, then the dual of that problem is infeasible.

## Possibilities of Feasibility

| P\D | Feasibly Bounded | Feasibly Unbounded | Infeasible |
| ------------------ | ---------------- | ------------------ | ---------- |
| Feasibly Bounded | Possible | Impossible | Impossible |
| Feasibly Unbounded | Impossible | Impossible | Possible |
| Infeasible | Impossible | Possible | Possible |

## [[P vs NP|P vs. NP]]

- P = set of poly-time solvable problems.
- NP = set of poly-time verifiable problems.
- Decision Knapsack is NP-complete, whereas undecidable problems like Halting problems are only NP-Hard (not NP).
- X is NP-Hard if $\forall Y \in NP$ and $Y \leq_p X$.
- X is NP-complete if X is NP-Hard and $X \in NP$.
- If P = NP, then P = NP-complete.
- NP Problems can be solved in poly-time with NDTM.
- NP Problems can be verified in poly-time by DTM.

## Polynomial Reduction

To reduce a decision problem Y to a decision problem X ($Y \leq_p X$), find a function $f$ that maps Y to X such that $f$ is poly-time computable and $\forall y \in Y$ is YES if and only if $f(y) \in X$ is YES.

## Proving NP-Complete

Show X is in NP, Pick problem NP-complete Y, and show $Y \leq_p X$.

## Conjunctive Normal Form SAT

- Conjunction of clauses.
- Literal: Variable or its negation.
- Clause: Disjunction of literals.
- [[3-SAT]]. Each clause has at most three literals.
- $(X_1 \lor \neg X_3) \land (X_1 \lor X_2 \lor X_4) \land \cdots$

## Independent Set

- Independent Set is a set of vertices in a graph, no two of which are adjacent.
- The max independent set asks for the size of the largest independent set in a given graph.

## Clique

- Complete graph = every pair of vertices is connected by an edge.
- The max clique asks for the number of vertices in its largest complete subgraph.

## Vertex Cover

- Vertex Cover of a graph is a set of vertices that includes at least one endpoint of every edge.
- The min vertex cover asks for the size of the smallest vertex cover in a graph.

## Hamiltonian Cycle

- A cycle that visits each vertex exactly once.
- Hamiltonian Path visits each vertex exactly once and doesn't need to return to its starting point.

## Graph Coloring

- Given G, can you color the nodes with $<k$ colors such that the end points of every edge are colored differently?
File renamed without changes.
2 changes: 1 addition & 1 deletion Research/pages/Project PEOPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Try refreshing the page!
- [[Person 542AD7]]
- [[Person 648442]]
- [[Person 960D1D]]
- [[Person 4F439C]]
- [[Person 4460DA]]

</Shuffle>
21 changes: 15 additions & 6 deletions src/data/backlinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,9 @@ export const backlinks = {
"Photoshop for Text": "### Photoshop for text — [[Stephan Ango]]",
"Second Brain": "### [[Stephan Ango]] Link"
},
"Discrete Mathematics": {
"2023-12-01": "- [[Discrete Mathematics]]"
},
"Xcode Cloud": {
"WWDC23": "- [[Xcode Cloud]]. 2x faster workflows. Share Tester ..."
},
Expand Down Expand Up @@ -2140,6 +2143,7 @@ export const backlinks = {
"P vs NP": {
"2022-07-01": "- [[P vs NP]]",
"2022-11-19": " - [[P vs NP]]",
"Discrete Mathematics": "## [[P vs NP|P vs. NP]]",
"Matt Rickard": "- [[P vs NP]]",
"Monte Carlo and Las Vegas Algorithm": "... accurately is prohibited by the [[P vs NP|P-NP]] nature of the universe (at ...",
"On National Crises and the Intellectuals — Focused on GB and KR": "## Conclusion — [[P vs NP|P vs. NP]] Problems",
Expand Down Expand Up @@ -2953,6 +2957,10 @@ export const backlinks = {
"2023-08-19": "- [[Agricultural Technology]]",
"Malthusian Trap": "... but others remain hopeful that [[Agricultural Technology]] will prevent such a scenario."
},
"Person 4460DA": {
"2023-11-29": "- [[Person 4460DA]]",
"Project PEOPLE": "- [[Person 4460DA]]"
},
"Privacy Supply Chains": {
"WWDC23": "- [[Privacy Supply Chains]]. Signature for third-party SDKs."
},
Expand Down Expand Up @@ -4018,7 +4026,7 @@ export const backlinks = {
"2023-11-14": "- [[Project Ganymede]]",
"2023-11-18": "- [[Project Ganymede|Ganymede]]",
"2023-11-22": "- [[Project Ganymede]]",
"Person 4F439C": "... about a new messaging app ([[Project Ganymede]])",
"Person 4460DA": "... about a new messaging app ([[Project Ganymede]])",
"Project": "- [[Project Ganymede]]",
"The Paradoxical Moon Philosophy": "I am building [[Project Ganymede]]. It's a social app, but ..."
},
Expand Down Expand Up @@ -6587,6 +6595,7 @@ export const backlinks = {
"2023-11-20": "- [[Y Combinator]]"
},
"Partition": {
"Discrete Mathematics": "... is one part of the [[partition]]. Cut capacity $\\text{cap}(A, B) = ...",
"Probability": "- [[Partition]]"
},
"Polymath": {
Expand Down Expand Up @@ -9128,10 +9137,6 @@ export const backlinks = {
"앰비언트 컴퓨팅을 향해": "... 기록들을 재빨리 불러올 수 있다면 [[Memex|메멕스]]를 통해 기억의 확장이자 증강으로 사용할 ...",
"인하우스와 자유경쟁": "... 것이 더 쉬워져야 한다. 이 [[Memex]]는 그 생각의 한 걸음이다."
},
"Person 4F439C": {
"2023-11-29": "- [[Person 4F439C]]",
"Project PEOPLE": "- [[Person 4F439C]]"
},
"Ignoring $ for copy-pasting online resources to terminal": {
"2022-09-12": "- [[Ignoring $ for copy-pasting online resources to terminal]]"
},
Expand Down Expand Up @@ -10032,7 +10037,8 @@ export const backlinks = {
"Grammarly Work Note 2023-05-26": "... enforced, discovered by running npx [[prettier]] --write. On par with [[Prettier]], ..."
},
"3-SAT": {
"2023-11-19": "[[3-SAT]]"
"2023-11-19": "[[3-SAT]]",
"Discrete Mathematics": "- [[3-SAT]]. Each clause has at most ..."
},
"Sliding Panes": {
"Andy Matuschak": "Introduced novel concepts, such as [[Sliding Panes]], [[Backlink|links to this note]], and ...",
Expand Down Expand Up @@ -11166,6 +11172,9 @@ export const backlinks = {
"2023-03-25": "![[A77E29.png]]",
"hn.cho.sh 개발 기록": "![[A77E29.png]]"
},
"BCFFB7.png": {
"2023-11-29": "![[BCFFB7.png]]"
},
"81F6FA.png": {
"2023-01-31": "![[81F6FA.png]]"
},
Expand Down
4 changes: 3 additions & 1 deletion src/data/filenames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ export const filenames = {
"2023-11-24": "2023-11-24",
"2023-11-28": "2023-11-28",
"2023-11-29": "2023-11-29",
"2023-12-01": "2023-12-01",
"3-SAT": "DCB869",
"30-Day Tweet Test (Harry Stebbings)": "18728A",
"3D": "82C83C",
Expand Down Expand Up @@ -900,6 +901,7 @@ export const filenames = {
"Disable All Animations": "E94267",
"Disable Firefox Safe Mode Trigger": "F44F14",
"Disable Screenshot Drop Shadow in macOS": "EE88B1",
"Discrete Mathematics": "21FE92",
"Discuss on Social Media Button": "69BE1E",
"Dismiss Keyboard": "AEA50D",
"Displaying exact datetimes on Ghost": "522AED",
Expand Down Expand Up @@ -1477,7 +1479,7 @@ export const filenames = {
"Person 1B5A5B": "1B5A5B",
"Person 1E6ABA": "1E6ABA",
"Person 392196": "392196",
"Person 4F439C": "4460DA",
"Person 4460DA": "4460DA",
"Person 542AD7": "542AD7",
"Person 5DBDAE": "5DBDAE",
"Person 648442": "648442",
Expand Down

0 comments on commit 44af252

Please sign in to comment.