词条 | Parametric search |
释义 |
In the design and analysis of algorithms for combinatorial optimization, parametric search is a technique invented by {{harvs|first=Nimrod|last=Megiddo|year=1983|authorlink=Nimrod Megiddo|txt}} for transforming a decision algorithm (does this optimization problem have a solution with quality better than some given threshold?) into an optimization algorithm (find the best solution). It is frequently used for solving optimization problems in computational geometry. TechniqueThe basic idea of parametric search is to simulate a test algorithm that takes as input a numerical parameter , as if it were being run with the (unknown) optimal solution value as its input. This test algorithm is assumed to behave discontinuously when , and to operate on its parameter only by simple comparisons of with other computed values, or by testing the sign of low-degree polynomial functions of . To simulate the algorithm, each of these comparisons or tests needs to be simulated, even though the of the simulated algorithm is unknown. To simulate each comparison, the parametric search applies a second algorithm, a decision algorithm, that takes as input another numerical parameter , and that determines whether is above, below, or equal to the optimal solution value . Since the decision algorithm itself necessarily behaves discontinuously at , the same algorithm can also be used as the test algorithm. However, many applications use other test algorithms (often, comparison sorting algorithms). Advanced versions of the parametric search technique use a parallel algorithm as the test algorithm, and group the comparisons that must be simulated into batches, in order to significantly reduce the number of instantiations of the decision algorithm. Sequential test algorithmIn the most basic form of the parametric search technique, both the test algorithm and the decision algorithms are sequential (non-parallel) algorithms, possibly the same algorithm as each other. The technique simulates the test algorithm step by step, as it would run when given the (unknown) optimal solution value as its parameter . Whenever the simulation reaches a step in which the test algorithm compares its parameter to some other number , it cannot perform this step by doing a numerical comparison, as it does not know what is. Instead, it calls the decision algorithm with parameter , and uses the result of the decision algorithm to determine the output of the comparison. In this way, the time for the simulation ends up equalling the product of the times for the test and decision algorithms. Because the test algorithm is assumed to behave discontinuously at the optimal solution value, it cannot be simulated accurately unless one of the parameter values passed to the decision algorithm is actually equal to the optimal solution value. When this happens, the decision algorithm can detect the equality and save the optimal solution value for later output. If the test algorithm needs to know the sign of a polynomial in , this can again be simulated by passing the roots of the polynomial to the decision algorithm in order to determine whether the unknown solution value is one of these roots, or, if not, which two roots it lies between. An example considered both by {{harvtxt|Megiddo|1983}} and {{harvtxt|van Oostrum|Veltkamp|2002}} concerns a system of an odd number of particles, all moving rightward at different constant speeds along the same line. The median of the particles, also, will have a rightward motion, but one that is piecewise linear rather than having constant speed, because different particles will be the median at different times. Initially the particles, and their median, are to the left of the origin of the line, and eventually they and their median will all be to the right of the origin. The problem is to compute the time at which the median lies exactly on the origin. A linear time decision algorithm is easy to define: for any time , one can compute the position of each particle at time and count the number of particles on each side of the origin. If there are more particles on the left than on the right, then , and if there are more particles on the right than on the left, then . Each step of this decision algorithm compares the input parameter to the time that one of the particles crosses the origin. Using this decision algorithm as both the test algorithm and the decision algorithm of a parametric search leads to an algorithm for finding the optimal time in quadratic total time. To simulate the decision algorithm for parameter , the simulation must determine, for each particle, whether its crossing time is before or after , and therefore whether it is to the left or right of the origin at time . Answering this question for a single particle – comparing the crossing time for the particle with the unknown optimal crossing time – can be performed by running the same decision algorithm with the crossing time for the particle as its parameter. Thus, the simulation ends up running the decision algorithm on each of the particle crossing times, one of which must be the optimal crossing time. Running the decision algorithm once takes linear time, so running it separately on each crossing time takes quadratic time. Parallel test algorithmAs {{harvtxt|Megiddo|1983}} already observed, the parametric search technique can be substantially sped up by replacing the simulated test algorithm by an efficient parallel algorithm, for instance in the parallel random-access machine (PRAM) model of parallel computation, where a collection of processors operate in synchrony on a shared memory, all performing the same sequence of operations on different memory addresses. If the test algorithm is a PRAM algorithm uses processors and takes time (that is, steps in which each processor performs a single operation), then each of its steps may be simulated by using the decision algorithm to determine the results of at most numerical comparisons. By finding a median or near-median value in the set of comparisons that need to be evaluated, and passing this single value to the decision algorithm, it is possible to eliminate half or nearly half of the comparisons with only a single call of the decision algorithm. By repeatedly halving the set of comparisons required by the simulation in this way, until none are left, it is possible to simulate the results of numerical comparisons using only calls to the decision algorithm. Thus, the total time for parametric search in this case becomes (for the simulation itself) plus the time for calls to the decision algorithm (for batches of comparisons, taking calls per batch). Often, for a problem that can be solved in this way, the time-processor product of the PRAM algorithm is comparable to the time for a sequential decision algorithm, and the parallel time is polylogarithmic, leading to a total time for the parametric search that is slower than the decision algorithm by only a polylogarithmic factor. In the case of the example problem of finding the crossing time of the median of moving particles, the sequential test algorithm can be replaced by a parallel sorting algorithm that sorts the positions of the particles at the time given by the algorithm's parameter, and then uses the sorted order to determine the median particle and find the sign of its position. The best choice for this algorithm (according to its theoretical analysis, if not in practice) is the sorting network of {{harvs|author1-link=Miklós Ajtai|last1=Ajtai|author2-link=János Komlós (mathematician)|last2=Komlós|author3-link=Endre Szemerédi|last3=Szemerédi|year=1983|txt}}. This can be interpreted as a PRAM algorithm in which the number of processors is proportional to the input length , and the number of parallel steps is logarithmic. Thus, simulating this algorithm sequentially takes time for the simulation itself, together with batches of comparisons, each of which can be handled by calls to the linear-time decision algorithm. Putting these time bounds together gives total time for the parametric search. This is not the optimal time for this problem – the same problem can be solved more quickly by observing that the crossing time of the median equals the median of the crossing times of the particles – but the same technique can be applied to other more complicated optimization problems, and in many cases provides the fastest known strongly polynomial algorithm for these problems. Because of the large constant factors arising in the analysis of the AKS sorting network, parametric search using this network as the test algorithm is not practical. Instead, {{harvtxt|van Oostrum|Veltkamp|2002}} suggest using a parallel form of quicksort (an algorithm that repeatedly partitions the input into two subsets and then recursively sorts each subset). In this algorithm, the partition step is massively parallel (each input element should be compared to a chosen pivot element) and the two recursive calls can be performed in parallel with each other. The resulting parametric algorithm is slower in the worst case than an algorithm based on the AKS sorting network. However, van Oostrum and Veltkamp argue that if the results of past decision algorithms are saved (so that only the comparisons unresolved by these results will lead to additional calls to the decision algorithm) and the comparison values tested by the simulated test algorithm are sufficiently evenly distributed, then as the algorithm progresses the number of unresolved comparisons generated in each time step will be small. Based on this heuristic analysis, and on experimental results with an implementation of the algorithm, they argue that a quicksort-based parametric search algorithm will be more practical than its worst-case analysis would suggest. Desynchronized sorting{{harvtxt|Cole|1987}} further optimized the parametric search technique for cases (such as the example) in which the test algorithm is a comparison sorting algorithm. For the AKS sorting network and some other sorting algorithms that can be used in its place, Cole observes that it is not necessary to keep the simulated processors synchronized with each other: instead, one can allow some of them to progress farther through the sorting algorithm while others wait for the results of their comparisons to be determined. Based on this principle, Cole modifies the simulation of the sorting algorithm, so that it maintains a collection of unresolved simulated comparisons that may not all come from the same parallel time step of the test algorithm. As in the synchronized parallel version of parametric search, it is possible to resolve half of these comparisons by finding the median comparison value and calling the decision algorithm on this value. Then, instead of repeating this halving procedure until the collection of unresolved comparisons becomes empty, Cole allows the processors that were waiting on the resolved comparisons to advance through the simulation until they reach another comparison that must be resolved.Using this method, Cole shows that a parametric search algorithm in which the test algorithm is sorting may be completed using only a logarithmic number of calls to the decision algorithm, instead of the calls made by Megiddo's original version of parametric search. Instead of using the AKS sorting network, it is also possible to combine this technique with a parallel merge sort algorithm of {{harvtxt|Cole|1988}}, resulting in time bounds with smaller constant factors that, however, are still not small enough to be practical. A similar speedup can be obtained for any problem that can be computed on a distributed computing network of bounded degree (as the AKS sorting network is), either by Cole's technique or by a related technique of simulating multiple computation paths {{harv|Fernández-Baca|2001}}. {{harvtxt|Goodrich|Pszona|2013}} combine Cole's theoretical improvement with the practical speedups of {{harvtxt|van Oostrum|Veltkamp|2002}}. Instead of using a parallel quicksort, as van Oostrum and Veltkamp did, they use boxsort, a variant of quicksort developed by {{harvtxt|Reischuk|1985}} in which the partitioning step partitions the input randomly into smaller subproblems instead of only two subproblems. As in Cole's technique, they use a desynchronized parametric search, in which each separate thread of execution of the simulated parallel sorting algorithm is allowed to progress until it needs to determine the result of another comparison, and in which the number of unresolved comparisons is halved by finding the median comparison value and calling the decision algorithm with that value. As they show, the resulting randomized parametric search algorithm makes only a logarithmic number of calls to the decision algorithm with high probability, matching Cole's theoretical analysis. An extended version of their paper includes experimental results from an implementation of the algorithm, which show that the total running time of this method on several natural geometric optimization problems is similar to that of the best synchronized parametric search implementation (the quicksort-based method of van Oostrum and Veltkamp): a little faster on some problems and a little slower on some others. However, the number of calls that it makes to the decision algorithm is significantly smaller, so this method would obtain greater benefits in applications of parametric searching where the decision algorithm is slower.On the example problem of finding the median crossing time of a point, both Cole's algorithm and the algorithm of Goodrich and Pszona obtain running time . In the case of Goodrich and Pszona, the algorithm is randomized, and obtains this time bound with high probability. Comparison with binary searchThe bisection method (binary search) can also be used to transform decision into optimization. In this method, one maintains an interval of numbers, known to contain the optimal solution value, and repeatedly shrinks the interval by calling the decision algorithm on its median value and keeping only the half-interval above or below the median, depending on the outcome of the call. Although this method can only find a numerical approximation to the optimal solution value, it does so in a number of calls to the decision algorithm proportional to the number of bits of precision of accuracy for this approximation, resulting in weakly polynomial algorithms. Instead, when applicable, parametric search finds strongly polynomial algorithms, whose running time is a function only of the input size and is independent of numerical precision. However, parametric search leads to an increase in time complexity (compared to the decision algorithm) that may be larger than logarithmic. Because they are strongly rather than weakly polynomial, algorithms based on parametric search are more satisfactory from a theoretical point of view. In practice, binary search is fast and often much simpler to implement, so algorithm engineering efforts are needed to make parametric search practical. Nevertheless, {{harvtxt|van Oostrum|Veltkamp|2002}} write that "while a simple binary-search approach is often advocated as a practical replacement for parametric search, it is outperformed by our [parametric search] algorithm" in the experimental comparisons that they performed. ApplicationsParametric search has been applied in the development of efficient algorithms for optimization problems, particularly in computational geometry {{harv|Agarwal|Sharir|Toledo|1994}}. They include the following:
References
| last1 = Agarwal | first1 = Pankaj K. | author1-link = Pankaj K. Agarwal | last2 = Matoušek | first2 = Jiří | author2-link = Jiří Matoušek (mathematician) | doi = 10.1137/0222051 | issue = 4 | journal = SIAM Journal on Computing | mr = 1227762 | pages = 794–806 | title = Ray shooting and parametric search | volume = 22 | year = 1993}}
| last1 = Agarwal | first1 = Pankaj K. | author1-link = Pankaj K. Agarwal | last2 = Sharir | first2 = Micha | author2-link = Micha Sharir | last3 = Toledo | first3 = Sivan | doi = 10.1006/jagm.1994.1038 | issue = 3 | journal = Journal of Algorithms | mr = 1300253 | pages = 292–318 | title = Applications of parametric searching in geometric optimization | volume = 17 | year = 1994}}.
| last1 = Ajtai | first1 = M. | author1-link = Miklós Ajtai | last2 = Komlós | first2 = J. | author2-link = János Komlós (mathematician) | last3 = Szemerédi | first3 = E. | author3-link = Endre Szemerédi | contribution = An {{math|O(n log n)}} sorting network | doi = 10.1145/800061.808726 | isbn = 0-89791-099-0 | pages = 1–9 | title = Proceedings of the 15th ACM Symposium on Theory of Computing (STOC '83) | year = 1983}}.
| last1 = Alt | first1 = Helmut | last2 = Godau | first2 = Michael | doi = 10.1142/S0218195995000064 | issue = 1-2 | journal = International Journal of Computational Geometry & Applications | mr = 1331177 | pages = 75–91 | title = Computing the Fréchet distance between two polygonal curves | url = http://www.staff.science.uu.nl/~kreve101/asci/ag-cfdbt-95.pdf | volume = 5 | year = 1995}}.
| last = Cole | first = Richard | doi = 10.1145/7531.7537 | issue = 1 | journal = Journal of the ACM | mr = 882669 | pages = 200–208 | title = Slowing down sorting networks to obtain faster sorting algorithms | volume = 34 | year = 1987}}.
| last = Cole | first = Richard | doi = 10.1137/0217049 | issue = 4 | journal = SIAM Journal on Computing | mr = 953293 | pages = 770–785 | title = Parallel merge sort | volume = 17 | year = 1988}}.
| last1 = Cole | first1 = Richard | last2 = Salowe | first2 = Jeffrey S. | last3 = Steiger | first3 = W. L. | last4 = Szemerédi | first4 = Endre | author4-link = Endre Szemerédi | doi = 10.1137/0218055 | issue = 4 | journal = SIAM Journal on Computing | mr = 1004799 | pages = 792–810 | title = An optimal-time algorithm for slope selection | volume = 18 | year = 1989}}.
| last = Fernández-Baca | first = D. | doi = 10.1007/s00453-001-0001-2 | issue = 1 | journal = Algorithmica | mr = 1816864 | pages = 1–11 | title = On nonlinear parametric search | volume = 30 | year = 2001}}.
| last1 = Goodrich | first1 = Michael T. | author1-link = Michael T. Goodrich | last2 = Pszona | first2 = Paweł | arxiv = 1306.3000 | contribution = Cole's parametric search technique made practical | contribution-url = http://cccg.ca/proceedings/2013/papers/paper_19.pdf | title = Proc. 25th Canadian Conference on Computational Geometry (CCCG 2013) | year = 2013| bibcode = 2013arXiv1306.3000G}}.
| last = Megiddo | first = Nimrod | authorlink = Nimrod Megiddo | doi = 10.1145/2157.322410 | issue = 4 | journal = Journal of the ACM | mr = 819134 | pages = 852–865 | title = Applying parallel computation algorithms in the design of serial algorithms | volume = 30 | year = 1983}}.
| last = Reischuk | first = Rüdiger | doi = 10.1137/0214030 | issue = 2 | journal = SIAM Journal on Computing | mr = 784745 | pages = 396–409 | title = Probabilistic parallel algorithms for sorting and selection | volume = 14 | year = 1985}}.
| last1 = van Oostrum | first1 = René | last2 = Veltkamp | first2 = Remco C. | contribution = Parametric search made practical | doi = 10.1145/513400.513401 | isbn = 1-58113-504-1 | location = New York, NY, USA | pages = 1–9 | publisher = ACM | title = Proceedings of the Eighteenth Annual Symposium on Computational Geometry (SoCG '02) | year = 2002}}. 1 : Combinatorial optimization |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。