04 February 2014

Fork me on GitHub

Approximation algorithms

  • Change method -> bound "opportunity cost"
  • Achieve a bound -> Achieve a combination of bounds

Parallel job scheduling

\( J_i = (p_i, d_i), 1 \leq p_i \leq p, 0 < d_i \). P: number of processors available. Assign each \( J_i \) a time interval \( s_i, s_i + d_i), s_i \geq 0 \). At any time, total processor use must be \( \leq P \). Objective: Minimize makespan = max finish time. This looks like a packing problem.

Approximate algorithm

Order the jobs from largest to smallest \( p_i \). Add the jobs to the schedule in that order. If there are enough processors starting at the same time as the last scheduled job, make it start at the same time as the last scheduled job. Otherwise make it start when the last scheduled job finishes.

Some lower bounds for the above solution:

  • LB1: \( \max d_i \)
  • LB2: Let \( w := \sum p_i d_i \). Then a bound is \( \frac{w}{p} \).

Look at time last job is scheduled. This the part of the schedule that begins at this point is at most length LB1. Look at the schedule before this time, and call this range of time T. At any point, at most \( \frac{P}{2} \) can be idle, because otherwise a job would have been scheduled in the idle block. This holds because of the ordering on \( p_i \). So, the work done in time 0 to T is at least \( \frac{P}{2}T \), which is a lower bound on W. So \( T \leq 2 W / P = 2 * LB2 \).

So our solution's objective is \( \leq 2 * LB2 + LB1 \leq 3 * OPT \).

Interval scheduling problem

Have set of intervals \( (s_i, f_i) \). Have \( m \) rooms. May not have intersecting events. Objective: Maximize total lengths of scheduled events. \[ \sum_{i \text{ s.t. event } i \text{ is scheduled}} (f_i - s_i) \]

Approximation algorithm

Sort events from longest to shortest duration. Put each even in first room it fits in.

Make a replacement argument. As our solution overwrites the optimal solution, in each overwrite of length D it adds D utility and removes at most \( 3D \) utility. This is because the interval we're adding is the current longest.

Lemma: Let \( I_1, ..., I_k \) be the intervals scheduled by the greedy algorithms, in that order. Let \( D_j \) be the length of \( I_j \). Then there is a schedule \( S_j \) such that \[ total(S_j) \geq OPT - 2 \sum_{j'}^j D_j. \] Proof by induction.

Theorem: The total duration of the greedy algorithm is \( \geq \frac{1}{3} OPT \). Proof: Apply the lemma with \( j = k \). TotalDuration(GA) >= OPT - 2 * TotalDuration(GA). So TotalDuration(GA) >= OPT / 3.

Idea of the above approach: In each action, we have an immediate benefit, and an opportunity cost which is bounded in terms of this benefit.

Divide and conquer

Consider arithmetic operations in computers. Usually if the numbers are big, you use floating point. But floating point is approximate. So in cryptography, where you use big numbers and need exact results, you can't just fall back on a machine instruction. Instead, you may want an efficient algorithm to implement the various arithmetic operations.

Naive binary multiplication is an \( O(n^2) \) algorithm. Suppose you are multipliying \( x \) and \( y \). Write \( x = x_h 2^{n / 2} + x_l \) where \( x_h, x_l \) are the high and low order bits of \( x \). Do similarly for \( y \). Note \[ x y = x_h y_h 2 ^ n + (x_h y_l + x_l y_h) 2 ^ {n / 2} + x_l y_l. \] A recurrence relation for the time of this operation is \[ T(n) = 4 T (\frac{n}{2}) + O(n). \] It turns out this recurrence yields an \( O(n^2) \) time. So we'll have to be more clever next time.