Loading AI tools
Equivalence of average-case and expected complexity From Wikipedia, the free encyclopedia
In computational complexity theory, Yao's principle (also called Yao's minimax principle or Yao's lemma) relates the performance of randomized algorithms to deterministic (non-random) algorithms. It states that, for certain classes of algorithms, and certain measures of the performance of the algorithms, the following two quantities are equal:
Yao's principle is often used to prove limitations on the performance of randomized algorithms, by finding a probability distribution on inputs that is difficult for deterministic algorithms, and inferring that randomized algorithms have the same limitation on their worst case performance.[1]
This principle is named after Andrew Yao, who first proposed it in a 1977 paper.[2] It is closely related to the minimax theorem in the theory of zero-sum games, and to the duality theory of linear programs.
Consider any cost measure of an algorithm on an input , such as its running time, for which we want to study the expected value over randomized algorithms and random inputs. Consider, also, any finite set of deterministic algorithms (made finite, for instance, by limiting the algorithms to a specific input size), and a finite set of inputs to these algorithms. Let denote the class of randomized algorithms obtained from probability distributions over the deterministic behaviors in , and let denote the class of probability distributions on inputs in . Then, Yao's principle states that:[1]
Here, is notation for the expected value, and means that is a random variable distributed according to . Finiteness of and allows and to be interpreted as simplices of probability vectors,[3] whose compactness implies that the minima and maxima in these formulas exist.[4]
A weaker form of the same principle, as an inequality rather than an equality, converts any hard input distribution for deterministic algorithms into a lower bound on the cost of all randomized algorithms. If is any specific choice of a hard input distribution, and is any specific randomized algorithm in , then[1] That is, the best possible deterministic performance against distribution is a lower bound for the performance of any randomized algorithm against its worst-case input. One may also observe this weaker version of Yao's principle directly, as by linearity of expectation and the principle that for any distribution. By avoiding maximization and minimization over and , this version of Yao's principle can apply in some cases where or are not finite.[5] However, the version of Yao's principle using an equality rather than an inequality can also be useful when proving lower bounds on randomized algorithms. The equality implies that there is no loss of generality in proving lower bounds in this way: whatever the actual best randomized algorithm might be, there is some input distribution through which a matching lower bound on its complexity can be proven.[6]
When the cost denotes the running time of an algorithm, Yao's principle states that the best possible running time of a deterministic algorithm, on a hard input distribution, gives a lower bound for the expected time of any Las Vegas algorithm on its worst-case input. Here, a Las Vegas algorithm is a randomized algorithm whose runtime may vary, but for which the result is always correct.[7][8] For example, this form of Yao's principle has been used to prove the optimality of certain Monte Carlo tree search algorithms for the exact evaluation of game trees.[8]
The time complexity of comparison-based sorting and selection algorithms is often studied using the number of comparisons between pairs of data elements as a proxy for the total time. For these problems, for any fixed number of elements, an input can be expressed as a permutation and a deterministic algorithm can be expressed as a decision tree, both finitely numbered as Yao's principle requires. A symmetrization argument identifies the hardest input distributions: they are the random permutations, the distributions on distinct elements for which all permutations are equally likely. This is because, if any other distribution were hardest, averaging it with all permutations of the same hard distribution would be equally hard, and would produce the distribution for a random permutation. Yao's principle extends lower bounds for the average case number of comparisons made by deterministic algorithms, for random permutations, to the worst case analysis of randomized comparison algorithms.[2]
An example given by Yao is the analysis of algorithms for finding the th largest of a given set of values, the selection problem.[2] Subsequently to Yao's work, Walter Cunto and Ian Munro showed that, for random permutations, any deterministic algorithm must perform at least expected comparisons.[9] By Yao's principle, the same number of comparisons must be made by randomized algorithms on their worst-case input.[10] The Floyd–Rivest algorithm comes within comparisons of this bound.[11]
Another of the original applications by Yao of his principle was to the evasiveness of graph properties, the number of tests of the adjacency of pairs of vertices needed to determine whether a graph has a given property, when the only access to the graph is through such tests.[2] Richard M. Karp conjectured that for every nontrivial monotone graph property (a property that remains true for every subgraph of a graph with the property), a randomized algorithm requires a quadratic number of tests, but only weaker bounds have been proven.[12]
As Yao stated, for graph properties that are true of the empty graph but false for some other graph on vertices with only a bounded number of edges, a randomized algorithm must probe a quadratic number of pairs of vertices. For instance, for the property of being a planar graph, because the 9-edge utility graph is non-planar. More precisely, Yao states that for these properties, at least tests are needed, for every , for a randomized algorithm to have probability at most of making a mistake. Yao also used this method to show that quadratically many queries are needed for the properties of containing a given tree or clique as a subgraph, of containing a perfect matching, and of containing a Hamiltonian cycle, for small enough constant error probabilities.[2]
In black-box optimization, the problem is to determine the minimum or maximum value of a function, from a given class of functions, accessible only through calls to the function on arguments from some finite domain. In this case, the cost to be optimized is the number of calls. Yao's principle has been described as "the only method available for proving lower bounds for all randomized search heuristics for selected classes of problems".[13] Results that can be proven in this way include the following:
In communication complexity, an algorithm describes a communication protocol between two or more parties, and its cost may be the number of bits or messages transmitted between the parties. In this case, Yao's principle describes an equality between the average-case complexity of deterministic communication protocols, on an input distribution that is the worst case for the problem, and the expected communication complexity of randomized protocols on their worst-case inputs.[6][14]
An example described by Avi Wigderson (based on a paper by Manu Viola) is the communication complexity for two parties, each holding -bit input values, to determine which value is larger. For deterministic communication protocols, nothing better than bits of communication is possible, easily achieved by one party sending their whole input to the other. However, parties with a shared source of randomness and a fixed error probability can exchange 1-bit hash functions of prefixes of the input to perform a noisy binary search for the first position where their inputs differ, achieving bits of communication. This is within a constant factor of optimal, as can be shown via Yao's principle with an input distribution that chooses the position of the first difference uniformly at random, and then chooses random strings for the shared prefix up to that position and the rest of the inputs after that position.[6][15]
Yao's principle has also been applied to the competitive ratio of online algorithms. An online algorithm must respond to a sequence of requests, without knowledge of future requests, incurring some cost or profit per request depending on its choices. The competitive ratio is the ratio of its cost or profit to the value that could be achieved achieved by an offline algorithm with access to knowledge of all future requests, for a worst-case request sequence that causes this ratio to be as far from one as possible. Here, one must be careful to formulate the ratio with the algorithm's performance in the numerator and the optimal performance of an offline algorithm in the denominator, so that the cost measure can be formulated as an expected value rather than as the reciprocal of an expected value.[5]
An example given by Borodin & El-Yaniv (2005) concerns page replacement algorithms, which respond to requests for pages of computer memory by using a cache of pages, for a given parameter . If a request matches a cached page, it costs nothing; otherwise one of the cached pages must be replaced by the requested page, at a cost of one page fault. A difficult distribution of request sequences for this model can be generated by choosing each request uniformly at random from a pool of pages. Any deterministic online algorith has expected page faults, over requests. Instead, an offline algorithm can divide the request sequence into phases within which only pages are used, incurring only one fault at the start of a phase to replace the one page that is unused within the phase. As an instance of the coupon collector's problem, the expected requests per phase is , where is the th harmonic number. By renewal theory, the offline algorithm incurs page faults with high probability, so the competitive ratio of any deterministic algorithm against this input distribution is at least . By Yao's principle, also lower bounds the competitive ratio of any randomized page replacement algorithm against a request sequence chosen by an oblivious adversary to be a worst case for the algorithm but without knowledge of the algorithm's random choices.[16]
For online problems in a general class related to the ski rental problem, Seiden has proposed a cookbook method for deriving optimally hard input distributions, based on certain parameters of the problem.[17]
Yao's principle may be interpreted in game theoretic terms, via a two-player zero-sum game in which one player, Alice, selects a deterministic algorithm, the other player, Bob, selects an input, and the payoff is the cost of the selected algorithm on the selected input. Any randomized algorithm may be interpreted as a randomized choice among deterministic algorithms, and thus as a mixed strategy for Alice. Similarly, a non-random algorithm may be thought of as a pure strategy for Alice. In any two-player zero-sum game, if one player chooses a mixed strategy, then the other player has an optimal pure strategy against it. By the minimax theorem of John von Neumann, there exists a game value , and mixed strategies for each player, such that the players can guarantee expected value or better by playing those strategies, and such that the optimal pure strategy against either mixed strategy produces expected value exactly . Thus, the minimax mixed strategy for Alice, set against the best opposing pure strategy for Bob, produces the same expected game value as the minimax mixed strategy for Bob, set against the best opposing pure strategy for Alice. This equality of expected game values, for the game described above, is Yao's principle in its form as an equality.[5] Yao's 1977 paper, originally formulating Yao's principle, proved it in this way.[2]
The optimal mixed strategy for Alice (a randomized algorithm) and the optimal mixed strategy for Bob (a hard input distribution) may each be computed using a linear program that has one player's probabilities as its variables, with a constraint on the game value for each choice of the other player. The two linear programs obtained in this way for each player are dual linear programs, whose equality is an instance of linear programming duality.[3] However, although linear programs may be solved in polynomial time, the numbers of variables and constraints in these linear programs (numbers of possible algorithms and inputs) are typically too large to list explicitly. Therefore, formulating and solving these programs to find these optimal strategies is often impractical.[13][14]
For Monte Carlo algorithms, algorithms that use a fixed amount of computational resources but that may produce an erroneous result, a form of Yao's principle applies to the probability of an error, the error rate of an algorithm. Choosing the hardest possible input distribution, and the algorithm that achieves the lowest error rate against that distribution, gives the same error rate as choosing an optimal algorithm and its worst case input distribution. However, the hard input distributions found in this way are not robust to changes in the parameters used when applying this principle. If an input distribution requires high complexity to achieve a certain error rate, it may nevertheless have unexpectedly low complexity for a different error rate. Ben-David and Blais show that, for Boolean functions under many natural measures of computational complexity, there exists an input distribution that is simultaneously hard for all error rates.[18]
Variant's of Yao's principle have also been considered for quantum computing. In place of randomized algorithms, one may consider quantum algorithms that have a good probability of computing the correct value for every input (probability at least ); this condition together with polynomial time defines the complexity class BQP. It does not make sense to ask for deterministic quantum algorithms, but instead one may consider algorithms that, for a given input distribution, have probability 1 of computing a correct answer, either in a weak sense that the inputs for which this is true have probability , or in a strong sense in which, in addition, the algorithm must have probability 0 or 1 of generating any particular answer on the remaining inputs. For any Boolean function, the minimum complexity of a quantum algorithm that is correct with probability against its worst-case input is less than or equal to the minimum complexity that can be attained, for a hard input distribution, by the best weak or strong quantum algorithm against that distribution. The weak form of this inequality is within a constant factor of being an equality, but the strong form is not.[19]
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.