Outline Interval CLP • ✔ ✔ [Benhamou et al] humbly presented by Johan Lübcke and Dan Lawesson Preliminaries • Narrowing ✔ ✔ • F-intervals F = E ∪ {−∞, ∞}, E ⊂ <, E F-interval : (a, b), {a, b} ⊆ F F nite Choice points Implementation ✔ ✔ ✔ Typeset by FoilTEX Algorithm Example Convexity ✔ • F-intervals Approximation Newton Box consistency Splitting 1 Approximations If ρ is a subset of <n then apx(ρ) is the smallest F-interval containing ρ. is the set of all F-intervals apx(X 2 + Y 2 ≤ 1) = ([−1, 1], [−1, 1]) 2 3 Constraint systems Narrowing − u, the narrowing function → ρ : Fn → For every F-block − ρ (u) = apx(u ∩ ρ) F n of ρ satises → V is a set of variables • A constraint is an expression ρ(x1, . . . , xn), where ρ ⊆ <n and every xi ∈ V ∪ E • A system Σ = (i, S), where i : V ∪ E → F and S is a nite set of constraints • A solution σ : V ∪ E → < of a system Σ satises (i) (ii) (iii) (iv) → (i)-(iv) : u, ρ, u ∩ ρ, − ρ Contractance Correctness − → ρ (u) ⊆ u → u∩ρ=− ρ (u) ∩ ρ Monotonicity → → u⊆v⇒− ρ (u) ⊆ − ρ (v) Idempotence − → → → ρ (− ρ (u)) = − ρ (u) 5 Introduce c2 = {(X, Y ) ∈ <2 | X 2 + Y 2 ≤ 1} c1 = {(X, Y ) ∈ <2 | Y ≥ X} 6 c0 = {X ∈ < | X ≥ 0} Narrowing example Terminating! − As dened earlier : → ρ (u) = apx(u ∩ ρ) Intuition: Calculate narrowing x point. Whenever an interval (denoted X ) becomes narrower, re-evaluate all constraints containing X . Σ = (i, S) = ({X 7→ [0, ∞], Y 7→ [0, ∞]}, {c0(X), c1(X, Y )}) Narrowing algorithm 7 4 The resulting stable system is Σ = ({X 7→ [0, 1], Y 7→ [0, 1]}, {c0, c1, c2}) ∀x ∈ E, σ(x) = x ∀x ∈ V, σ(x) ∈ i(x) ∀ρ(x1, . . . , xn) ∈ S, (σ(x1), . . . , σ(xn)) ∈ ρ Interval convexity Choice points A constraint ρ is interval convex if for every F-block u and every i ∈ {1, . . . , n}, πi(ρ ∩ u) is an F-interval. add = {(x, y, z) ∈ <3 | x + y = z} Assume ρ = ρ1 ∪ ρ2, i.e. c = c1 ∨ c2 → − 1. → ρ (u) = apx(u ∩ ρ2), ρ (u) = apx(u ∩ ρ1) ∨ − disjunction implemented by choice point. → 2. − ρ (u) = apx(u∩(ρ1 ∪ρ2)), splitting after propagation (similar to labeling) creates choice point. is interval convex, but mult = {(x, y, z) ∈ <3 | xy = z} Example: mult = mult+ ∪ mult−, where is not. mult+ = {(x, y, z) ∈ <3 | x ≥ 0, xy = z} Example: Assume u = ([−2, 3], [−4, 5], [1, 1]), then mult ∩ u = ([−2, 3], [−3, − 12 ] ∪ [ 13 , 5], [1, 1]) and apx(mult ∩ u) = u. and mult− = {(x, y, z) ∈ <3 | x < 0, xy = z} Both are interval convex. ([−0.3, 2.4], [1.5, 2.5]) ([0, 2], [2, 2]) ([0, 2), [2, 2]) ∪ ∅ ([0, 1], [2, 2]) 9 Newton Extending Prolog, Newton combines constraints over reals, integers and booleans. Newton uses a relaxed implementation of narrowing called box consistency. 10 = = = = u −→ int(u) → − →− neq( int(u)) −→ −→ −→ int(neq(int(u))) Example: (using int for two variables) is a special case of integers Booleans neq = {(x, y) ∈ <2 | x < y} ∪ {(x, y) ∈ <2 | x > y} → If u = [a, b] then − int(u) = [dae , bbc], Integers Restricted intervals 8 11 A constraint c is arc-consistent wrt (D1, . . . , Dn) and an integer i, 1 ≤ i ≤ n i Di ⊆ {ri | ∃r1 ∈ D1, . . . , ri−1 ∈ Di−1, ri+1 ∈ Dr+1, . . . , rn ∈ Dn : c(r)} 12 Another example would be f 0(X, Y ) = [−∞, ∞]... Example: f 0([x1, x2], [y1, y2]) = [bx1 + y1c , dx2 + y2e] is an interval extension of f (x, y) = x + y. ∀F1, . . . , Fn ∈ F : x1 ∈ F1, . . . , xn ∈ Fn ⇒ f (x1, . . . , xn) ∈ f 0(F1, . . . , Fn) is an interval extension of f : <n → < i f0 : Fn → F Interval extension Arc consistency revisited Arc consistency for systems is dened in the natural way. Generalized to intervals, a constraint ρ is arc consistent wrt (F1, . . . , Fn) and an integer i , 1 ≤ i ≤ n i Fi = apx(Fi ∩ {ri | ∃r1 ∈ F1, . . . , ri−1 ∈ Fi−1, ri+1 ∈ Fr+1, . . . , rn ∈ Fn : r ∈ ρ}) This is the x point criteria for narrowing, i.e. → u=− ρ (u) = apx(u ∩ ρ) 13 Box consistency Box consistency is a relaxed version of arc consistency that is less expensive to calculate. An interval constraint ρ0 = C(F1, . . . , Fn) is box consistent wrt (F1, . . . , Fn) and an integer i i Box consistency example x1 − x1 + x2 = 0 is not arc consistent wrt ([−1, 1], [0, 2]) because assigning x2 6= 0 makes the constraint unsatisable. I.e. the intervals should be narrowed to ([−1, 1], [0, 0]). X1 − X1 + X2 = 0 is box consistent wrt ([−1, 1], [0, 2]), C(F1, . . . , Fi−1, [l, l+], Fi+1, . . . , Fn) ∧ because . [−1, −1] − [−1, −1] + [0, 2] = [0, 0] C(F1, . . . , Fi−1, [u−, u], Fi+1, . . . , Fn) where l = lef t(Fi) and u = right(Fi). This is equivalent to Fi = apx({ri ∈ Fi | C(F1, . . . , Fi−1, apx({ri}), Fi+1, . . . , Fn)}) . [1, 1] − [1, 1] + [0, 2] = [0, 0] . [−1, 1] − [−1, 1] + [0, 0] = [0, 0] Box consistency diers from arc consistency when ρ0 contains multiple instances of the same variable. . [−1, 1] − [−1, 1] + [2, 2] = [0, 0] 14 15 Implementation The choice of interval extension determines the eciency of the propagation. Natural Interval Extension Expensive to calculate, the natural extension provides maximum propagation. I.e. the natural interval extension of x1(x2 + x3) is X1(X2 + X3). 16 is silently ignored in this Distributed Interval Extension Rewriting the constraint as a sum of terms allows for more ecient calculation of box consistency, but weaker pruning. The distributed interval extension of x1(x2 + x3) is X1X2 + X1X3. presentation. Result: ∃b ∈ Benchmarks(∃S ∈ OtherSolvers(betterb(N ewton, S))) 18 Taylor Interval Extension Summary Interval constraints allows for a coherent handling of multiple simultaneous variable domain types. Splitting Sometimes propagation just ain't enough... Splitting corresponds to labeling with domain splitting. To achieve smaller boxes, the box given after propagation can be divided into subranges. The solver is restarted for each sub range, giving smaller new propagation opportunities. 17