dodaro / cnl2asp

A tool for converting CNL sentences to ASP rules.
https://dodaro.github.io/cnl2asp/
Apache License 2.0
1 stars 1 forks source link

Hard Crash when using using ngo for optimization #20

Open GregGelfond opened 3 months ago

GregGelfond commented 3 months ago

Consider the following N-Queens encoding:

number_of_queens is a constant equal to 8.

Row goes from 1 to number_of_queens.
Column goes from 1 to number_of_queens.

Every row can have a queen_at exactly 1 column.
Every column can have a queen_at exactly 1 row.

It is prohibited that
    row R1 has a queen_at column C1 and also
    row R2 has a queen_at column C2 where
    R1 is less than R2 and
    R1 - C1 is equal to R2 - C2.

It is prohibited that
    row R1 has a queen_at column C1 and also
    row R2 has a queen_at column C2 where
    R1 is less than R2 and
    R1 + C1 is equal to R2 + C2.

If I use the command cnl2asp -o on the file which contains this model, then I get a hard crash:

cnl2asp -o cnl-encodings/n-queens.cnl
zsh: segmentation fault  cnl2asp -o cnl-encodings/n-queens.cnl

For context, here's the basics of what I'm "running":

pip list
Package                   Version
------------------------- --------------
clingcon                  5.2.1
clingo                    5.7.1
clingox                   1.2.1
Clorm                     1.6.0
cnl2asp                   1.3.8
ngo                       1.0.2
plingo                    1.1.0
telingo                   2.1.3

python --version
Python 3.12.2

This is all using a MacBook Pro with an M3 Max processor.

GregGelfond commented 3 months ago

If it helps, here's the crash dump.

python3.12-2024-08-12-132745.txt

simocaruso commented 3 months ago

It seems a bug from ngo side. Did you try to first run cnl2asp and then ngo (https://potassco.org/ngo/ngo.html) separately?