通过异常处理实现回跳
Implementing backjumping by means of exception handling
AI总结:
本文研究在 Prolog 中用 throw/1 和 catch/3 实现回跳的可行性,指出一般情形下不可行,并提出两种受限解决方案,同时讨论了基于回溯与数据库的实现及协程化下的异常处理语义。
摘要:
我们讨论如何利用内建谓词 throw/1 和 catch/3 在 Prolog 中实现回跳(或智能回溯)。我们表明,与“回跳就是异常处理”这一说法相反,在一般情况下这是不可能的。我们提供两种解决方案。一种适用于二元程序;在一般情况下,它对回跳可能产生的位置施加了限制。另一种则限制回跳目标的类别。我们还讨论了利用回溯和 Prolog 数据库实现回跳的方法。此外,我们解释了在存在协程化的情况下 Prolog 异常处理的语义。
英文摘要:
We discuss how to implement backjumping (or intelligent backtracking) in Prolog by using the built-ins throw/1 and catch/3. We show that it is impossible in a general case, contrary to a claim that ``backjumping is exception handling". We provide two solutions. One works for binary programs; in a general case it imposes a restriction on where backjumping may originate. The other restricts the class of backjump targets. We also discuss implementing backjumping by using backtracking and the Prolog database. Additionally, we explain the semantics of Prolog exception handling in the presence of coroutining.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。