0

I'm running a simple ASP program:

%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.

In order to try to cut down the search space by breaking symmetries, I've been trying to use the sbass tool that's on Potassco's website

I'm using Ubuntu 20.04 LTS. After running make in the sbass file and getting the executable and I just run:

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

And it's throwing an error:

./sbass: unable to read input

What am I missing? According to the article, sbass should just be able to take the output of gringo.

  • Could you check the output of the gringo command? In my case (gringo version 5.5.0), it terminates with an error (duplicate constant definition); There seem to be a typo in your command -c x=5 -c y=5 – tphilipp Sep 28 '20 at 09:06
  • It seems that sbass does not parse the header of the generated file; if you ignore the first line of the gringo output (tail -n +2), then sbass processes the gringo output – tphilipp Sep 28 '20 at 09:22
  • @tphilipp Thanks! That worked! – chinahalffull Sep 29 '20 at 16:30

0 Answers0