Abstract
We propose an algorithm comprising some new techniques to efficiently search the entire state space of the Yin-Yang puzzle which is an NP-complete problem, by skipping invalid solutions ranges. The algorithm features efficient memory usage and parallel execution. More than 99% of the state space for most of the puzzle’s board sizes is skipped. It speeds up the process of finding valid solutions significantly. We were able to find all valid solutions in the space of more than 18 million billion states using a regular desktop PC. Another research about the Yin-Yang puzzle has examined the largest full-empty Yin-Yang board of size \(5\times 6\). Our proposed algorithm significantly improves performance. Using four parallel threads, it is 357 times faster than the regular and modified BFS and DFS algorithms used in that research, and it performs 192 times faster using a single thread. Our algorithm also consumes over 26,000 times less memory than the other algorithms.
Similar content being viewed by others
Data availability
The dataset and the application for viewing the results are available on GitHub.
Notes
State space is the set of all possible states that the environment (like pieces in a Yin-Yang puzzle board) can be in. [3]
References
Demaine ED, Lynch J, Rudoy M, Uno Y (2021) Yin-Yang Puzzles are NP-complete. In: 33rd Canadian Conference on Computational Geometry, Halifox, Nova Scotia, Canada, pp 10
Putra MI, Arzaki M, Wulandari GS (2022) Solving Yin-Yang puzzles using exhaustive search and prune-and-search algorithms. Int J Comput Sci Appl Math 8(2):52. https://doi.org/10.12962/j24775401.v8i2.13720
Russel S, Norvig P (2012) Artificial intelligence-a modern approach 3rd edition. https://doi.org/10.1017/S0269888900007724
Demaine ED, Demaine ML (2022) Puzzle fonts about puzzles. In: Exchange book of the 14th gathering for gardner (G4G14). Atlanta, Georgia, pp 1–19
Demaine ED, Demaine ML (2021) More than words: fonts as generative art. In: Proceedings of the 24th Generative Art Conference (GA 2021), Sardinia, Italy, pp 371–380
Kazimoglu C, Kiernan M, Bacon L, MacKinnon L (2012) Learning programming at the computational thinking level via digital game-play. Proc Comput Sci 9:522–531
Recalde D, Torres R, Vaca P (2020) An exact approach for the multi-constraint graph partitioning problem. EURO J Comput Optim 8(3–4):289–308
Korf RE, Schultze P (2005) Large-scale parallel breadth-first search. In: Proceedings of the National Conference on Artificial Intelligence, vol. 3
Jacobs A (2009) The pathologies of big data. Commun ACM 10(1145/1536616):1536632
Sun Y, Zheng G, Jetley P, Kalé LV (2011) An adaptive framework for large-scale state space search. In: IEEE international symposium on parallel and distributed processing workshops and Phd forum. https://doi.org/10.1109/IPDPS.2011.338
Owens JD, Houston M, Luebke D, Green S, Stone JE, Phillips JC (2008) GPU computing. Proc IEEE. https://doi.org/10.1109/JPROC.2008.917757
Funding
No funding has been received by any organization.
Author information
Authors and Affiliations
Contributions
Both authors have contributed equally to this work.
Corresponding author
Ethics declarations
Conflict of interest
The authors declared no conflict of interest.
Ethical approval
This declaration is not applicable. There are no human and/ or animal studies included in this manuscript.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
We would like to express our sincere gratitude to the reviewers for their valuable comments and great suggestions that helped us improve the quality and clarity of our paper. We appreciate their time and effort in reviewing our work.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Ahmadi, A., Khorramian, A. Efficient Brute-force state space search for Yin-Yang puzzle. J Supercomput 80, 3066–3088 (2024). https://doi.org/10.1007/s11227-023-05565-w
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11227-023-05565-w