Tutorial: CP by Systematic Search Over Real-Number and Floating-Point Domains Michel RUEHER University Nice Sophia-Antipolis I3S – CNRS, France CP meets CAV 25 June – 29 June 2012 Turunç, Turkey
Outline Continuous CSP M. Rueher Numeric CSP Numeric CSP Interval Arithmetic Interval Arithmetic Local consistencies Global constraints Local consistencies Constraints over the floats Search Global constraints Conclusion Systems Constraints over the floats Search Conclusion 2
Constraint Programming Continuous CSP M. Rueher Numeric CSP Numeric CSP ( X , D , C ) : Overall scheme Interval Arithmetic ◮ X = { x 1 , . . . , x n } is a set of variables Local consistencies Global constraints ◮ D = { D x 1 , . . . , D x n } is a set of domains Constraints over ( D x i contains all acceptable values for variable x i ) the floats Search Conclusion ◮ C = { c 1 , . . . , c m } is a set of constraints Systems 3
Overall scheme Continuous CSP M. Rueher The constraint programming framework is based on a Numeric CSP branch & prune schema which is best viewed as an Overall scheme Interval iteration of two steps: Arithmetic Local 1. Pruning the search space consistencies 2. Making a choice to generate two (or more) Global constraints sub-problems Constraints over the floats ◮ The pruning step → reduces an interval when it can Search Conclusion proved that the upper bound or the lower bound does Systems not satisfy some constraint ◮ The branching step → splits the interval associated to some variable in two intervals (often with the same width) 4
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 5
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 6
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 7
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 8
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 9
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 10
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 11
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 12
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 13
Filtering & Solving process (example) Continuous CSP M. Rueher Courtesy to Gilles Trombettoni Numeric CSP Overall scheme Interval Arithmetic Local consistencies Global constraints Constraints over the floats Search Conclusion Systems 14
Why do we need intervals? Continuous CSP M. Rueher Numeric CSP ◮ Modelling uncertainty Interval Arithmetic ◮ Error in Measurement or uncertainty in measurements Basics on Intervals ◮ Uncertainty when estimating unknown values Local consistencies Global constraints ◮ Safe Computations with floating-point numbers Constraints over ◮ Rounding errors the floats ◮ Cancellation, ... Search Conclusion Systems What Every Computer Scientist Should Know About Floating-Point Arithmetic, Goldberg, 1991 15
Problem with floating-point computations Continuous CSP M. Rueher Examples Numeric CSP (in simple precision) Interval ◮ Absorption: 10 7 + 0 . 5 = 10 7 Arithmetic Basics on Intervals ◮ Cancellation: Local (( 1 − 10 − 7 ) − 1 ) ∗ 10 7 = − 1 . 192 ... ( � = − 1 ) consistencies ◮ Operations are not associative: Global (10000001 − 10 7 ) + 0 . 5 � = 10000001 − ( 10 7 + 0 . 5 ) constraints ◮ No exact representation: Constraints over the floats 0 . 1 = 0 . 000110011001100 . . . Search Rump polynomial Conclusion ◮ RumpFunc[x_,y_]:= ( 1335 / 4 − x 2 ) y 6 + x 2 ( 11 x 2 y 2 − Systems 121 y 4 − 2 ) + ( 11 / 2 ) y 8 + x / ( 2 y ) ◮ Value computed with rational numbers: RumpFunc[77617, 33096] = − 54767 66192 = − 0 . 827396 ◮ Value with floating point numbers: 0 ◮ Value with floating point numbers when 11 / 2 is replaced by 5 . 5 in the polynomial: 1 . 18059 × 10 21 16
What is an interval? Continuous CSP M. Rueher Numeric CSP An interval [ a , b ] describes a set of real Interval numbers x such that: a ≤ x ≤ b Arithmetic Basics on Intervals Local Assumption : consistencies Global a and b belong to finite set of numbers representable on a constraints computer: floating-point numbers , subset of integers, Constraints over the floats rational numbers, ... Search A Box denotes a Cartesian product of intervals Conclusion Systems → a box is a vector of intervals that defines the search space of problem, i.e., the space in which are the values of the variables 17
Interval arithmetic Continuous CSP M. Rueher Numeric CSP Interval Interval arithmetic (Moore-1966) Arithmetic Basics on Intervals is based on the representation of variables as intervals Local consistencies Let f be a real-valued function of n unknowns { x 1 , . . . , x n } , Global constraints an interval evaluation F of f for given ranges Constraints over X = { X 1 , . . . , X n } for the unknowns is an interval Y such the floats that Search Conclusion ∀{ v 1 , . . . , v n } ∈ { X 1 , . . . , X n } : Y ≤ f ( v 1 , . . . , v n ) ≤ Y Systems Y , Y : lower and upper bounds for the values of f when the values of the unknowns are restricted to the box X 18
Interval extension Continuous CSP M. Rueher Numeric CSP ◮ In general, it is not possible to compute the exact Interval Arithmetic enclosure of the range for an arbitrary function over Basics on Intervals Local the real numbers consistencies Global constraints → The interval extension of a function is an interval Constraints over the floats function that computes an outer approximation of the Search range of the function over a domain Conclusion Systems 19
Natural interval extension Continuous CSP M. Rueher Numeric CSP F the natural interval extension of a real function f is Interval Arithmetic obtained by replacing: Basics on Intervals Local consistencies ◮ Each constant k by its natural interval extension ˜ k Global constraints Constraints over ◮ Each variable by a variable over the intervals the floats Search ◮ Each mathematical operator in f by its optimal interval Conclusion Systems extension 20
Optimal extensions for basic operators: Continuous CSP M. Rueher Numeric CSP Interval • [ a , b ] ⊖ [ c , d ] = [ a − d , b − c ] Arithmetic Basics on Intervals Local consistencies • [ a , b ] ⊕ [ c , d ] = [ a + c , b + d ] Global constraints • [ a , b ] ⊗ [ c , d ] = Constraints over the floats [ min ( ac , ad , bc , bd ) , max ( ac , ad , bc , bd )] Search Conclusion • [ a , b ] ⊘ [ c , d ] = [ min ( a c , a d , b c , b d ) , max ( a c , a d , b c , b d )] Systems if 0 �∈ [ c , d ] otherwise → [ −∞ , + ∞ ] 21
Natural interval extension: Example Continuous CSP M. Rueher Numeric CSP Let f = ( x + y ) − ( y × x ) be a real function Interval Arithmetic Basics on Intervals Let be X = [ − 2 , 3 ] , Y = [ − 9 , 1 ] Local consistencies F = ( X ⊕ Y ) ⊖ ( Y ⊗ X ) Global constraints = ([ − 2 , 3 ] ⊕ [ − 9 , 1 ]) ⊖ ([ − 9 , 1 ] ⊗ [ − 2 , 3 ]) Constraints over = [ − 11 , 4 ] ⊖ the floats [ min ( 18 , − 27 , − 2 , 3 ) , max ( 18 , − 27 , − 2 , 3 )] Search Conclusion = [ − 11 , 4 ] ⊖ [ − 27 , 18 ] Systems = [ − 29 , 31 ] 22
Recommend
More recommend