For a nonnegative counting quantity , an FPRAS is a randomized algorithm with the displayed guarantee, running in time polynomial in encoded input length, and . The usual constant-success definition is equivalent by independent repetition and a median. This counting notion differs from a deterministic fully polynomial-time approximation scheme for optimization.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 40 6 c Solution Created 2026-10-03 Updated 2026-10-14
Several other approaches illustrate the range between fast heuristics, certified bounds and approximation schemes.
Sorting weights in decreasing order before greedy assignment avoids the example : it starts with the weight , then places both unit weights in the other bin, giving the optimum. This is a useful scheduling heuristic, although improvement on one example is not a proof of an arbitrary claimed approximation ratio. Local improvement can additionally move a single item or swap items between bins whenever it reduces the maximum load; it produces a local optimum, which need not be global.
A linear-programming relaxation replaces by . The choice for every item gives load in both bins, and summing the load constraints shows that no smaller relaxed value is possible. Together with the indivisibility bound this provides a lower bound on the integer optimum. Any feasible heuristic schedule gives an upper bound . Their ratio is a computable quality certificate. Branch-and-bound can improve these bounds by fixing assignment variables and solving subproblems, although worst-case exact running time need not be polynomial.
For integer weights one can instead solve the problem exactly by dynamic programming. Start with attainable subset sums and updatediscarding values above . Let be the largest retained sum. Choosing that subset for one bin gives loads and maximum , which is optimal because every partition has a lighter side of weight at most . The running time is pseudopolynomial: it depends on numeric magnitude, not merely the binary length of .
This exact algorithm also yields rounded dynamic programming for two-bin load balancing. For rational weights and , choose and scaled integer weights . Their total is at most , so exact dynamic programming on them costs arithmetic operations. Let be its optimal scaled maximum load. The original optimal partition is feasible for the scaled problem with load at most , so . When the scaled partition is lifted, each bin contains at most rounding errors, each smaller than . Therefore its original maximum load satisfiesThis is a fully polynomial-time approximation scheme: for each requested tolerance it gives a certified feasible solution in time polynomial in the encoded rational input and , with rational arithmetic accounted for. It works here because two-bin balancing has the subset-sum structure; one cannot infer that arbitrary combinatorial optimization problems admit such a scheme.
For integer weights, subset-sum dynamic programming finds the greatest achievable total at most in time , where is the total weight. For rational weights and , scale by and round down to . The scaled total is at most , so exact dynamic programming costs arithmetic operations. Lifting its partition to the original weights increases the maximum load by at most . Thus it is a fully polynomial-time approximation scheme for this two-bin problem. Bit complexity also accounts for the rational input and epsilon encodings.