Satisfiability Modulo Linear Arithmetic Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodr´ ıguez-Carbonell May 31, 2019
Linear Arithmetic Theories In linear arithmetic theories, atoms are of the form: ■ a 1 x 1 + . . . + a n x n ⊲ ⊳ b ⊳ is one of: = , � = , <, >, ≤ , ≥ where ⊲ All symbols are interpreted with their usual meaning in arithmetic Example of atom: ■ x + y + 2 z ≥ 10 Example of formula: ■ x ≥ 0 ∧ ( x + y ≤ 2 ∨ x − y ≥ 6) ∧ ( x + y ≥ 1 ∨ x − y ≥ 4) Variables can be of real sort ( R ) or integer sort ( Z ) ■ If all vars are R we have a problem of Linear Real Arithmetic (LRA) ■ If all vars are Z we have a problem of Linear Integer Arithmetic (LIA) ■ 2 / 29
Overview of the Lecture De Moura & Dutertre’s Algorithm for LRA ■ LIA ■ 3 / 29
De Moura & Dutertre’s Algorithm Problem: given an input formula φ of LRA, is φ SAT? ■ Assume for the time being φ only contains ■ linear constraints of the form c T x ≤ d 4 / 29
De Moura & Dutertre’s Algorithm Problem: given an input formula φ of LRA, is φ SAT? ■ Assume for the time being φ only contains ■ linear constraints of the form c T x ≤ d Preprocessing: transform φ into ˆ φ ∧ Ax = 0 , where: ■ ˆ 1. φ is obtained from φ by replacing each c T x ≤ d by s ≤ d , where s is fresh variable Ax = 0 consists of all definitions s = c T x 2. 4 / 29
De Moura & Dutertre’s Algorithm Problem: given an input formula φ of LRA, is φ SAT? ■ Assume for the time being φ only contains ■ linear constraints of the form c T x ≤ d Preprocessing: transform φ into ˆ φ ∧ Ax = 0 , where: ■ ˆ 1. φ is obtained from φ by replacing each c T x ≤ d by s ≤ d , where s is fresh variable Ax = 0 consists of all definitions s = c T x 2. Example: ■ x ≥ 0 ∧ ( x + y ≤ 2 ∨ x − y ≥ 6) ∧ ( x + y ≥ 1 ∨ x − y ≥ 4) x ≥ 0 ∧ ( s 1 ≤ 2 ∨ s 2 ≥ 6) ∧ ( s 1 ≥ 1 ∨ s 2 ≥ 4) ∧ ( s 1 = x + y ∧ s 2 = x − y ) 4 / 29
De Moura & Dutertre’s Algorithm Consistency checking is based on dual bounded simplex ■ Theory solver handles feasibility problems of the form ■ Ax = 0 ∧ ℓ ≤ x ≤ u Only bounds asserted during search: ■ Ax = 0 is asserted before any decision There is no addition/deletion of rows! 5 / 29
De Moura & Dutertre’s Algorithm Consistency checking is based on dual bounded simplex ■ Theory solver handles feasibility problems of the form ■ Ax = 0 ∧ ℓ ≤ x ≤ u Only bounds asserted during search: ■ Ax = 0 is asserted before any decision There is no addition/deletion of rows! Free variables (those without any bound in the formula) can be eliminated ■ before starting search by means of Gaussian elimination E.g.: if y is free then equation y = x − s 2 is not asserted ■ x ≥ 0 ∧ ( s 1 ≤ 2 ∨ s 2 ≥ 6) ∧ ( s 1 ≥ 1 ∨ s 2 ≥ 4) ∧ ( s 1 = 2 x − s 2 ∧ y = x − s 2 ) 5 / 29
Basic Solver For solving Ax = 0 ∧ ℓ ≤ x ≤ u , theory solver stores: ■ A tableau: x i = � x i ∈ B x j ∈R α ij x j , ◆ For each variable x i , ◆ the strongest asserted lower bound ℓ i the strongest asserted upper bound u i An assignment β such that ◆ Aβ = 0 ■ For each x j ∈ R : ℓ j ≤ β ( x j ) ≤ u j ■ 6 / 29
Basic Solver For solving Ax = 0 ∧ ℓ ≤ x ≤ u , theory solver stores: ■ A tableau: x i = � x i ∈ B x j ∈R α ij x j , ◆ For each variable x i , ◆ the strongest asserted lower bound ℓ i the strongest asserted upper bound u i An assignment β such that ◆ Aβ = 0 ■ For each x j ∈ R : ℓ j ≤ β ( x j ) ≤ u j ■ Maybe for some x i ∈ B , ℓ i > β ( x i ) or β ( x i ) > u j ■ Maybe for some x i ∈ R , ℓ i < β ( x i ) < u j ■ Supports two types of consistency checks: ■ light-weight and heavy-weight 6 / 29
Light-Weight Consistency Check Ensures non basic vars satisfy bounds and Aβ = 0 ■ If returns SAT : Then model is consistent ◆ If returns UNSAT: Then model is inconsistent ◆ If returns UNKNOWN: Don’t know ◆ assert lower( x j ≥ c j ) if c j ≤ ℓ j then return SAT then return UNSAT if c j > u j ℓ j := c j ; if x j ∈ R ∧ β ( x j ) < ℓ j then update( x j , ℓ j ) return UNKNOWN update( x j , v ) for each x i ∈ B , β ( x i ) := β ( x i ) + α ij ( v − β ( x j )) β ( x j ) := v 7 / 29
Light-Weight Consistency Check Ensures non basic vars satisfy bounds and Aβ = 0 ■ If returns SAT : Then model is consistent ◆ If returns UNSAT: Then model is inconsistent ◆ If returns UNKNOWN: Don’t know ◆ assert upper( x j ≤ c j ) if c j ≥ u j then return SAT then return UNSAT if c j < ℓ j u j := c j ; if x j ∈ R ∧ β ( x j ) > u j then update( x j , u j ) return UNKNOWN update( x j , v ) for each x i ∈ B , β ( x i ) := β ( x i ) + α ij ( v − β ( x j )) β ( x j ) := v 7 / 29
Heavy-Weight Consistency Check Light-weight consistency check is performed first (since it is cheaper) ■ The only possible cases of unfeasibility that are left: bounds of basic vars ■ Dual Bounded Simplex (with null objective function) ■ is employed to get feasible basis Constraints are handled in blocks (as opposed to one at a time) ■ 8 / 29
Heavy-Weight Consistency Check check() loop select basic variable x i such that β i < ℓ i or β i > u i if there is no such x i then return SAT if β i < ℓ i then select non-basic variable x j such that ( α ij > 0 ∧ β ( x j ) < u j ) ∨ ( α ij < 0 ∧ β ( x j ) > ℓ j ) if there is no such x j then return UNSAT pivot and update( x i , x j , ℓ i ) if β i > u i then select non-basic variable x j such that ( α ij < 0 ∧ β ( x j ) < u j ) ∨ ( α ij > 0 ∧ β ( x j ) > ℓ j ) if there is no such x j then return UNSAT pivot and update( x i , x j , u i ) /* pivot and update( x i , x j , v ): set basic x i to v , adjust non-basic x j and other basic vars as needed, swap x i and x j in the basis */ 9 / 29
Heavy-Weight Consistency Check pivot and update( x i , x j , v ) /* set basic x i to v , adjust non-basic x j and other basic vars as needed, swap x i and x j in the basis */ Θ := v − β ( x i ) α ij β ( x i ) := v β ( x j ) := β ( x j ) + Θ for each x k ∈ B ∧ x k � = x i , β ( x k ) := β ( x k ) + α kj Θ pivot( x i , x j ) Recall Bland’s anticycling rule in dual pricing and dual ratio test: ■ Set an order between variables ◆ Always take the least possible variable ◆ THEOREM. This strategy guarantees termination ■ 10 / 29
Conflict Explanations check() detects an inconsistency when: ■ If β i < ℓ i and for all non-basic x j ◆ ( α ij > 0 → β ( x j ) ≥ u j ) ∧ ( α ij < 0 → β ( x j ) ≤ ℓ j ) If β i > u i and for all non-basic x j ◆ ( α ij < 0 → β ( x j ) ≥ u j ) ∧ ( α ij > 0 → β ( x j ) ≤ ℓ j ) Let R + = { x j ∈ R | α ij > 0 } and R − = { x j ∈ R | α ij < 0 } ■ Since β satisfies all bounds on non-basic vars: ■ If β ( x i ) < ℓ i ◆ for all x j ∈ R + , β ( x j ) = u j ■ for all x j ∈ R − , β ( x j ) = ℓ j ■ If β ( x i ) > u i ◆ for all x j ∈ R + , β ( x j ) = ℓ j ■ for all x j ∈ R − , β ( x j ) = u j ■ 11 / 29
Conflict Explanations Assume β ( x i ) < ℓ i . ■ So for all x j ∈ R + , β ( x j ) = u j and for all x j ∈ R − , β ( x j ) = ℓ j ■ Hence β ( x i ) = � x j ∈R + α ij u j + � x j ∈R − α ij ℓ j ■ So for any x such that Ax = b ■ β ( x i ) − x i = � x j ∈R + α ij ( u j − x j ) + � x j ∈R − α ij ( ℓ j − x j ) From this we can derive the implication ■ � x j ∈R + x j ≤ u j ∧ � x j ∈R − x j ≥ ℓ j ⇒ x i ≤ β ( x i ) Since β ( x i ) < ℓ i this is inconsistent with x i ≥ ℓ i ■ The explanation of the conflict is ■ { x j ≤ u j | x j ∈ R + } ∪ { x j ≥ ℓ j | x j ∈ R − } ∪ { x i ≥ ℓ i } which is minimal (with respect to set inclusion) 12 / 29
Conflict Explanations Assume β ( x i ) > u i . ■ So for all x j ∈ R + , β ( x j ) = ℓ j and for all x j ∈ R − , β ( x j ) = u j ■ Hence β ( x i ) = � x j ∈R + α ij ℓ j + � x j ∈R − α ij u j ■ So for any x such that Ax = b ■ β ( x i ) − x i = � x j ∈R + α ij ( ℓ j − x j ) + � x j ∈R − α ij ( u j − x j ) From this we can derive the implication ■ � x j ∈R + x j ≥ ℓ j ∧ � x j ∈R − x j ≤ u j ⇒ x i ≥ β ( x i ) Since β ( x i ) > u i this is inconsistent with x i ≤ u i ■ The explanation of the conflict is ■ { x j ≥ ℓ j | x j ∈ R + } ∪ { x j ≤ u j | x j ∈ R − } ∪ { x i ≤ u i } which is minimal (with respect to set inclusion) 13 / 29
Backtracking Number of backtrackings is often very large: ■ needs to be efficiently implemented The algorithm only requires, for each variable x i , ■ one stack for lower bounds ℓ i ◆ one stack for upper bounds u i ◆ No need to save successive β on a stack! ■ Only one assignment β is kept Recall: for each x j ∈ R , then ℓ j ≤ β ( x j ) ≤ u j ■ Maybe for some x i ∈ R , ℓ i < β ( x i ) < u j Does not require pivoting: very cheap ■ 14 / 29
Recommend
More recommend