Lecture Notes for Algorithm Design
Problem reductions, 11 November 1999
These are provisional lecture notes, expect changes.
- reductions - solving on problem by using another
- example - detecting cyclic shifts
- one string a cyclic of another
- a cyclic search or a linear search
- example - system of distinct representations
- given a set of k sets, find a k-element set containing one
element from each component set
- a matching problem
- undirected graph matching - unmatched vertices; perfect matching;
maximum matching; maximal matching
- bipartite graphs
- maximum bipartite matching - alternating path algorithm
- directed-graph implementation
- use maximal bipartite matching to find a system of distinct
representations
- example - string editing
- insert, delete, change one string into another at minimal cost
- represent each option as a weighted edge - weight is cost
- vertices represent partial edits
- find the shortest path to the lower left corner
- flexible, models many situations
- example - finding triangles
- given an undirected graph, does it have three nodes connected to one
another
- choose(n, 3) = n!/(n-3)!3! is O(n3)
- represent the graph as an adjacency matrix
- consider matrix multiplication
- linear programming
- minimizing or maximizing problems
- maximizing network flows - a directed graph with weighted edges; a
source and sink
- an edge weight is the maximum flow capacity of the edge
- the sum of the flows into a vertex must equal the sum of the flows
out of the vertex
- what is the largest flow possible between source and sink
- philanthropist problem - n donors and m recipients
- donor i will give at most maxij to
recipient j
- donor i will give no more than Dmaxi
to all recipients
- recipient i will accept no more than Rmaxi
from all donors
- maximize the sum of all amounts donated: sum(i = 1 to n,
j = 1 to m; dij), where dij is the amount
donor i gives to recipient j
- the linear-programming problem
- maximize a linear objective function
c(x) = sum(cixi), where ci is a
constant and x is an n-element vector of values to be manipulated
- the vector x is usually subject to constraints:
- inequality constraints - dotp(ai, x) <= bi
for 1 <= i <= m
- equality constraints - dotp(ei, x) = di for
1 <= i <= k
- non-negative constraints - xi >= 0 for i in the set
P, a subset of {1, ..., n}
- there is much research, expertise and software around to solve
linear programming problems
- example reductions to linear programming problems
- network flows
- the element xi of vector x represents the flow
assigned to edge i
- maximize the flows out of the sink - c(x) = sum(aixi), where ai is 1 if edge i is adjacent to the
source and 0 otherwise
- don't exceed edge capacities - xi <= ci
- flow conservation - dotp(ev, x = 0), where ei = 1 if edge i flows into vertex v, = -1 if edge i flows out of
vertex v, and 0 otherwise
- all flows are non-negative - xi >= 0
- static routing
- the element xi of vector x represents the number of
messages sent along edge i
- maximize messages in the network - c(x) = sum(xi)
- don't exceed vertex buffers - dotp(ev, x = 0), where
ei = 1 if edge i is incident to v and 0 otherwise
- all flows are non-negative - xi >= 0
- philanthropist problem
- the element xij of vector x represents amount given
to recipient j by donor i
- maximize the amount given by all donors -
c(x) = sum(xij)
- don't exceed donor maximums - dotp(e, x) <= Dmaxi, where ekj = 1 if k = i and 0 otherwise
- don't exceed recipient maximums - dotp(r, x) <=
Rmaxi, where ejk = 1 if k = i and 0 otherwise
- don't exceed donor i's maximum to recipient j -
xij <= aij
- all donations are non-negative - xij >= 0
- assignment problem - like the philanthropist problem except each
donor gives to one recipient and one recipient receives from one donor
- the element xij of vector x represents amount given
to recipient j by donor i
- maximize the amount given by all donors -
c(x) = sum(xij)
- one recipient per donor - dotp(d, x) = 1
where dkj = 1 if k = i and 0 otherwise
- one donor per recipient - dotp(r, x) = 1,
where rjk = 1 if k = i and 0 otherwise
- don't exceed donor i's maximum to recipient j -
xij <= aij
- all donations are non-negative - xij >= 0
- integer programming, an np-complete problem
This page last modified on 3 December 1999.