[Paper Review] Solving Rubik's Cube Using SAT Solvers
This paper presents the first successful application of SAT solvers to solve Rubik’s Cube optimally, using a novel SAT encoding that reduces variables from 288 to 96 via a 2-variable color representation and layer-based move encoding. The authors enhance PrecoSAT with an ALO (at-least-one) solving strategy and subproblem decomposition, enabling the solver to find optimal solutions of length 20 in reasonable time without requiring large lookup tables.
Rubik's Cube is an easily-understood puzzle, which is originally called the "magic cube". It is a well-known planning problem, which has been studied for a long time. Yet many simple properties remain unknown. This paper studies whether modern SAT solvers are applicable to this puzzle. To our best knowledge, we are the first to translate Rubik's Cube to a SAT problem. To reduce the number of variables and clauses needed for the encoding, we replace a naive approach of 6 Boolean variables to represent each color on each facelet with a new approach of 3 or 2 Boolean variables. In order to be able to solve quickly Rubik's Cube, we replace the direct encoding of 18 turns with the layer encoding of 18-subtype turns based on 6-type turns. To speed up the solving further, we encode some properties of two-phase algorithm as an additional constraint, and restrict some move sequences by adding some constraint clauses. Using only efficient encoding cannot solve this puzzle. For this reason, we improve the existing SAT solvers, and develop a new SAT solver based on PrecoSAT, though it is suited only for Rubik's Cube. The new SAT solver replaces the lookahead solving strategy with an ALO (\emph{at-least-one}) solving strategy, and decomposes the original problem into sub-problems. Each sub-problem is solved by PrecoSAT. The empirical results demonstrate both our SAT translation and new solving technique are efficient. Without the efficient SAT encoding and the new solving technique, Rubik's Cube will not be able to be solved still by any SAT solver. Using the improved SAT solver, we can find always a solution of length 20 in a reasonable time. Although our solver is slower than Kociemba's algorithm using lookup tables, but does not require a huge lookup table.
Motivation & Objective
- To develop an efficient SAT encoding for Rubik’s Cube, a classic planning problem with unknown optimal properties.
- To overcome the limitations of standard SAT solvers in solving complex state-transition puzzles like Rubik’s Cube.
- To design a new SAT solving strategy tailored to the puzzle’s structure, enabling optimal solution finding without large lookup tables.
- To demonstrate that SAT solvers can solve hard combinatorial puzzles like Rubik’s Cube when combined with problem-specific optimizations.
Proposed method
- Replace the naive 6-variable per facelet encoding with a 2- or 3-variable encoding to reduce the number of Boolean variables from 288 to 96 or 144.
- Use a layer-based encoding of 18 move types into 6 base turn types to reduce clause count and improve scalability.
- Adopt the two-phase algorithm’s goal state of phase 1 as an additional constraint in the CNF formula to guide search.
- Implement a new ALO (at-least-one) solving strategy that decomposes the problem into subproblems based on AMO constraint variables.
- Enhance PrecoSAT by integrating decision variable selection based on AMO clause participation and solve subproblems independently.
- Integrate heuristic information from the two-phase algorithm into the CNF encoding to prune the search space.
Experimental results
Research questions
- RQ1Can modern SAT solvers be effectively applied to solve Rubik’s Cube, a well-known planning problem with high state space complexity?
- RQ2What is the optimal SAT encoding strategy for minimizing variables and clauses in Rubik’s Cube representation?
- RQ3Can a SAT solver find optimal solutions (length 20) without relying on large lookup tables or pattern databases?
- RQ4How can the two-phase algorithm’s structure be encoded into CNF to improve solving efficiency?
- RQ5Can a hybrid SAT solving strategy, such as ALO with subproblem decomposition, outperform standard SAT solving on this puzzle?
Key findings
- The proposed SAT encoding reduces the number of Boolean variables from 288 to 96, significantly decreasing problem size.
- The improved SAT solver, based on PrecoSAT with ALO strategy and subproblem decomposition, successfully finds optimal solutions of length 20 in a reasonable time.
- For 10 randomly generated cube states, the solver found solutions of length ≤20 within 7,000 seconds, with some under 100 seconds.
- When phase 1 length is known in advance (e.g., 13 moves), the solver finds optimal 20-move solutions in under 310 seconds.
- The approach requires only 10 MB of RAM, demonstrating minimal memory usage compared to lookup-table-based methods.
- While slower than Kociemba’s algorithm with lookup tables, the SAT-based method avoids the need for massive precomputed databases.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.