使用SAT求解器求解魔方
Solving Rubik's Cube Using SAT Solvers
摘要:
魔方是一种简单易懂的益智游戏,最初被称为“魔方”。这是一个著名的规划问题,已经研究了很长时间。然而,许多简单的属性仍然未知。本文研究了现代SAT求解器是否适用于这个难题。据我们所知,我们是第一个将魔方转化为SAT问题的人。为了减少编码所需的变量和子句的数量,我们用3个或2个布尔变量的新方法代替了6个布尔变量的朴素方法来表示每个面元上的每种颜色。为了能够快速求解魔方,我们在6型圈的基础上,用18子类型圈的分层编码代替了18圈的直接编码。为了进一步加快求解速度,我们将两阶段算法的一些性质编码为附加约束,并通过添加约束子句来限制某些移动序列。仅使用有效编码无法解决这个难题。为此,我们改进了现有的SAT求解器,并开发了一个新的SAT求解器的基础上PrecoSAT,虽然它是只适用于魔方。新的SAT求解器用ALO(\emph{at-least-one})求解策略取代了前视求解策略,并将原问题分解为多个子问题。每个子问题都由PrecoSAT解决。实验结果表明,我们的SAT翻译和新的解决技术是有效的。如果没有有效的SAT编码和新的求解技术,魔方将无法被任何SAT求解器求解。使用改进的SAT求解器,我们总是可以找到一个解决方案的长度为20在一个合理的时间。虽然我们的求解器比使用查找表的Kociemba算法慢,但不需要庞大的查找表。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。