Введение
В теории вычислительной сложности рандомизированное полиномиальное время (RP) — это класс сложности задач, для которых существует вероятностная машина Тьюринга, обладающая следующими свойствами:
In computational complexity theory, randomized polynomial time (RP) is the complexity class of problems for which a probabilistic Turing machine exists with these properties:
RP algorithm (1 run) ≥ 1/2 ≤ 1/2 0 1RP algorithm (n runs) ≥ 1 − 2−n ≤ 2−n 0 1co RP algorithm (1 run) 1 0 ≤ 1/2 ≥ 1/2
It always runs in polynomial time in the input size
If the correct answer is NO, it always returns NO
If the correct answer is YES, then it returns YES with probability at least 1/2 (otherwise, it returns NO). In other words, the algorithm is allowed to flip a truly random coin while it is running. The only case in which the algorithm can return YES is if the actual answer is YES; therefore if the algorithm terminates and produces YES, then the correct answer is definitely YES; however, the algorithm can terminate with NO regardless of the actual answer. That is, if the algorithm returns NO, it might be wrong. Some authors call this class R, although this name is more commonly used for the class of recursive languages. If the correct answer is YES and the algorithm is run n times with the result of each run statistically independent of the others, then it will return YES at least once with probability at least 1 − 2^(−n). So if the algorithm is run 100 times, then the chance of it giving the wrong answer every time is lower than the chance that cosmic rays corrupted the memory of the computer running the algorithm. In this sense, if a source of random numbers is available, most algorithms in RP are highly practical. The fraction 1/2 in the definition is arbitrary. The set RP will contain exactly the same problems, even if the 1/2 is replaced by any constant nonzero probability less than 1; here constant means independent of the input to the algorithm.
RP алгоритм (1 запуск) ≥ 1/2 ≤ 1/2 0 1RP алгоритм (n запусков) ≥ 1 − 2−n ≤ 2−n 0 1co RP алгоритм (1 запуск) 1 0 ≤ 1/2 ≥ 1/2
In computational complexity theory, randomized polynomial time (RP) is the complexity class of problems for which a probabilistic Turing machine exists with these properties:
RP algorithm (1 run) ≥ 1/2 ≤ 1/2 0 1RP algorithm (n runs) ≥ 1 − 2−n ≤ 2−n 0 1co RP algorithm (1 run) 1 0 ≤ 1/2 ≥ 1/2
It always runs in polynomial time in the input size
If the correct answer is NO, it always returns NO
If the correct answer is YES, then it returns YES with probability at least 1/2 (otherwise, it returns NO). In other words, the algorithm is allowed to flip a truly random coin while it is running. The only case in which the algorithm can return YES is if the actual answer is YES; therefore if the algorithm terminates and produces YES, then the correct answer is definitely YES; however, the algorithm can terminate with NO regardless of the actual answer. That is, if the algorithm returns NO, it might be wrong. Some authors call this class R, although this name is more commonly used for the class of recursive languages. If the correct answer is YES and the algorithm is run n times with the result of each run statistically independent of the others, then it will return YES at least once with probability at least 1 − 2^(−n). So if the algorithm is run 100 times, then the chance of it giving the wrong answer every time is lower than the chance that cosmic rays corrupted the memory of the computer running the algorithm. In this sense, if a source of random numbers is available, most algorithms in RP are highly practical. The fraction 1/2 in the definition is arbitrary. The set RP will contain exactly the same problems, even if the 1/2 is replaced by any constant nonzero probability less than 1; here constant means independent of the input to the algorithm.
Он всегда выполняется за полиномиальное время относительно размера входных данных.
Если правильный ответ — НЕТ, он всегда возвращает НЕТ.
Если правильный ответ — ДА, то он возвращает ДА с вероятностью не менее 1/2 (в противном случае он возвращает НЕТ). Иными словами, алгоритму разрешается использовать истинно случайную монету в процессе работы. Единственный случай, когда алгоритм может вернуть ДА, — это если фактический ответ ДА; следовательно, если алгоритм завершается и выдает ДА, то правильный ответ определенно ДА; однако алгоритм может завершиться выдачей НЕТ, независимо от фактического ответа. То есть, если алгоритм возвращает НЕТ, он может быть неверным. Некоторые авторы называют этот класс R, хотя это название чаще используется для класса рекурсивных языков. Если правильный ответ — ДА, и алгоритм выполняется n раз, причем результат каждого запуска статистически независим от других, то он вернет ДА хотя бы один раз с вероятностью не менее 1 − 2^(−n). Таким образом, если алгоритм выполняется 100 раз, то вероятность того, что он каждый раз даст неправильный ответ, ниже, чем вероятность того, что космические лучи повредят память компьютера, на котором выполняется алгоритм. В этом смысле, при наличии источника случайных чисел, большинство алгоритмов в RP являются вполне практическими. Дробь 1/2 в определении является произвольной. Множество RP будет содержать ровно те же задачи, даже если 1/2 будет заменено любой ненулевой постоянной вероятностью, меньшей 1; здесь под постоянной подразумевается значение, не зависящее от входных данных алгоритма.
In computational complexity theory, randomized polynomial time (RP) is the complexity class of problems for which a probabilistic Turing machine exists with these properties:
RP algorithm (1 run) ≥ 1/2 ≤ 1/2 0 1RP algorithm (n runs) ≥ 1 − 2−n ≤ 2−n 0 1co RP algorithm (1 run) 1 0 ≤ 1/2 ≥ 1/2
It always runs in polynomial time in the input size
If the correct answer is NO, it always returns NO
If the correct answer is YES, then it returns YES with probability at least 1/2 (otherwise, it returns NO). In other words, the algorithm is allowed to flip a truly random coin while it is running. The only case in which the algorithm can return YES is if the actual answer is YES; therefore if the algorithm terminates and produces YES, then the correct answer is definitely YES; however, the algorithm can terminate with NO regardless of the actual answer. That is, if the algorithm returns NO, it might be wrong. Some authors call this class R, although this name is more commonly used for the class of recursive languages. If the correct answer is YES and the algorithm is run n times with the result of each run statistically independent of the others, then it will return YES at least once with probability at least 1 − 2^(−n). So if the algorithm is run 100 times, then the chance of it giving the wrong answer every time is lower than the chance that cosmic rays corrupted the memory of the computer running the algorithm. In this sense, if a source of random numbers is available, most algorithms in RP are highly practical. The fraction 1/2 in the definition is arbitrary. The set RP will contain exactly the same problems, even if the 1/2 is replaced by any constant nonzero probability less than 1; here constant means independent of the input to the algorithm.
Связанные классы сложности
Определение RP гласит, что ответ "ДА" всегда верен, а ответ "НЕТ" может быть неверным, поскольку экземпляр, для которого правильный ответ "ДА", может возвращать ответ "НЕТ". Класс сложности co RP является дополнением, где ответ "ДА" может быть неверным, а ответ "НЕТ" всегда верен. Класс BPP описывает алгоритмы, которые могут давать неверные ответы как для экземпляров "ДА", так и для "НЕТ", и таким образом содержит как RP, так и co RP. Пересечение множеств RP и co RP называется ZPP. Так же, как RP может называться R, некоторые авторы используют название co R вместо co RP.
Соединение с P и NP
P является подмножеством RP, которое, в свою очередь, является подмножеством NP. Аналогично, P является подмножеством co-RP, которое является подмножеством co-NP. Неизвестно, являются ли эти включения строгими. Однако, если общепринятая гипотеза P = BPP верна, то RP, co-RP и P схлопываются (становятся равными). Если дополнительно предположить, что P ≠ NP, то из этого следует, что RP строго содержится в NP. Неизвестно, верно ли, что RP = co-RP, или что RP является подмножеством пересечения NP и co-NP, хотя это вытекает из P = BPP. Натуральным примером задачи в co-RP, которая в настоящее время не известна как принадлежащая P, является проверка тождества полиномов – задача определения, является ли заданное многомерное арифметическое выражение над целыми числами нулевым полиномом. Например, x·x − y·y − (x + y)·(x − y) является нулевым полиномом, а x·x + y·y – нет. Альтернативная характеристика RP, которую иногда удобнее использовать, заключается в том, что это множество задач, распознаваемых недетерминированными машинами Тьюринга, где машина принимает, если и только если хотя бы некоторая постоянная доля вычислительных путей, не зависящая от размера входных данных, принимает. NP, напротив, требует лишь одного принимающего пути, который может составлять экспоненциально малую долю всех путей. Эта характеристика делает очевидным тот факт, что RP является подмножеством NP.
x·x + y·y is not. An alternative characterization of RP that is sometimes easier to use is the set of problems recognizable by nondeterministic Turing machines where the machine accepts if and only if at least some constant fraction of the computation paths, independent of the input size, accept. NP on the other hand, needs only one accepting path, which could constitute an exponentially small fraction of the paths. This characterization makes the fact that RP is a subset of NP obvious.