Fully polynomial randomized approximation schemes #
A fully polynomial randomized approximation scheme (FPRAS) for a counting function
f : α → ℕ is a randomized algorithm that, given an instance x, a relative error ε and a
failure probability δ, outputs an estimate within relative error ε of f x with probability
at least 1 - δ, in time polynomial in the length of x, in 1 / ε and in log (1 / δ)
Karp, Luby and Madras,
Jerrum, Valiant and Vazirani,
Mitzenmacher and Upfal, Section 11.2, Definition 11.2.
Cslib.Complexity.IsFPRAS enc f A parameterizes the relative error as ε = 1 / p and the
failure probability as δ = 2 ^ (-t), for natural numbers p and t both written in unary. A
running time polynomial in the length of the encoded input (x, p, t) is then exactly a running
time polynomial in |x|, 1 / ε and log (1 / δ). The three requirements stay separate:
- runtime:
Ais a strict probabilistic polynomial-time program (Cslib.Probability.IsPPTOn) on the encoded input(x, p, t); - relative error: the output is a pair
(num, den)of natural numbers, written in binary, standing for the rational estimatenum / den, and success meansCslib.Complexity.ApproxWithin (f x) p num den:den > 0and|num / den - f x| ≤ f x / p; - failure probability: success has probability at least
1 - (1 / 2) ^ twheneverp > 0.
The relative-error condition is multiplicative, so it forces an exact answer on instances with
f x = 0 (Cslib.Complexity.ApproxWithin.num_eq_zero). Cslib.Complexity.IsFPRAS.approx gives
the guarantee in the usual form for real ε > 0 and δ > 0, running A on p = ⌈1 / ε⌉ and
t = ⌈log₂ ⌈1 / δ⌉⌉.
Main definitions #
Cslib.Complexity.ApproxWithin: a rational estimate within relative error1 / p.Cslib.Complexity.IsFPRAS: a fully polynomial randomized approximation scheme.Cslib.Complexity.FPRAS: the counting functions admitting one.
Main results #
Cslib.Complexity.ApproxWithin.num_eq_zero: zero counts are computed exactly.Cslib.Complexity.IsFPRAS.approx: the guarantee for real relative error and failure probability.
References #
The rational estimate num / den is within relative error 1 / p of the count c: the
denominator is positive and |num / den - c| ≤ c / p.
A zero count must be estimated exactly: the numerator is zero.
A fully polynomial randomized approximation scheme for the counting function f, on
instances encoded by enc. The algorithm A x p t receives the instance x, the inverse
relative error p (so ε = 1 / p) and the confidence t (so δ = 2 ^ (-t)), with p and t in
unary. It is a strict probabilistic polynomial-time program on the encoded triple (x, p, t),
outputs a pair (num, den) in binary, and for p > 0 its estimate num / den is within relative
error 1 / p of f x with probability at least 1 - (1 / 2) ^ t.
The guarantee for real parameters. Run with p = ⌈1 / ε⌉ and
t = ⌈log₂ ⌈1 / δ⌉⌉, an FPRAS outputs an estimate within relative error ε of f x with
probability at least 1 - δ. Since p < 1 / ε + 1, and t < log₂ (1 / δ) + 2 when δ ≤ 1, the
running time is polynomial in |x|, 1 / ε and log (1 / δ).