lparse programs revisited: semantics and representation of aggregates guohua liu and jia-huai you...
TRANSCRIPT
![Page 1: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/1.jpg)
Lparse Programs Revisited: Semantics and Representation of
Aggregates
Guohua Liu and Jia-Huai You
University of Alberta
Canada
![Page 2: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/2.jpg)
Outline Stable models of weight-constraint programs - closely related to answer sets of Son-
Pontelli-Tu for LPs with constraint atoms - what about other lparse-stable models?
Some of them may be “circular” - a translation to avoid circularity
Can we represent commonly used aggregates by weight constraints?
![Page 3: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/3.jpg)
Lparse programs
Weight constraint W :
Weight constraint rule:
where each is a weight constraint.
uwbwbwawalmn
bmbana ]not ,...,not ,,...,[ 11 11
nWWW ,...,10
iW
![Page 4: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/4.jpg)
Semantics
The reduct of a weight constraint W w.r.t. M is the constraint
where
MW
Mb
b
i
iwll '
],...,[ '11 nana wawal
![Page 5: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/5.jpg)
Semantics
The reduct of a weight constraint W w.r.t. M is the constraint
where The reduct is:
MW
Mb
b
i
iwll '
],...,[ '11 nana wawal
MP
}1 ,),(,)(
,,...,|,...,{
0
101
iallforuMWwMWlitp
PWWWWWpP
i
nM
nMM
![Page 6: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/6.jpg)
Lparse-stable models may be “circular”
Consider the one-rule program:
a [not a = 1] 0
Both M1 = {} and M2= {a} are lparse-stable models.
In M2, we need assume a in order to derive a. The weight constraint in the body is actually
monotone.
![Page 7: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/7.jpg)
Equivalent Expressions
This weight constraint is equivalent to each of the following (satisfaction-preserving):
a count({x | x D}) = 1 where D = {a}
a ({a}, {{a}}) (body is an abstract constraint atom)
![Page 8: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/8.jpg)
Is non-minimal the culprit ?
Not always. Consider program P a [not a = 1] 0 f not f, not a
{a} is now minimal, but still circular.
![Page 9: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/9.jpg)
Strongly satisfiable weight constraints
Notation: W is a weight constraint; M is a set of atoms
A weight constraint W is strongly satisfiable by M iff
M |= W implies, for any ,
W is strongly satisfiable by any M if -lit(W) contains no negative literal - upper-bound free
)}( |{)( WlitbnotMbWM iib
uVMWw )\,()(WMV b
![Page 10: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/10.jpg)
Theorem
Let P be an lparse program and M a set of atoms. Suppose all the weight constraints appearing in the body of any rule in P are strongly satisfiable by M.
Then, M is an lparse-stable model of P iff M is an answer set (in the sense of Son et al.) for P.
![Page 11: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/11.jpg)
Weak notion of non-circularity(unfoundedness)
Definition (essentially that of Calimeri et al. IJCAI-05)
An lparse-stable model M of a program P is circular if
there is a non-empty set s.t. , M \U does
not satisfy the body of any rule r in P, where
U)(rhead
MU
![Page 12: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/12.jpg)
Weak notion of non-circularity(unfoundedness)
Definition (essentially that of Calimeri et al. IJCAI-05) An lparse-stable model M of a program P is circular if there is a non-empty set s.t. , M \U does not satisfy the body of any rule r in P, where
Example a b 2 [a=1, not b =1] b [a=1, not b = 1] 1{a,b} is an lparse-stable model, but not an answer set,
and it is not circular by the above definition.
U)(rhead
MU
![Page 13: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/13.jpg)
Transformation to strongly satisfiable programs
Let l {W }u denote a weight constraint. Transform it to the conjunction of
1. l {W }2. l’ {W}where
Example: [not a =1]0 transformed to [not a =1] and 1 [not a =1]
m
ib
n
ia ii
wwul11
'
![Page 14: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/14.jpg)
Representation of Aggregates
xpxaggr Result op )})(|({
},,,,,{
Take the form
where aggr is from {Sum,Count,Avg,Min,Max} op is from Result is a numeric constant
![Page 15: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/15.jpg)
Linear size encoding sum and account: straightforward Encode by
max and min: more complex, but can be done
What cannot be encoded? Aggregate expressions involving Product constraint:
])(,...,)([ 0 11 kaapkaap nn
kxpxavg )})(|({
kxpxTimes )})(|({
![Page 16: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/16.jpg)
Experiments
Programs Argument Size Smodels Smodels-A Company Contr 20 0.03 0.09 Company Contr 40 0.18 0.36 Company Contr 80 0.87 2.88 Company Contr 120 2.40 12.14 Employee Raise 15/5 0.01 0.69 Employee Raise 21/15 0.05 4.65 Employee Raise 24/20 0.05 5.55 Party Invit. 80 0.02 0.05 Party Invit. 160 0.07 0.10 NM1 125 0.61 0.21 NM1 150 0.75 0.29 NM2 125 0.65 2.24 NM2 150 1.08 3.36
![Page 17: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/17.jpg)
Experiments (2) Execution Time Instance Size
C T Smodels DLV-A Smodels DLV-A
4 3 0.1 0.01 293 248 4 4 0.2 0.01 544 490 5 5 0.58 0.02 1213 1346 5 10 0.35 0.31 6500 7559 5 15 1.24 1.88 18549 22049 5 20 3.35 7.08 40080 47946 5 25 8.19 64.29 73765 88781 5 30 16.42 152.45 12230 14767
![Page 18: Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada](https://reader036.vdocuments.us/reader036/viewer/2022082611/56649eef5503460f94bff3f6/html5/thumbnails/18.jpg)
Conclusion Lparse semantics is closely related to answer sets
by Son et al. The gap can be closed by a simple transformation.
Lparse programs are already an effective representation language for aggregates. It only needs a simple frond end.
More efficient implementation of weight constraints
is needed.