Остання редакція: 2026-11-26
Анотація
У роботі розглянуто спосіб зниження обчислювальної складності комбінаторного пошуку з поверненням шляхом заміни масивів і матриць булевих значень бітовими масками, у яких множини елементів стану подаються розрядами машинного слова. Показано, що формування множини допустимих кандидатів у вузлі дерева пошуку зводиться до сталої кількості порозрядних операцій над N/w машинними словами (w – розрядність слова) замість N перевірок окремих елементів. Експериментально на задачах про N ферзів та підрахунку кліків отримано прискорення пошуку в 2,2–7,7 раза без зміни алгоритму та кількості відвіданих вузлів
The paper considers a way to reduce the computational complexity of combinatorial backtracking search by replacing arrays and matrices of Boolean values with bit masks, in which the sets of state elements are stored as bits of a machine word. It is shown that building the set of admissible candidates in a search-tree node reduces to a constant number of bitwise operations over N/w machine words (w is the word length) instead of N element-wise checks. Experiments on the N-queens problem and clique counting show a speedup of 2.2–7.7 times without changing the algorithm or the number of visited nodes.
Ключові слова
Посилання
1. Knuth D. E. The Art of Computer Programming. Vol. 4A: Combinatorial Algorithms, Part 1. – Upper Saddle River: Addison-Wesley, 2011. – 883 p.
2. Warren H. S. Hacker’s Delight. 2nd ed. – Upper Saddle River: Addison-Wesley, 2012. – 512 p.
3. Bitboards // Chess Programming Wiki. – URL: https://www.chessprogramming.org/Bitboards (дата звернення: 11.11.2026).
4. Cormen T. H., Leiserson C. E., Rivest R. L., Stein C. Introduction to Algorithms. 4th ed. – Cambridge: The MIT Press, 2022. – 1312 p.
5. Hennessy J. L., Patterson D. A. Computer Architecture: A Quantitative Approach. 6th ed. – Cambridge: Morgan Kaufmann, 2017. – 936 p.
6. Bron C., Kerbosch J. Algorithm 457: finding all cliques of an undirected graph // Communications of the ACM. – 1973. – Vol. 16, No. 9. – P. 575–577.
7. San Segundo P., Rodríguez-Losada D., Jiménez A. An exact bit-parallel algorithm for the maximum clique problem // Computers & Operations Research. – 2011. – Vol. 38, No. 2. – P. 571–581.
8. Held M., Karp R. M. A dynamic programming approach to sequencing problems // Journal of the Society for Industrial and Applied Mathematics. – 1962. – Vol. 10, No. 1. – P. 196–210.