【发布时间】:2021-07-07 08:20:57
【问题描述】:
假设我有以下文件foo.lp:
foo(x).
现在当我运行gringo -t -c x=1 foo.lp 时,我显然得到了:
foo(1).
现在我想知道如何实现与 Python API 中的 -c 命令行选项相同的行为,例如:
from clingo.control import Control
ctl = Control()
ctl.load('foo.lp')
#ctl.ground() # What to do here exactly?
这样我就可以访问已解决程序的基本程序/模型并替换了常数项。
【问题讨论】:
-
我认为您对接地子程序感兴趣,即根据需要使用带有参数和接地的程序指令。以下是一些示例:github.com/potassco/clingo/blob/master/examples/clingo/…
标签: python logic-programming answer-set-programming clingo