Discrete Mathematics
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.
Chain Matrix Multiplication
Min Cut
The set of vertices reachable from source s in the residual graph is one part of the partition. Cut capacity .
- maxflow = Min .
Ford-Fulkerson
Given , start with and . While an augmenting path is in , find a bottleneck. Augment the flow along this path and update the residual graph . .
Edmond-Karp
Ford-Fulkerson, but choose the shortest augmenting path.
For any flow and any cut, . For any flow and any cut,
Solving by Reduction
To reduce a problem to a problem () we want a function that maps to such that is a polynomial time computable and is solvable if and only if 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.
Circulation
- if demand
- if supply
- Capacity Constraint
- Conservation Constraint .
- For every feasible circulation , there is a feasible circulation with demands in if and only if the maximum flow in has value .
Circulation with Demands and Lower Bounds.
- Capacity Constraint
- Conservation Constraint
- Given with lower bounds, we subtract the lower bound from the capacity of each edge.
- Subtract from the demand of each node.
- Solve the circulation problem on this new graph to get a flow .
- Add to every 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 .
- If is empty, Linear Programming has no solution.``
- If is unbounded, Linear Programming may or may not have the solution.
- If is bounded, Linear Programming has one or more solutions.
Standard Form Linear Programming
- subject to
- all the way to
- .
- Also, .
Matrix Form Linear Programming
- subject to
Integer Linear Program
- all variables
- is NP-Hard
Dual Program
- subject to
Weak Duality
- The optimum of the dual is an upper bound to the optimum of the primal.
- .
Strong duality
- Let P and D be primal and dual Linear Programming correspondingly. If P and D are feasible, then .
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 = 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 and .
- X is NP-complete if X is NP-Hard and .
- 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 (), find a function that maps Y to X such that is poly-time computable and is YES if and only if is YES.
Proving NP-Complete
Show X is in NP, Pick problem NP-complete Y, and show .
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.
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 colors such that the end points of every edge are colored differently?