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 incremental equivalence preprocessing #33

Closed
rkaminsk opened this issue Jun 19, 2018 · 1 comment
Closed

Bug with incremental equivalence preprocessing #33

rkaminsk opened this issue Jun 19, 2018 · 1 comment

Comments

@rkaminsk
Copy link
Member

The following aspif program is not solved correctly if equivalence preprocessing is enabled:

asp 1 0 0 incremental
1 0 1 1 0 0
1 0 1 2 0 0
1 0 1 3 0 0
1 0 1 4 0 1 5
1 0 1 6 0 1 7
1 0 1 8 0 1 5
1 0 1 9 0 1 7
1 0 1 10 0 1 4
1 0 1 11 0 1 6
1 0 1 12 0 1 8
1 0 1 13 0 1 9
1 1 2 5 7 0 1 3
1 0 1 14 1 1 2 5 1 7 1
1 0 1 15 1 2 2 5 1 7 1
1 0 1 16 0 2 14 -15
1 0 0 0 2 3 -16
4 6 q(0,0) 1 4
4 6 q(0,1) 1 6
4 6 q(1,0) 1 8
4 6 q(1,1) 1 9
0
1 0 1 17 0 0
1 0 1 18 0 0
1 0 1 21 0 1 -19
1 0 1 22 0 1 -19
1 0 1 20 1 3 6 10 1 11 1 12 1 13 1 -21 1 -22 1
1 0 1 24 0 1 -19
1 0 1 25 0 1 -19
1 0 1 23 1 2 6 10 1 11 1 12 1 13 1 -24 1 -25 1
1 0 1 26 0 2 -20 23
1 0 0 0 1 26
1 0 0 0 1 -11
1 0 0 0 1 -13
1 0 0 0 1 10
1 0 0 0 1 12
0

This program was grounded using the following program:

#script (python)

import clingo

def main(control):
    # base
    control.ground([("base",[])])

    # solve
    control.solve()

    # add model and modified preference program
    model = 'h(q(0,1),1). h(q(1,1),1).'

    control.add("m1", [], model)
    control.ground([("m1",[])])
    control.ground([("preference", [])])

    # solve
    control.solve()

#end.

#program base.

#show q/2.
%#show h/2.

c(0..1).

1 { p(0..1) } 1.

q(C,P) :- p(P), c(C).

h(q(C,P),0) :- q(C,P).

#program preference.

:- h(X,0), not h(X,1).
:- not h(X,0), h(X,1).

:- #sum { -1,X : h(X,0); 1,X : h(X,1)} = 0.

Adding the preference program should make any program unsatisfiable. Compare

clasp bug.sm --eq=1
clasp version 3.3.3
Reading from bug.sm
Solving...
Answer: 1
q(0,1) q(1,1)
Solving...
Answer: 1
q(0,1) q(1,1)
SATISFIABLE

with

clasp bug.sm --eq=0
clasp version 3.3.3
Reading from bug.sm
Solving...
Answer: 1
q(0,1) q(1,1)
Solving...
UNSATISFIABLE
@BenKaufmann
Copy link
Contributor

Interesting. Seems to be a regression introduced in version 3.2.0.
I'll try to look into it on the weekend.

BenKaufmann added a commit that referenced this issue Jun 23, 2018
Simplification of sums correctly replaced eq atoms with their roots
but then searched for the original atoms when merging duplicates.
E.g. given 2 {x1, x2, x3} with x1 == x3, simplifySum() first replaced
'x3' with 'x1' but then unsuccessfully searched for 'x3' when trying
to merge the equivalent atoms into 'x1=2'.
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

2 participants