Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with --pre option #88

Closed
javier-romero opened this issue Mar 29, 2023 · 3 comments
Closed

Bug with --pre option #88

javier-romero opened this issue Mar 29, 2023 · 3 comments

Comments

@javier-romero
Copy link

Hi! For the following program, clasp --pre option does not print correctly the minimize statement.

$ cat bug.aspif 
asp 1 0 0
1 0 1 14 0 0
1 0 1 15 0 1 16
1 0 1 17 0 1 18
1 0 1 18 0 1 17
1 0 1 16 0 1 15
1 0 1 19 0 1 16
1 0 1 20 0 1 18
1 0 1 21 0 1 19
1 0 1 21 0 1 20
1 0 1 24 0 1 -21
1 0 1 25 0 1 24
1 0 0 0 1 25
1 0 1 26 0 1 24
1 0 0 0 1 26
1 1 2 18 16 0 1 14
1 0 1 27 1 1 2 18 1 16 1
1 0 1 28 1 2 2 18 1 16 1
1 0 1 29 0 2 27 -28
1 0 0 0 2 14 -29
2 0 2 19 138629 20 28768
4 17 query(roll(d1,6)) 0
4 10 roll(d1,6) 1 15
4 10 roll(d1,1) 1 17
0
$ cat bug.aspif | clasp 0 --opt-mode=optN --verbose=0
query(roll(d1,6)) roll(d1,1)
Optimization: 28768
query(roll(d1,6)) roll(d1,1)
Optimization: 28768
OPTIMUM FOUND
$ cat bug.aspif | clasp --pre | clasp 0 --opt-mode=optN --verbose=0
query(roll(d1,6)) roll(d1,1)
Optimization: 0
query(roll(d1,6)) roll(d1,1)
Optimization: 0
query(roll(d1,6)) roll(d1,6)
Optimization: 0
OPTIMUM FOUND
@rkaminsk
Copy link
Member

The problem actually occurs with any kind of equivalence. Even in something simple like:

{a}.
b :- a.
#minimize{1:b}.

BenKaufmann pushed a commit that referenced this issue Apr 1, 2023
* LogicProgram::accept() incorrectly dropped all atoms that are not in
  the simplified program from minimize statements resulting in incorrect
  --pre output for minimize statements containing eq atoms.
@BenKaufmann
Copy link
Contributor

@javier-romero @rkaminsk Thanks for the report. Pushed a fix to dev.

@rkaminsk
Copy link
Member

rkaminsk commented Apr 2, 2023

Thanks, that was quick. And the patch does not look too complicated. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants