0

我正在运行一个简单的 ASP 程序:

%Defining possible states of each of the rook space
occupied(t; f).

%Generate all possible grids
{rook(X, Y, D) : occupied(D)} = 1 :- X=2..x, Y=2..y.

%Bound the grid with empty space
rook(X, Y, f) :- X=0, Y=1..y.
rook(X, Y, f) :- X=x+1, Y=1..y.
rook(X, Y, f) :- X=1..x, Y=0.
rook(X, Y, f) :- X=1..x, Y=y+1.

%Surrounding space is considered free path
freePath(X, Y) :- X=0, Y=1..y.
freePath(X, Y) :- X=x+1, Y=1..y.
freePath(X, Y) :- X=1..x, Y=0.
freePath(X, Y) :- X=1..x, Y=y+1.

%Generate empty path from the outside space
freePath(X, Y) :- rook(X, Y, f), freePath(X+1, Y).
freePath(X, Y) :- rook(X, Y, f), freePath(X-1, Y).
freePath(X, Y) :- rook(X, Y, f), freePath(X, Y-1).
freePath(X, Y) :- rook(X, Y, f), freePath(X, Y+1).

%Remove any grid where a rook is not adjacent to a free path
:- rook(X, Y, t), not freePath(X, Y+1),
                  not freePath(X, Y-1),
                  not freePath(X-1, Y),
                  not freePath(X+1, Y).

%Maximize the number of rooks by minimizing empty space
#maximize{1, X, Y : rook(X, Y, t)}.
#show rook/3.

为了尝试通过打破对称性来减少搜索空间,我一直在尝试使用Potassco 网站上的 sbass 工具

我正在使用 Ubuntu 20.04 LTS。在 sbass 文件中运行 make 并获取可执行文件后,我只运行:

gringo ./rooks-game.lp -c x=5 -c y=5 | ./sbass

它抛出了一个错误:

./sbass: unable to read input

我错过了什么?根据文章,sbass 应该只是能够获取 gringo 的输出。

4

0 回答 0