Content deleted Content added
"expected" is a common synonym for "averaged" in this case |
Citation bot (talk | contribs) Removed URL that duplicated identifier. | Use this bot. Report bugs. | Suggested by Abductive | Category:Analysis of algorithms | #UCB_Category 22/47 |
||
(44 intermediate revisions by 34 users not shown) | |||
Line 1:
{{redirect|AvgP|other uses|avgp (disambiguation)}}
In [[computational complexity theory]], the '''average-case complexity''' of an [[algorithm]] is the amount of some computational resource (typically time) used by the algorithm, averaged over all possible inputs. It is frequently contrasted with [[worst-case complexity]] which considers the maximal complexity of the algorithm over all possible inputs
There are three primary motivations for studying average-case complexity.<ref name="gol07">
Average-case analysis requires a notion of an "average" input to an algorithm, which leads to the problem of devising a [[probability distribution]] over inputs. Alternatively, a [[randomized algorithm]] can be used. The analysis of such algorithms leads to the related notion of an '''expected complexity'''.<ref name="clrs"/>{{rp|28}}
==History and background==
The average-case performance of algorithms has been studied since modern notions of computational efficiency were developed in the 1950s. Much of this initial work focused on problems for which worst-case polynomial time algorithms were already known.<ref name="bog06">
| last = Knuth }}</ref> published Volume 3 of the [[Art of Computer Programming]] which extensively surveys average-case performance of algorithms for problems solvable in worst-case polynomial time, such as sorting and median-finding. An efficient algorithm for [[NP-complete|{{math|'''NP'''}}-complete]] problems
The fundamental notions of average-case complexity were developed by [[Leonid Levin]] in 1986 when he published a one-page paper<ref name="levin86">
==Definitions==
Line 15 ⟶ 20:
===Efficient average-case complexity===
The first task is to precisely define what is meant by an algorithm which is efficient "on average". An initial attempt might define an efficient average-case algorithm as one which runs in expected polynomial time over all possible inputs. Such a definition has various shortcomings; in particular, it is not robust to changes in the computational model. For example, suppose algorithm {{mvar|A}} runs in time {{math|''t''<sub>''A''</sub>(''x'')}} on input {{mvar|x}} and algorithm {{mvar|B}} runs in time {{math|''t''<sub>''A''</sub>(''x'')<sup>2</sup>}} on input {{mvar|x}}; that is, {{mvar|B}} is quadratically slower than {{mvar|A}}. Intuitively, any definition of average-case efficiency should capture the idea that {{mvar|A}} is efficient-on-average if and only if {{mvar|B}} is efficient on-average. Suppose, however, that the inputs are drawn randomly from the uniform distribution of strings with length {{mvar|n}}, and that {{mvar|A}} runs in time {{math|''n''<sup>2</sup>}} on all inputs except the string {{math|1<sup>''n''</sup>}} for which {{mvar|A}} takes time {{math|2<sup>''n''</sup>}}. Then it can be easily checked that the expected running time of {{mvar|A}} is polynomial but the expected running time of {{mvar|B}} is exponential.<ref name="bog06" />
To create a more robust definition of average-case efficiency, it makes sense to allow an algorithm {{mvar|A}} to run longer than polynomial time on some inputs but the fraction of inputs on which
:<math>
\Pr_{x \in_R D_n} \left[t_A(x) \geq t \right] \leq \frac{p(n)}{t^\epsilon}
</math>
for every {{math|''n'', ''t
:<math>
E_{x \in_R D_n} \left[ \frac{t_{A}(x)^{\epsilon}}{n} \right] \leq C
</math>
for some
===Distributional problem===
The next step is to define the "average" input to a particular problem. This is achieved by associating the inputs of each problem with a particular probability distribution. That is, an "average-case" problem consists of a language {{mvar|L}} and an associated probability distribution {{mvar|D}} which forms the pair {{math|(''L'', ''D'')}}.<ref name="ab09"/> The two most common classes of distributions which are allowed are:
#Polynomial-time computable distributions ({{math|'''P'''}}-computable): these are distributions for which it is possible to compute the cumulative density of any given input {{mvar|x}}. More formally, given a probability distribution {{mvar|μ}} and a string {{math|''x''
#Polynomial-time samplable distributions ({{math|'''P'''}}-samplable): these are distributions from which it is possible to draw random samples in polynomial time.
These two formulations, while similar, are not equivalent. If a distribution is {{math|'''P'''}}-computable it is also {{math|'''P'''}}-samplable, but the converse is not true if [[P (complexity)|{{math|'''P'''}}]] ≠ {{math|'''P'''<sup>'''#P'''</sup>}}.<ref name="ab09"/>
===AvgP and distNP===
A distributional problem {{math|(''L'', ''D'')}} is in the complexity class {{math|'''AvgP'''}} if there is an efficient average-case algorithm for {{mvar|L}}, as defined above. The class {{math|'''AvgP'''}} is occasionally called {{math|'''distP'''}} in the literature.<ref name="ab09"/>
A distributional problem {{math|(''L'', ''D'')}} is in the complexity class {{math|'''distNP'''}} if {{mvar|L}} is in {{math|'''NP'''}} and {{mvar|D}} is {{math|'''P'''}}-computable. When {{mvar|L}} is in {{math|'''NP'''}} and {{mvar|D}} is {{math|'''P'''}}-samplable, {{math|(''L'', ''D'')}} belongs to {{math|'''sampNP'''}}.<ref name="ab09"/>
Together, {{math|'''AvgP'''}} and {{math|'''distNP'''}} define the average-case analogues of {{math|'''P'''}} and {{math|'''NP'''}}, respectively.<ref name="ab09"/>
==Reductions between distributional problems==
Let {{math|(''L'',''D'')}} and {{math|(''L′'', ''D′'')}} be two distributional problems. {{math|(''L'', ''D'')}} average-case reduces to {{math|(''L′'', ''D′'')}} (written {{math|(''L'', ''D'') ≤<sub>'''AvgP'''</sub> (''L′'', ''D′'')}}) if there is a function {{mvar|f}} that for every {{mvar|n}}, on input {{mvar|x}} can be computed in time polynomial in {{mvar|n}} and
#(Correctness) {{math|''x'' ∈ ''L''}} if and only if {{math|''f''(''x'') ∈ ''L′''}}
#(Domination) There are polynomials {{mvar|p}} and {{mvar|m}} such that, for every {{mvar|n}} and {{mvar|y}}, <math>\sum\limits_{x: f(x) = y} D_n(x) \leq p(n)D'_{m(n)}(y)</math>
The domination condition enforces the notion that if problem {{math|(''L'', ''D'')}} is hard on average, then {{math|(''L′'', ''D′'')}} is also hard on average. Intuitively, a reduction should provide a way to solve an instance {{mvar|x}} of problem {{mvar|L}} by computing {{math|''f''(''x'')}} and feeding the output to the algorithm which solves {{mvar|L'}}. Without the domination condition, this may not be possible since the algorithm which solves {{mvar|L}} in polynomial time on average may take super-polynomial time on a small number of inputs but {{mvar|f}} may map these inputs into a much larger set of {{mvar|D'}} so that algorithm {{mvar|A'}} no longer runs in polynomial time on average. The domination condition only allows such strings to occur polynomially as often in {{mvar|D'}}.<ref name="wangsurvey"/>
===DistNP-complete problems===
The average-case analogue to {{math|'''NP'''}}-completeness is {{math|'''distNP'''}}-completeness. A distributional problem {{math|(''L′'', ''D′'')}} is {{math|'''distNP'''}}-complete if {{math|(''L′'', ''D′'')}} is in {{math|'''distNP'''}} and for every {{math|(''L'', ''D'')}} in {{math|'''distNP'''}}, {{math|(''L'', ''D'')}} is average-case reducible to {{math|(''L′'', ''D′'')}}.<ref name="ab09" />
An example of a {{math|'''distNP'''}}-complete problem is the Bounded Halting Problem, {{math|({{mvar|BH}},''D'')}} (for any {{math|'''P'''}}-computable ''D'') defined as follows:
<math>BH = \{(M, x, 1
In his original paper, Levin showed an example of a distributional tiling problem that is average-case {{math|'''NP'''}}-complete.<ref name="levin86"/> A survey of known {{math|'''distNP'''}}-complete problems is available online.<ref name="wangsurvey"/>
One area of active research involves finding new {{math|'''distNP'''}}-complete problems. However, finding such problems can be complicated due to a result of Gurevich which shows that any distributional problem with a flat distribution cannot be {{math|'''distNP'''}}-complete unless [[EXP|{{math|'''EXP'''}}]] = [[NEXP|{{math|'''NEXP'''}}]].<ref name="gur87">
==Applications==
===Sorting algorithms===
As mentioned above, much early work relating to average-case complexity focused on problems for which polynomial-time algorithms already existed, such as sorting. For example, many sorting algorithms which utilize randomness, such as [[Quicksort]], have a worst-case running time of {{math|O(''n''<sup>2</sup>)}}, but an average-case running time of {{math|O(
===Cryptography===
For most problems, average-case complexity analysis is undertaken to find efficient algorithms for a problem that is considered difficult in the worst-case. In cryptographic applications, however, the opposite is true: the worst-case complexity is irrelevant; we instead want a guarantee that the average-case complexity of every algorithm which "breaks" the cryptographic scheme is inefficient.<ref name="katz07">
Thus, all secure cryptographic schemes rely on the existence of [[one-way functions]].<ref name="bog06"/> Although the existence of one-way functions is still an open problem, many candidate one-way functions are based on
==Other results==
[[Yao's principle]], from a 1978 paper by [[Andrew Yao]], shows that for broad classes of computational problems, average-case complexity for a hard input distribution and a deterministic algorithm adapted to that distribution is the same thing as expected complexity for a fast randomized algorithm and its worst-case input.<ref>{{citation
| contribution = Probabilistic computations: Toward a unified measure of complexity
| doi = 10.1109/SFCS.1977.24
| title = Proceedings of the 18th IEEE Symposium on Foundations of Computer Science (FOCS)
In
In 1992, Ben-David et al. showed that if all languages in {{math|'''distNP'''}} have good-on-average decision algorithms, they also have good-on-average search algorithms. Further, they show that this conclusion holds under a weaker assumption: if every language in {{math|'''NP'''}} is easy on average for decision algorithms with respect to the uniform distribution, then it is also easy on average for search algorithms with respect to the uniform distribution.<ref name="bd92">{{Cite book |last1=Ben-David |first1=S. |last2=Chor |first2=B. |last3=Goldreich |first3=O. |chapter=On the theory of average case complexity |date=1989 |title=Proceedings of the twenty-first annual ACM symposium on Theory of computing - STOC '89 |chapter-url=http://portal.acm.org/citation.cfm?doid=73007.73027 |language=en |publisher=ACM Press |pages=204–216 |doi=10.1145/73007.73027 |isbn=978-0-89791-307-2}}</ref> Thus, cryptographic one-way functions can exist only if there are {{math|'''distNP'''}} problems over the uniform distribution that are hard on average for decision algorithms.
In 1993, Feigenbaum and Fortnow showed that it is not possible to prove, under non-adaptive random reductions, that the existence of a good-on-average algorithm for a distNP-complete problem under the uniform distribution implies the existence of worst-case efficient algorithms for all problems in NP.<ref name="ff93">J. Feigenbaum and L. Fortnow, "Random-self-reducibility of complete sets," SIAM Journal on Computing, vol. 22, pp. 994–1005, 1993.</ref> In 2003, Bogdanov and Trevisan generalized this result to arbitrary non-adaptive reductions.<ref name="bog03">A. Bogdanov and L. Trevisan, "On worst-case to average-case reductions for NP problems," in Proceedings of the 44th IEEE Symposium on Foundations of Computer Science, pp. 308–317, 2003.</ref> These results show that it is unlikely that any association can be made between average-case complexity and worst-case complexity via reductions.<ref name="bog06"/>▼
▲In 1993, Feigenbaum and Fortnow showed that it is not possible to prove, under non-adaptive random reductions, that the existence of a good-on-average algorithm for a {{math|'''distNP'''}}-complete problem under the uniform distribution implies the existence of worst-case efficient algorithms for all problems in {{math|'''NP'''}}.<ref name="ff93">
==See also==
Line 86 ⟶ 99:
*[[NP-complete problems]]
*[[Worst-case complexity]]
*[[Amortized analysis]]
*[[Best, worst and average case]]
==References==
Line 91 ⟶ 106:
==Further reading==
Pedagogical presentations:
* {{Cite book |last=Impagliazzo |first=R. |chapter=A personal view of average-case complexity |date=1995 |title=Proceedings of Structure in Complexity Theory. Tenth Annual IEEE Conference |publisher=IEEE Comput. Soc. Press |pages=134–147 |doi=10.1109/SCT.1995.514853 |isbn=978-0-8186-7052-7}}
* {{cite book |last1=Wang |first1=Jie |url=https://www.cs.uml.edu/~wang/acc-forum/avgcomp.pdf |title=Complexity Theory: Retrospective II |date=1997 |publisher=Springer Science & Business Media |editor-last1=Hemaspaandra |editor-first1=Lane A. |volume=2 |pages=295–328 |chapter=Average-case computational complexity theory |editor-last2=Selman |editor-first2=Alan L.}}
* {{Citation |last=Goldreich |first=Oded |title=Average Case Complexity, Revisited |date=2011 |work=Studies in Complexity and Cryptography. Miscellanea on the Interplay between Randomness and Computation |series=Lecture Notes in Computer Science |volume=6650 |pages=422–450 |editor-last=Goldreich |editor-first=Oded |url=https://www.wisdom.weizmann.ac.il/~oded/COL/aver.pdf |place=Berlin, Heidelberg |publisher=Springer Berlin Heidelberg |doi=10.1007/978-3-642-22670-0_29 |isbn=978-3-642-22669-4}}
* {{cite book |last1=Arora |first1=Sanjeev |title=Computational Complexity: A Modern Approach |last2=Barak |first2=Boaz |date=2009 |publisher=Cambridge University Press |___location=Cambridge; New York |chapter=18. Average case complexity: Levin’s theory}}
The literature of average case complexity includes the following work:
*{{citation▼
| last = Franco | first = John▼
| doi = 10.1016/0020-0190(86)90051-7▼
| issue = 2▼
| journal = Information Processing Letters▼
▲ | pages = 103–106
| title = On the probabilistic performance of algorithms for the satisfiability problem▼
| volume = 23▼
▲ | year = 1986}}.
*{{citation
| last = Levin | first = Leonid | author-link = Leonid Levin
Line 109 ⟶ 122:
| title = Average case complete problems
| volume = 15
| year = 1986}}
▲*{{citation
▲ | last = Franco | first = John
▲ | doi = 10.1016/0020-0190(86)90051-7
▲ | issue = 2
▲ | journal = Information Processing Letters
| pages = 103–106
▲ | title = On the probabilistic performance of algorithms for the satisfiability problem
▲ | volume = 23
| year = 1986}}..
*{{citation
| last1 = Flajolet | first1 = Philippe | author1-link = Philippe Flajolet
Line 126 ⟶ 148:
| title = Expected computation time for [[Hamiltonian path problem]]
| volume = 16
| year = 1987| citeseerx = 10.1.1.359.8982}}.
*{{citation
| last1 = Ben-David | first1 = Shai
| last2 = Chor | first2 = Benny | author2-link = Benny Chor
| last3 = Goldreich | first3 = Oded | author3-link = Oded Goldreich
| last4 = Luby | first4 = Michael | author4-link = Michael Luby
Line 141 ⟶ 163:
| doi = 10.1016/0022-0000(91)90007-R
| issue = 3
| journal = Journal of Computer and
| pages = 346–398
| title = Average case completeness
| volume = 42
| year = 1991| hdl = 2027.42/29307
| hdl-access = free }}. See also [http://research.microsoft.com/~gurevich/Opera/76.pdf 1989 draft]. *{{citation
| last1 = Selman | first1 = B.
Line 187 ⟶ 211:
| url = http://www.cs.nyu.edu/csweb/Research/TechReports/TR1995-711/TR1995-711.pdf
| year = 1995}}.
▲ | last = Impagliazzo | first = Russell | author-link = Russell Impagliazzo
[[Category:
[[Category:Analysis of algorithms]]
|