Download presentation
Presentation is loading. Please wait.
Published byQuinn Wadlow Modified over 9 years ago
1
Normal Programs with Cardinality Constraints C = L {a 1,..., a n, not b 1,..., not b m } U L lower bound, U upper bound (missing L: 0, missing U: n+m) Lit(C) = {a 1,..., a n, not b 1,..., not b m } intuition: at least L, at most U literals must be true rules built from constraints: C 0 <- C 1,..., C n example: 2{a1, a2, a3}2 <- 1{not b1, not b2}, 2{c1, c2, c3, c4}3 at least one b not in model and 2 or 3 c‘s in => 2 a‘s in. normal programs: all constraints of the form 1{a}1 oder 1{not a}1
2
Satisfaction of constraints in set of literals S S |= a iff a S, S|= not a iff a S. S |= C iff L W(C,S) U, where W(C,S) = | {l Lit(C) : S |= l}| rule C 0 <- C 1,..., C n satisfied in S iff some body constraint not satisfied or C 0 satisfied (integrity constraints: first option only) Example: 1{a,b}1 <- 1 {a, not b, not c} 2 S = {a,b}. body satisfied, head not => rule not satisfied S = {a, c}. body and head constraint and thus rule satisfied
3
Stable models Standard approach: guess S, evaluate „not“ wrt S => reduced program, check whether S minimal model of reduced program Here: reduction to Horn constraint rules: no „not“, no upper bounds, single head atom => Cn(P) smallest set closed under rules Example: a <- 1 {a} b <- c <- 2 {b,d}, 1 {b,a} d <- 1 {a,b,c} Cn(P) = {b}Cn(P) = {b, d, c}
4
Constraint reduction C = L {a1,..., an, not b1,..., not bm} U C S = L´{a1, …, an} where L´ = L - |{not b Lit(C) : S |= not b}| Example: S = {q}, C = 3 {not q, not r, p} 4, reduct: 2 {p} P program, S set of atoms. Reduct P S : {p <- C 1 S,..., C n S : C 0 <- C 1,..., C n P, p Lit(C 0 ) S, for all C i = L i {a1,…}U i, i {1, …, n}, W(C i,S) U i } Def.: S stable model of P iff 1. S satisfies all rules in P 2. S = Cn(P S )
5
Examples 1 {a1, a2, a3} 1 <- stable models: {a1}, {a2}, {a3} 1 {a1, a2, a3} 1 <- 1 {a1,b} 2 single stable model: empty set {a1, a2, a3} <- stable models: alle subsets of the three a‘s rules of this form are also called choice rules
6
Weight Constraints C = L {a 1 = w a1,..., a n = w an, not b 1 = w b1, …, not b m = w bm } U arbitrary weights (card. constraints weight 1 for all literals) implemented in Smodels: integers weight of l in C: w(C)(l) necessary changes: W(C,S) = l Lit(C),S |= l w(C)(l) and in definition of constraint reduct: L’ = L - not p Lit(C) and S |= not p w(C)(l)
7
Smodels optimization constructs minimize{a 1 = w a1,..., a n = w an, not b 1 = w b1, …, not b m = w bm } stable model computed by Smodels minimizes l in L and S |= l w(C)(l) (L = {a1,..., an, not b1,..., not bm}) maximize analogously multiple optimization statements: optimize first one, among optimal models optimize second one etc.
8
Smodels optimization example {a1, a2, a3} <- minimize {a1 = 1} minimize {a2 = 1} minimize {a3 = 1} 1.{ } 2.{a3} 3.{a2 } 4.{a2a3} 5.{a1 } 6.{a1a3} 7.{a1a2 } 8.{a1a2a3}
9
Notation 1{teaches(L,C) : lecturer(L)}1 <- course(C) to obtain ground instantiation: instatiate C, replace each instatiation of the form 1{teaches(L,c1) : lecturer(L)}1 <- course(c1) with 1{teaches(l1,c1),..., teaches(ln,c1)}1 <- course(c1) where l1,..., ln are the known lecturers
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.