SlideShare a Scribd company logo
Satisfiability Modulo Theories
Lecture 6 - A Theory Solver for LRA
(slides revision: Saturday 14th
March, 2015, 11:47)
Roberto Bruttomesso
Seminario di Logica Matematica
(Corso Prof. Silvio Ghilardi)
24 Novembre 2011
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 1 / 21
Outline
1 Basic Solving
Introduction
Preprocessing
Solving
2 Improvement for T -solver
T -solver features
Strict inequalities
Integers
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 2 / 21
Simplex Algorithm
Invented by Tobias Dantzig around 1950
Used to solve optimization problems in linear programming
Greg Nelson was the first to employ it for constraint solving, AFAIK,
around 1980
Difference is that in linear programming input problem is feasible and
one looks for optimum. In constraint solving problem can be infeasible,
and we are interested in finding any solution
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 3 / 21
Introduction
Linear Rational Arithmetic LRA consists in solving Boolean
combinations of atoms of the form
n
j=1
ajxj ≤ b
n
j=1
ajxj ≥ b
where aj are constants (coefficients), xj are variables, and b is a
constant (bound). The domain of aj, xj, b is that of rationals.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 4 / 21
Introduction
Linear Rational Arithmetic LRA consists in solving Boolean
combinations of atoms of the form
n
j=1
ajxj ≤ b
n
j=1
ajxj ≥ b
where aj are constants (coefficients), xj are variables, and b is a
constant (bound). The domain of aj, xj, b is that of rationals.
Notice that the following translations hold
n
j=1 ajxj = b =⇒ ( n
j=1 ajxj ≤ b) ∧ ( n
j=1 ajxj ≥ b)
n
j=1 ajxj < b =⇒ see later
n
j=1 ajxj > b =⇒ see later
n
j=1 ajxj = b =⇒ ( n
j=1 ajxj < b) ∨ ( n
j=1 ajxj > b)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 4 / 21
Preprocessing
In the SMT setting, we are given a formula ϕ like
(x ≥ 0) ∧ ((x + y ≤ 2) ∨ (x + 2y − z ≥ 6)) ∧ ((x + y ≥ 2) ∨ (2y − z ≤ 4))
We perform a preprocessing step, in order to separate the formula
into a set of equations and a set of simple bounds. This is done by
introducing fresh variables.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 5 / 21
Preprocessing
In the SMT setting, we are given a formula ϕ like
(x ≥ 0) ∧ ((x + y ≤ 2) ∨ (x + 2y − z ≥ 6)) ∧ ((x + y ≥ 2) ∨ (2y − z ≤ 4))
We perform a preprocessing step, in order to separate the formula
into a set of equations and a set of simple bounds. This is done by
introducing fresh variables.
The formula above ϕ is equivalent to (the conjunction of)
(x ≥ 0) ∧ ((s1 ≤ 2) ∨ (s2 ≥ 6)) ∧ ((s1 ≥ 2) ∨ (s3 ≤ 4))
(s1 = x + y)
(s2 = x + 2y − z)
(s3 = 2y − z)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 5 / 21
Preprocessing
In the SMT setting, we are given a formula ϕ like
(x ≥ 0) ∧ ((x + y ≤ 2) ∨ (x + 2y − z ≥ 6)) ∧ ((x + y ≥ 2) ∨ (2y − z ≤ 4))
We perform a preprocessing step, in order to separate the formula
into a set of equations and a set of simple bounds. This is done by
introducing fresh variables.
The formula above ϕ is equivalent to (the conjunction of)
(x ≥ 0) ∧ ((s1 ≤ 2) ∨ (s2 ≥ 6)) ∧ ((s1 ≥ 2) ∨ (s3 ≤ 4)) ϕ
(s1 = x + y)
(s2 = x + 2y − z) Ax = 0
(s3 = 2y − z)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 5 / 21
Preprocessing
In general, from a formula ϕ, we end up in a rewritten formula of the
kind
ϕ ∧ Ax = 0
where ϕ is a Boolean combination of bounds, while Ax = 0 is a
system of equations of the form
a11x1 + . . . + a1nxn = 0
a21x1 + . . . + a2nxn = 0
. . .
ai1x1 + . . . + ainxn = 0
. . .
am1x1 + . . . + amnxn = 0
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 6 / 21
Preprocessing
In general, from a formula ϕ, we end up in a rewritten formula of the
kind
ϕ ∧ Ax = 0
where ϕ is a Boolean combination of bounds, while Ax = 0 is a
system of equations of the form
a11x1 + . . . + a1nxn = 0
a21x1 + . . . + a2nxn = 0
. . .
ai1x1 + . . . + ainxn = 0
. . .
am1x1 + . . . + amnxn = 0
Now we detach Ax = 0 from the formula, and we store it into the
T -solver permanently. The SAT-solver will work only on ϕ . Therefore
the constraints that are pushed into and popped from the
T -solver are just bounds
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 6 / 21
The Tableau
The equations Ax = 0 are kept in a tableau, the most important structure of the Simplex
The variables are partitioned into the set of non-basic N and basic B variables
E.g., B = {x1, x3, x4}, N = {x2, x5, x6}
x1 = 4x2 + x5
x3 = 5x2 + 3x6
x4 = x5 − x6
non-basic variables can be considered as independent, while basic variables assume values
forced by the non-basic ones. E.g., in the row
x1 = 4x2 + x5
suppose that x2 = 2, x5 = 1, then we set x1 = 9
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 7 / 21
Solving
The T -solver stores
the Tableau (does not grow/shrink)
the active bounds on variables (initially none)
the current model µ (initially all 0, but could be chosen differently)
Tableau
x1 = a11xm+1 . . . + a1nxn
x2 = a21xm+1 . . . + a2nxn
. . .
xi = ai1xm+1 . . . + ainxn
. . .
xm = am1xm+1 . . . + amnxn
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
. . .
−∞ ≤ xi ≤ ∞
. . .
−∞ ≤ xm ≤ ∞
. . .
−∞ ≤ xn ≤ ∞
µ
x1 → 0
x2 → 0
. . .
xi → 0
. . .
xm → 0
. . .
xn → 0
The T -solver is in a consistent state if the model (i) respects the tableau and (ii) satisfies
the bounds (for all x, lb(x) ≤ µ(x) ≤ ub(x))
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 8 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
The last case is “problematic” because we need to
(i) adjust µ(x): µ(x) is set to c
(ii) adjust the values of basic variables
We assume we have a function Update(x, c) that implements (i) − (ii)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
The last case is “problematic” because we need to
(i) adjust µ(x): µ(x) is set to c
(ii) adjust the values of basic variables
We assume we have a function Update(x, c) that implements (i) − (ii)
Tableau
x1 = −x3 + x4
x2 = x3 + x4
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
− ∞ ≤ x3 ≤ ∞
−∞ ≤ x4 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 0
x4 → 0
T -solver stack:
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
The last case is “problematic” because we need to
(i) adjust µ(x): µ(x) is set to c
(ii) adjust the values of basic variables
We assume we have a function Update(x, c) that implements (i) − (ii)
Tableau
x1 = −x3 + x4
x2 = x3 + x4
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
− ∞ ≤ x3 ≤ − 4
−∞ ≤ x4 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 0
x4 → 0
T -solver stack:
x3 ≤ −4 (tighten ub(x3), affects other values)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
The last case is “problematic” because we need to
(i) adjust µ(x): µ(x) is set to c
(ii) adjust the values of basic variables
We assume we have a function Update(x, c) that implements (i) − (ii)
Tableau
x1 = −x3 + x4
x2 = x3 + x4
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
− ∞ ≤ x3 ≤ − 4
−∞ ≤ x4 ≤ ∞
µ
x1 → 4
x2 → − 4
x3 → − 4
x4 → 0
T -solver stack:
x3 ≤ −4 (tighten ub(x3), affects other values)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
The last case is “problematic” because we need to
(i) adjust µ(x): µ(x) is set to c
(ii) adjust the values of basic variables
We assume we have a function Update(x, c) that implements (i) − (ii)
Tableau
x1 = −x3 + x4
x2 = x3 + x4
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
− 8 ≤ x3 ≤ − 4
−∞ ≤ x4 ≤ ∞
µ
x1 → 4
x2 → − 4
x3 → − 4
x4 → 0
T -solver stack:
x3 ≤ −4 (tighten ub(x3), affects other values)
x3 ≥ −8 (tighten lb(x3), does not affect other values)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a non-basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
The last case is “problematic” because we need to
(i) adjust µ(x): µ(x) is set to c
(ii) adjust the values of basic variables
We assume we have a function Update(x, c) that implements (i) − (ii)
Tableau
x1 = −x3 + x4
x2 = x3 + x4
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
− 8 ≤ x3 ≤ − 4
−∞ ≤ x4 ≤ ∞
µ
x1 → 4
x2 → − 4
x3 → − 4
x4 → 0
T -solver stack:
x3 ≤ −4 (tighten ub(x3), affects other values)
x3 ≥ −8 (tighten lb(x3), does not affect other values)
x3 ≤ 0 (does not tighten ub(x3))
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
Asserting a bound on a basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ B may result in the same 4 cases as before
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
however, since a basic variable is dependent from non-basic variables in the tableau, we
cannot use function Update directly. Before we need to turn x into a non-basic variables.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 10 / 21
Asserting a bound on a basic variable
Asserting a bound x ≤ c (resp. x ≥ c), x ∈ B may result in the same 4 cases as before
unsatisfiability, if c < lb(x) (resp. c > ub(x))
nothing, if c > ub(x) (resp. c < lb(x))
bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c)
bound tightening, model affected if µ(x) > c (resp. µ(x) < c)
however, since a basic variable is dependent from non-basic variables in the tableau, we
cannot use function Update directly. Before we need to turn x into a non-basic variables.
So if µ(x) > c or µ(x) < c we have to
(i) turn x into non-basic (another non-basic variable will become basic instead)
(ii) adjust µ(x): µ(x) is set to c
(iii) adjust the values of basic variables
Step (i) is performed by a function Pivot(x, y) (see next slide). Therefore asserting a bound
on a basic variable x consists in executing Pivot(x, y) and then Update(x, c)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 10 / 21
Pivoting
Pivot(x, y) is the operation of swapping a basic variable x with a non-basic variable y (how
to choose y ? See next slide)
It consists of the following steps:
1 Take the row x = ay + R in the tableau (R = rest of the polynome)
2 Rewrite it as y = x−R
a
3 Substitute y with x−R
a
in all the other rows of the tableau (and simplify)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 11 / 21
Pivoting
Pivot(x, y) is the operation of swapping a basic variable x with a non-basic variable y (how
to choose y ? See next slide)
It consists of the following steps:
1 Take the row x = ay + R in the tableau (R = rest of the polynome)
2 Rewrite it as y = x−R
a
3 Substitute y with x−R
a
in all the other rows of the tableau (and simplify)
Example for Pivot(x1, x3)
Step 1
x1 = 3x2 + 4x3 − 5x4
x5 = −x2 − x3
x6 = 10x2 + 5x4
Step 2
x3 = −3
4
x2 + 1
4
x1 + 5
4
x4
x5 = −x2 − x3
x6 = 10x2 + 5x4
Step 3
x3 = −3
4
x2 + 1
4
x1 + 5
4
x4
x5 = −1
4
x2 − 1
4
x1 − 5
4
x4
x6 = 10x2 + 5x4
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 11 / 21
Pivoting
Pivot(x, y) is the operation of swapping a basic variable x with a non-basic variable y (how
to choose y ? See next slide)
It consists of the following steps:
1 Take the row x = ay + R in the tableau (R = rest of the polynome)
2 Rewrite it as y = x−R
a
3 Substitute y with x−R
a
in all the other rows of the tableau (and simplify)
Example for Pivot(x1, x3)
Step 1
x1 = 3x2 + 4x3 − 5x4
x5 = −x2 − x3
x6 = 10x2 + 5x4
Step 2
x3 = −3
4
x2 + 1
4
x1 + 5
4
x4
x5 = −x2 − x3
x6 = 10x2 + 5x4
Step 3
x3 = −3
4
x2 + 1
4
x1 + 5
4
x4
x5 = −1
4
x2 − 1
4
x1 − 5
4
x4
x6 = 10x2 + 5x4
we moved from B = {x1, x5, x6} to B = {x3, x5, x6}
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 11 / 21
Choosing Pivoting Variable
Consider the following situation
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 10
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
1 ≤ x4 ≤ 2
−1 ≤ x5 ≤ 10
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too
high, I have to decrease it by playing with the values of N:
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
Choosing Pivoting Variable
Consider the following situation
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 10
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
1 ≤ x4 ≤ 2
−1 ≤ x5 ≤ 10
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too
high, I have to decrease it by playing with the values of N:
3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
Choosing Pivoting Variable
Consider the following situation
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 10
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
1 ≤ x4 ≤ 2
−1 ≤ x5 ≤ 10
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too
high, I have to decrease it by playing with the values of N:
3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down
−4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
Choosing Pivoting Variable
Consider the following situation
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 10
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
1 ≤ x4 ≤ 2
−1 ≤ x5 ≤ 10
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too
high, I have to decrease it by playing with the values of N:
3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down
−4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up
2x4 can decrease, as µ(x4) = ub(x4), and can be moved down
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
Choosing Pivoting Variable
Consider the following situation
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 10
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
1 ≤ x4 ≤ 2
−1 ≤ x5 ≤ 10
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too
high, I have to decrease it by playing with the values of N:
3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down
−4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up
2x4 can decrease, as µ(x4) = ub(x4), and can be moved down
−x5 can decrease, as µ(x5) = lb(x5), and can be moved up
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
Choosing Pivoting Variable
Consider the following situation
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 10
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
1 ≤ x4 ≤ 2
−1 ≤ x5 ≤ 10
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too
high, I have to decrease it by playing with the values of N:
3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down
−4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up
2x4 can decrease, as µ(x4) = ub(x4), and can be moved down
−x5 can decrease, as µ(x5) = lb(x5), and can be moved up
both x4 and x5 are therefore good candidates for pivoting. To avoid loops, choose variable
with smallest subscript (Bland’s Rule). This rule is not necessarily efficient, though
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
Detect Unsatisfiability
There might be cases in which no suitable variable for pivoting can be found. This
indicates unsatisfiability.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 13 / 21
Detect Unsatisfiability
There might be cases in which no suitable variable for pivoting can be found. This
indicates unsatisfiability. Consider the following where we have just asserted x1 ≤ 9
Tableau
. . .
x1 = 3x2 − 4x3 + 2x4 − x5
. . .
lb Bounds ub
−4 ≤ x1 ≤ 9
1 ≤ x2 ≤ 3
−4 ≤ x3 ≤ −1
2 ≤ x4 ≤ 2
−1 ≤ x5 ≤ −1
µ
x1 → 12
x2 → 1
x3 → −1
x4 → 2
x5 → −1
no variable among N = {x2, x3, x4} can be chosen for pivoting. This is because (due to
tableau)
x2 ≥ 3 ∧ x3 ≤ −1 ∧ x4 ≥ 4 ∧ x5 ≤ −1 ⇒ x1 ≥ 12 ⇒ ¬(x1 ≤ 9)
Therefore
{x2 ≥ 3, x3 ≤ −1, x4 ≥ 4, x5 ≤ −1, ¬(x1 ≤ 9)}
is a T -conflict (modulo the tableau)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 13 / 21
Solving
1 while( true )
2 pick first xi ∈ B such that µ(xi) < lb(xi) or µ(xi) > ub(xi)
3 if ( there is no such xi ) return sat
4 xj = ChoosePivot(xi)
5 if ( xj == undef ) return unsat
6 Pivot(xi, xj)
7 if ( µ(xi) < lb(xi) )
8 Update(xi, lb(xi))
9 if ( µ(xi) > ub(xi) )
10 Update(xi, ub(xi))
11 end
xj = ChoosePivot(xi): returns variable to use for pivoting with xi, or undef if conflict
pick first xi . . . : it’s again Bland’s rule
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 14 / 21
An Example
Consider the following problem
x1 − x2 ≤ 8 ∧ x2 − x3 ≤ −1 ∧ x3 − x4 ≤ 2 ∧ x4 − x1 ≤ −10
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x1 − x2
x6 = x2 − x3
x7 = x3 − x4
x8 = x4 − x1
lb Bounds ub
−∞ ≤ x5 ≤ ∞
−∞ ≤ x6 ≤ ∞
−∞ ≤ x7 ≤ ∞
−∞ ≤ x8 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 0
x4 → 0
x5 → 0
x6 → 0
x7 → 0
x8 → 0
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x1 − x2
x6 = x2 − x3
x7 = x3 − x4
x8 = x4 − x1
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ ∞
−∞ ≤ x7 ≤ ∞
−∞ ≤ x8 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 0
x4 → 0
x5 → 0
x6 → 0
x7 → 0
x8 → 0
Receiving x5 ≤ 8: OK
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x1 − x2
x6 = x2 − x3
x7 = x3 − x4
x8 = x4 − x1
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ ∞
−∞ ≤ x8 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 0
x4 → 0
x5 → 0
x6 → 0
x7 → 0
x8 → 0
Receiving x6 ≤ −1: µ(x6) out of bounds
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x1 − x2
x3 = x2 − x6
x7 = x2 − x6 − x4
x8 = x4 − x1
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ ∞
−∞ ≤ x8 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 1
x4 → 0
x5 → 0
x6 → − 1
x7 → 1
x8 → 0
Pivot(x6, x3), Update(x6, −1). Values of x3 and x7 change as well
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x1 − x2
x3 = x2 − x6
x7 = x2 − x6 − x4
x8 = x4 − x1
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ 2
−∞ ≤ x8 ≤ ∞
µ
x1 → 0
x2 → 0
x3 → 1
x4 → 0
x5 → 0
x6 → − 1
x7 → 1
x8 → 0
Receiving x7 ≤ 2: OK
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x1 − x2
x3 = x2 − x6
x7 = x2 − x6 − x4
x8 = x4 − x1
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ 2
−∞ ≤ x8 ≤ − 10
µ
x1 → 0
x2 → 0
x3 → 1
x4 → 0
x5 → 0
x6 → − 1
x7 → 1
x8 → 0
Receiving x8 ≤ −10: µ(x8) out of bounds
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x5 = x4 − x8 − x2
x3 = x2 − x6
x7 = x2 − x6 − x4
x1 = x4 − x8
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ 2
−∞ ≤ x8 ≤ − 10
µ
x1 → 10
x2 → 0
x3 → 1
x4 → 0
x5 → 10
x6 → − 1
x7 → 1
x8 → − 10
Pivot(x8, x1), Update(x8, −10). Values of x5 and x1 change as well. µ(x5) out of bounds
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x2 = x4 − x8 − x5
x3 = x4 − x8 − x5 − x6
x7 = − x5 − x8 − x6
x1 = x4 − x8
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ 2
−∞ ≤ x8 ≤ − 10
µ
x1 → 10
x2 → 2
x3 → 1
x4 → 0
x5 → 8
x6 → − 1
x7 → 3
x8 → − 10
Pivot(x5, x2), Update(x5, 8). Values of x2 and x7 change as well. µ(x7) out of bounds
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
An Example
Consider the following problem
x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10
Tableau
x2 = x4 − x8 − x5
x3 = x4 − x8 − x5 − x6
x7 = − x5 − x8 − x6
x1 = x4 − x8
lb Bounds ub
−∞ ≤ x5 ≤ 8
−∞ ≤ x6 ≤ − 1
−∞ ≤ x7 ≤ 2
−∞ ≤ x8 ≤ − 10
µ
x1 → 10
x2 → 2
x3 → 1
x4 → 0
x5 → 8
x6 → − 1
x7 → 3
x8 → − 10
Cannot find suitable variable for pivoting (ChoosePivot(x7) == undef). Return unsat
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
Outline
1 Basic Solving
Introduction
Preprocessing
Solving
2 Improvement for T -solver
T -solver features
Strict inequalities
Integers
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 16 / 21
T -solver features
Incrementality: it comes for free, as we keep µ updated
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
T -solver features
Incrementality: it comes for free, as we keep µ updated
Backtrackability: use the same trick as for BF: update a model µ ,
if satisfiable set µ = µ , otherwise forget µ . When backtracking
don’t change µ
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
T -solver features
Incrementality: it comes for free, as we keep µ updated
Backtrackability: use the same trick as for BF: update a model µ ,
if satisfiable set µ = µ , otherwise forget µ . When backtracking
don’t change µ
Minimal T -conflicts: seen already
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
T -solver features
Incrementality: it comes for free, as we keep µ updated
Backtrackability: use the same trick as for BF: update a model µ ,
if satisfiable set µ = µ , otherwise forget µ . When backtracking
don’t change µ
Minimal T -conflicts: seen already
Theory Propagation:
Bound propagation (cheap): if x ≤ c has been asserted, then all
other inactive x ≤ c with c ≤ c are implied (similar for ≥)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
T -solver features
Incrementality: it comes for free, as we keep µ updated
Backtrackability: use the same trick as for BF: update a model µ ,
if satisfiable set µ = µ , otherwise forget µ . When backtracking
don’t change µ
Minimal T -conflicts: seen already
Theory Propagation:
Bound propagation (cheap): if x ≤ c has been asserted, then all
other inactive x ≤ c with c ≤ c are implied (similar for ≥)
Tableau+Bound propagation: use a row x1 = a2x2 + a3x3 + . . . and
bounds on x2, x3, . . . to derive bounds on x1 (similar idea as to find
conflicts)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a
symbolic positive parameter (δ > 0)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a
symbolic positive parameter (δ > 0)
We do the following: instead of using Q numbers of form n, we use Qδ
numbers of form (n, k) to be intended as n + kδ
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a
symbolic positive parameter (δ > 0)
We do the following: instead of using Q numbers of form n, we use Qδ
numbers of form (n, k) to be intended as n + kδ
Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a
symbolic positive parameter (δ > 0)
We do the following: instead of using Q numbers of form n, we use Qδ
numbers of form (n, k) to be intended as n + kδ
Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2)
Scalar multiplication in Qδ: c(n, k) = (cn, ck)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a
symbolic positive parameter (δ > 0)
We do the following: instead of using Q numbers of form n, we use Qδ
numbers of form (n, k) to be intended as n + kδ
Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2)
Scalar multiplication in Qδ: c(n, k) = (cn, ck)
Comparison in Qδ: (n1, k1) ≤ (n2, k2) iff (n1 < n2) or (n1 = n2 and
k1 ≤ k2)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
So far we have used bounds like x ≤ 3, but never strict ones like x < 3
Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a
symbolic positive parameter (δ > 0)
We do the following: instead of using Q numbers of form n, we use Qδ
numbers of form (n, k) to be intended as n + kδ
Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2)
Scalar multiplication in Qδ: c(n, k) = (cn, ck)
Comparison in Qδ: (n1, k1) ≤ (n2, k2) iff (n1 < n2) or (n1 = n2 and
k1 ≤ k2)
If constraints are satisfiable, it is always possible to compute a rational
value for δ to translate Qδ numbers into Q numbers
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
Strict inequalities
Example: situation after receiving
x3 < −2, x4 > 0
and after Update(x3, (−2, −1)), Update(x4, (0, 1))
Tableau
x1 = −x3 + x4
x2 = x3 + x4
lb Bounds ub
−∞ ≤ x1 ≤ ∞
−∞ ≤ x2 ≤ ∞
−∞ ≤ x3 ≤ (−2, −1)
(0, 1) ≤ x4 ≤ ∞
µ
x1 → (2, 2)
x2 → (−2, 0)
x3 → (−2, −1)
x4 → (0, 1)
x1 = −(−2, −1) + (0, 1) = (2, 1) + (0, 1) = (2, 2)
x2 = (−2, −1) + (0, 1) = (−2, 0)
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 19 / 21
Solving LIA with LRA
The Simplex can be used also to reason (in a complete way) about the
integers (LIA), e.g., using known techniques in linear programming
Given a set of LIA constraints S
If S is unsatisfiable on LRA1 then it is also unsatisfiable on LIA
If S is satisfiable on LRA, then we have to check if there is an
integer solution
1
This means that we allow variables to assume values in Q instead of Z.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 20 / 21
Solving LIA with LRA
The Simplex can be used also to reason (in a complete way) about the
integers (LIA), e.g., using known techniques in linear programming
Given a set of LIA constraints S
If S is unsatisfiable on LRA1 then it is also unsatisfiable on LIA
If S is satisfiable on LRA, then we have to check if there is an
integer solution
For the latter case the convex polytope on Q is explored sistematically.
However, in general, search is necessary: LIA is NP-Complete, like
SAT
in SAT we split a and ¬a, in LIA we split x ≤ c and x ≥ c + 1
in SAT we learn clauses, in LIA we learn new tableau rows (new
constraints)
1
This means that we allow variables to assume values in Q instead of Z.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 20 / 21
Solving LIA with LRA
The Simplex can be used also to reason (in a complete way) about the
integers (LIA), e.g., using known techniques in linear programming
Given a set of LIA constraints S
If S is unsatisfiable on LRA1 then it is also unsatisfiable on LIA
If S is satisfiable on LRA, then we have to check if there is an
integer solution
For the latter case the convex polytope on Q is explored sistematically.
However, in general, search is necessary: LIA is NP-Complete, like
SAT
in SAT we split a and ¬a, in LIA we split x ≤ c and x ≥ c + 1
in SAT we learn clauses, in LIA we learn new tableau rows (new
constraints)
When on the integers, δ is set to 1 (Qδ numbers are not used)
1
This means that we allow variables to assume values in Q instead of Z.
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 20 / 21
Exercizes
1 Show that the T -conflicts generated by the Simplex are minimal
2 Suppose that (0, 1) ≤ x ≤ (1, −1). Compute the biggest possible
value for δ
3 Find the candidate for pivoting in this row (for simplicity we use
normal numbers)
x1 = 3x2 − 9x3 − 7x4
given these bounds −∞ ≤ x1 ≤ 1, 0 ≤ x2 ≤ ∞, −∞ ≤ x3 ≤ −1,
1 ≤ x4 ≤ 2 and this assignment
µ = {x1 → 2, x2 → 0, x3 → −1, x4 → 1}
4 Using the row of previous exercize, change the bounds so that the
only candidate for pivoting becomes x2
5 Now change the bounds so that no pivoting is possible. Compute
the conflict
R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 21 / 21

More Related Content

PDF
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
PDF
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
PDF
06 recurrent neural_networks
PDF
tensor-decomposition
PDF
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
PDF
How to find a cheap surrogate to approximate Bayesian Update Formula and to a...
PDF
Bayesian hybrid variable selection under generalized linear models
PDF
Approximate Bayesian Computation with Quasi-Likelihoods
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
06 recurrent neural_networks
tensor-decomposition
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
How to find a cheap surrogate to approximate Bayesian Update Formula and to a...
Bayesian hybrid variable selection under generalized linear models
Approximate Bayesian Computation with Quasi-Likelihoods

What's hot (20)

PDF
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
PDF
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
PDF
Erin catto numericalmethods
PDF
Tensor Decomposition and its Applications
PDF
MCMC and likelihood-free methods
PDF
Rao-Blackwellisation schemes for accelerating Metropolis-Hastings algorithms
PDF
Maximum likelihood estimation of regularisation parameters in inverse problem...
PPTX
Statistical Physics Assignment Help
PDF
Delayed acceptance for Metropolis-Hastings algorithms
PPTX
Stochastic Assignment Help
PDF
QMC Opening Workshop, High Accuracy Algorithms for Interpolating and Integrat...
PDF
Geometric and viscosity solutions for the Cauchy problem of first order
PDF
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
PDF
The proof theoretic strength of the Steinitz exchange theorem - EACA 2006
PDF
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
PDF
On problem-of-parameters-identification-of-dynamic-object
PDF
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
PDF
Zeros of orthogonal polynomials generated by a Geronimus perturbation of meas...
PDF
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
PDF
Jensen's inequality, EM 알고리즘
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
Erin catto numericalmethods
Tensor Decomposition and its Applications
MCMC and likelihood-free methods
Rao-Blackwellisation schemes for accelerating Metropolis-Hastings algorithms
Maximum likelihood estimation of regularisation parameters in inverse problem...
Statistical Physics Assignment Help
Delayed acceptance for Metropolis-Hastings algorithms
Stochastic Assignment Help
QMC Opening Workshop, High Accuracy Algorithms for Interpolating and Integrat...
Geometric and viscosity solutions for the Cauchy problem of first order
QMC Program: Trends and Advances in Monte Carlo Sampling Algorithms Workshop,...
The proof theoretic strength of the Steinitz exchange theorem - EACA 2006
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
On problem-of-parameters-identification-of-dynamic-object
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Zeros of orthogonal polynomials generated by a Geronimus perturbation of meas...
Solving High-order Non-linear Partial Differential Equations by Modified q-Ho...
Jensen's inequality, EM 알고리즘
Ad

Viewers also liked (20)

PPT
LRA_presentation2011[1]
PDF
Citizens of the World: Finding Joy through International Picture Books
PPTX
Macro diagrams and definitions
PPTX
Missles flight control systems
PPT
3.4 Demand And Supply Side Policies
PPT
3.3 Macro Economic Models
PPTX
Lesion renal aguda LRA
PPTX
Institutional Repositories: What the Open Access agenda means for a modern in...
PDF
17 02-24 lara investor presentation
PPTX
The Stars My Destination
PPTX
Joseph Kony and the LRA
PPT
Leicester Research Archive (LRA): the work of a repository administrator
DOCX
Resume Mcgregor March 2016
PDF
C-LRA Program Evaluation and Needs Assessment
PDF
LRA Investor Presentation 13 05-17
PDF
Semantic Relations
PDF
13 03-01 lra investor presentation
PDF
20100822 opensmt bruttomesso
PPTX
SRI SUWANTI - LAPORAN REALISASI ANGGARAN DAN LAPORAN OPERASIONAL
LRA_presentation2011[1]
Citizens of the World: Finding Joy through International Picture Books
Macro diagrams and definitions
Missles flight control systems
3.4 Demand And Supply Side Policies
3.3 Macro Economic Models
Lesion renal aguda LRA
Institutional Repositories: What the Open Access agenda means for a modern in...
17 02-24 lara investor presentation
The Stars My Destination
Joseph Kony and the LRA
Leicester Research Archive (LRA): the work of a repository administrator
Resume Mcgregor March 2016
C-LRA Program Evaluation and Needs Assessment
LRA Investor Presentation 13 05-17
Semantic Relations
13 03-01 lra investor presentation
20100822 opensmt bruttomesso
SRI SUWANTI - LAPORAN REALISASI ANGGARAN DAN LAPORAN OPERASIONAL
Ad

Similar to smtlecture.6 (20)

PPT
n7-LP-simplex.ppt
PPT
Simplex Method for Linear Programming - Operations Research
 
PDF
2_Simplex.pdf
PDF
Optimum Engineering Design - Day 2b. Classical Optimization methods
PDF
Linearprog, Reading Materials for Operational Research
PDF
Lecture3 linear svm_with_slack
PPT
L20 Simplex Method
PDF
Chapter 4 Simplex Method ppt
PDF
intro to linear optimization and extensions
PPT
5163147.ppt
PPT
BBM-501-U-II_-_Linear_Programming (1).ppt
PPT
Lecture 1
PDF
Mathematical linear programming notes
PDF
1439049238 272709.Pdf
PPT
lp3 FUNDAMENTOS SIMPLEX SIMPLEX simplex.ppt
PDF
Recursive Compressed Sensing
PDF
Diagnosing Infeasibilities in IMPL
PPT
part3for food and accelerationpresentation.ppt
PDF
Low Complexity Regularization of Inverse Problems - Course #3 Proximal Splitt...
PPT
Solving Linear programming problem by Simplex method.ppt
n7-LP-simplex.ppt
Simplex Method for Linear Programming - Operations Research
 
2_Simplex.pdf
Optimum Engineering Design - Day 2b. Classical Optimization methods
Linearprog, Reading Materials for Operational Research
Lecture3 linear svm_with_slack
L20 Simplex Method
Chapter 4 Simplex Method ppt
intro to linear optimization and extensions
5163147.ppt
BBM-501-U-II_-_Linear_Programming (1).ppt
Lecture 1
Mathematical linear programming notes
1439049238 272709.Pdf
lp3 FUNDAMENTOS SIMPLEX SIMPLEX simplex.ppt
Recursive Compressed Sensing
Diagnosing Infeasibilities in IMPL
part3for food and accelerationpresentation.ppt
Low Complexity Regularization of Inverse Problems - Course #3 Proximal Splitt...
Solving Linear programming problem by Simplex method.ppt

More from Roberto Bruttomesso (10)

PDF
smtlecture.10
PDF
smtlecture.9
PDF
smtlecture.8
PDF
smtlecture.7
PDF
smtlecture.5
PDF
smtlecture.4
PDF
smtlecture.3
PDF
smtlectures.2
PDF
satandsmt.stpetersburg
PDF
smtlectures.1
smtlecture.10
smtlecture.9
smtlecture.8
smtlecture.7
smtlecture.5
smtlecture.4
smtlecture.3
smtlectures.2
satandsmt.stpetersburg
smtlectures.1

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Cell Structure & Organelles in detailed.
PPTX
master seminar digital applications in india
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Trump Administration's workforce development strategy
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Lesson notes of climatology university.
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Anesthesia in Laparoscopic Surgery in India
Cell Structure & Organelles in detailed.
master seminar digital applications in india
human mycosis Human fungal infections are called human mycosis..pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Chinmaya Tiranga quiz Grand Finale.pdf
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Abdominal Access Techniques with Prof. Dr. R K Mishra
Orientation - ARALprogram of Deped to the Parents.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Trump Administration's workforce development strategy
Microbial disease of the cardiovascular and lymphatic systems
Lesson notes of climatology university.
Weekly quiz Compilation Jan -July 25.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Final Presentation General Medicine 03-08-2024.pptx

smtlecture.6

  • 1. Satisfiability Modulo Theories Lecture 6 - A Theory Solver for LRA (slides revision: Saturday 14th March, 2015, 11:47) Roberto Bruttomesso Seminario di Logica Matematica (Corso Prof. Silvio Ghilardi) 24 Novembre 2011 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 1 / 21
  • 2. Outline 1 Basic Solving Introduction Preprocessing Solving 2 Improvement for T -solver T -solver features Strict inequalities Integers R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 2 / 21
  • 3. Simplex Algorithm Invented by Tobias Dantzig around 1950 Used to solve optimization problems in linear programming Greg Nelson was the first to employ it for constraint solving, AFAIK, around 1980 Difference is that in linear programming input problem is feasible and one looks for optimum. In constraint solving problem can be infeasible, and we are interested in finding any solution R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 3 / 21
  • 4. Introduction Linear Rational Arithmetic LRA consists in solving Boolean combinations of atoms of the form n j=1 ajxj ≤ b n j=1 ajxj ≥ b where aj are constants (coefficients), xj are variables, and b is a constant (bound). The domain of aj, xj, b is that of rationals. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 4 / 21
  • 5. Introduction Linear Rational Arithmetic LRA consists in solving Boolean combinations of atoms of the form n j=1 ajxj ≤ b n j=1 ajxj ≥ b where aj are constants (coefficients), xj are variables, and b is a constant (bound). The domain of aj, xj, b is that of rationals. Notice that the following translations hold n j=1 ajxj = b =⇒ ( n j=1 ajxj ≤ b) ∧ ( n j=1 ajxj ≥ b) n j=1 ajxj < b =⇒ see later n j=1 ajxj > b =⇒ see later n j=1 ajxj = b =⇒ ( n j=1 ajxj < b) ∨ ( n j=1 ajxj > b) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 4 / 21
  • 6. Preprocessing In the SMT setting, we are given a formula ϕ like (x ≥ 0) ∧ ((x + y ≤ 2) ∨ (x + 2y − z ≥ 6)) ∧ ((x + y ≥ 2) ∨ (2y − z ≤ 4)) We perform a preprocessing step, in order to separate the formula into a set of equations and a set of simple bounds. This is done by introducing fresh variables. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 5 / 21
  • 7. Preprocessing In the SMT setting, we are given a formula ϕ like (x ≥ 0) ∧ ((x + y ≤ 2) ∨ (x + 2y − z ≥ 6)) ∧ ((x + y ≥ 2) ∨ (2y − z ≤ 4)) We perform a preprocessing step, in order to separate the formula into a set of equations and a set of simple bounds. This is done by introducing fresh variables. The formula above ϕ is equivalent to (the conjunction of) (x ≥ 0) ∧ ((s1 ≤ 2) ∨ (s2 ≥ 6)) ∧ ((s1 ≥ 2) ∨ (s3 ≤ 4)) (s1 = x + y) (s2 = x + 2y − z) (s3 = 2y − z) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 5 / 21
  • 8. Preprocessing In the SMT setting, we are given a formula ϕ like (x ≥ 0) ∧ ((x + y ≤ 2) ∨ (x + 2y − z ≥ 6)) ∧ ((x + y ≥ 2) ∨ (2y − z ≤ 4)) We perform a preprocessing step, in order to separate the formula into a set of equations and a set of simple bounds. This is done by introducing fresh variables. The formula above ϕ is equivalent to (the conjunction of) (x ≥ 0) ∧ ((s1 ≤ 2) ∨ (s2 ≥ 6)) ∧ ((s1 ≥ 2) ∨ (s3 ≤ 4)) ϕ (s1 = x + y) (s2 = x + 2y − z) Ax = 0 (s3 = 2y − z) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 5 / 21
  • 9. Preprocessing In general, from a formula ϕ, we end up in a rewritten formula of the kind ϕ ∧ Ax = 0 where ϕ is a Boolean combination of bounds, while Ax = 0 is a system of equations of the form a11x1 + . . . + a1nxn = 0 a21x1 + . . . + a2nxn = 0 . . . ai1x1 + . . . + ainxn = 0 . . . am1x1 + . . . + amnxn = 0 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 6 / 21
  • 10. Preprocessing In general, from a formula ϕ, we end up in a rewritten formula of the kind ϕ ∧ Ax = 0 where ϕ is a Boolean combination of bounds, while Ax = 0 is a system of equations of the form a11x1 + . . . + a1nxn = 0 a21x1 + . . . + a2nxn = 0 . . . ai1x1 + . . . + ainxn = 0 . . . am1x1 + . . . + amnxn = 0 Now we detach Ax = 0 from the formula, and we store it into the T -solver permanently. The SAT-solver will work only on ϕ . Therefore the constraints that are pushed into and popped from the T -solver are just bounds R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 6 / 21
  • 11. The Tableau The equations Ax = 0 are kept in a tableau, the most important structure of the Simplex The variables are partitioned into the set of non-basic N and basic B variables E.g., B = {x1, x3, x4}, N = {x2, x5, x6} x1 = 4x2 + x5 x3 = 5x2 + 3x6 x4 = x5 − x6 non-basic variables can be considered as independent, while basic variables assume values forced by the non-basic ones. E.g., in the row x1 = 4x2 + x5 suppose that x2 = 2, x5 = 1, then we set x1 = 9 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 7 / 21
  • 12. Solving The T -solver stores the Tableau (does not grow/shrink) the active bounds on variables (initially none) the current model µ (initially all 0, but could be chosen differently) Tableau x1 = a11xm+1 . . . + a1nxn x2 = a21xm+1 . . . + a2nxn . . . xi = ai1xm+1 . . . + ainxn . . . xm = am1xm+1 . . . + amnxn lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ . . . −∞ ≤ xi ≤ ∞ . . . −∞ ≤ xm ≤ ∞ . . . −∞ ≤ xn ≤ ∞ µ x1 → 0 x2 → 0 . . . xi → 0 . . . xm → 0 . . . xn → 0 The T -solver is in a consistent state if the model (i) respects the tableau and (ii) satisfies the bounds (for all x, lb(x) ≤ µ(x) ≤ ub(x)) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 8 / 21
  • 13. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 14. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 15. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 16. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 17. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 18. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) The last case is “problematic” because we need to (i) adjust µ(x): µ(x) is set to c (ii) adjust the values of basic variables We assume we have a function Update(x, c) that implements (i) − (ii) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 19. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) The last case is “problematic” because we need to (i) adjust µ(x): µ(x) is set to c (ii) adjust the values of basic variables We assume we have a function Update(x, c) that implements (i) − (ii) Tableau x1 = −x3 + x4 x2 = x3 + x4 lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ − ∞ ≤ x3 ≤ ∞ −∞ ≤ x4 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 0 x4 → 0 T -solver stack: R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 20. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) The last case is “problematic” because we need to (i) adjust µ(x): µ(x) is set to c (ii) adjust the values of basic variables We assume we have a function Update(x, c) that implements (i) − (ii) Tableau x1 = −x3 + x4 x2 = x3 + x4 lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ − ∞ ≤ x3 ≤ − 4 −∞ ≤ x4 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 0 x4 → 0 T -solver stack: x3 ≤ −4 (tighten ub(x3), affects other values) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 21. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) The last case is “problematic” because we need to (i) adjust µ(x): µ(x) is set to c (ii) adjust the values of basic variables We assume we have a function Update(x, c) that implements (i) − (ii) Tableau x1 = −x3 + x4 x2 = x3 + x4 lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ − ∞ ≤ x3 ≤ − 4 −∞ ≤ x4 ≤ ∞ µ x1 → 4 x2 → − 4 x3 → − 4 x4 → 0 T -solver stack: x3 ≤ −4 (tighten ub(x3), affects other values) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 22. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) The last case is “problematic” because we need to (i) adjust µ(x): µ(x) is set to c (ii) adjust the values of basic variables We assume we have a function Update(x, c) that implements (i) − (ii) Tableau x1 = −x3 + x4 x2 = x3 + x4 lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ − 8 ≤ x3 ≤ − 4 −∞ ≤ x4 ≤ ∞ µ x1 → 4 x2 → − 4 x3 → − 4 x4 → 0 T -solver stack: x3 ≤ −4 (tighten ub(x3), affects other values) x3 ≥ −8 (tighten lb(x3), does not affect other values) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 23. Asserting a bound on a non-basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ N may result in unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) The last case is “problematic” because we need to (i) adjust µ(x): µ(x) is set to c (ii) adjust the values of basic variables We assume we have a function Update(x, c) that implements (i) − (ii) Tableau x1 = −x3 + x4 x2 = x3 + x4 lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ − 8 ≤ x3 ≤ − 4 −∞ ≤ x4 ≤ ∞ µ x1 → 4 x2 → − 4 x3 → − 4 x4 → 0 T -solver stack: x3 ≤ −4 (tighten ub(x3), affects other values) x3 ≥ −8 (tighten lb(x3), does not affect other values) x3 ≤ 0 (does not tighten ub(x3)) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 9 / 21
  • 24. Asserting a bound on a basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ B may result in the same 4 cases as before unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) however, since a basic variable is dependent from non-basic variables in the tableau, we cannot use function Update directly. Before we need to turn x into a non-basic variables. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 10 / 21
  • 25. Asserting a bound on a basic variable Asserting a bound x ≤ c (resp. x ≥ c), x ∈ B may result in the same 4 cases as before unsatisfiability, if c < lb(x) (resp. c > ub(x)) nothing, if c > ub(x) (resp. c < lb(x)) bound tightening, model not affected if µ(x) ≤ c (resp. µ(x) ≥ c) bound tightening, model affected if µ(x) > c (resp. µ(x) < c) however, since a basic variable is dependent from non-basic variables in the tableau, we cannot use function Update directly. Before we need to turn x into a non-basic variables. So if µ(x) > c or µ(x) < c we have to (i) turn x into non-basic (another non-basic variable will become basic instead) (ii) adjust µ(x): µ(x) is set to c (iii) adjust the values of basic variables Step (i) is performed by a function Pivot(x, y) (see next slide). Therefore asserting a bound on a basic variable x consists in executing Pivot(x, y) and then Update(x, c) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 10 / 21
  • 26. Pivoting Pivot(x, y) is the operation of swapping a basic variable x with a non-basic variable y (how to choose y ? See next slide) It consists of the following steps: 1 Take the row x = ay + R in the tableau (R = rest of the polynome) 2 Rewrite it as y = x−R a 3 Substitute y with x−R a in all the other rows of the tableau (and simplify) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 11 / 21
  • 27. Pivoting Pivot(x, y) is the operation of swapping a basic variable x with a non-basic variable y (how to choose y ? See next slide) It consists of the following steps: 1 Take the row x = ay + R in the tableau (R = rest of the polynome) 2 Rewrite it as y = x−R a 3 Substitute y with x−R a in all the other rows of the tableau (and simplify) Example for Pivot(x1, x3) Step 1 x1 = 3x2 + 4x3 − 5x4 x5 = −x2 − x3 x6 = 10x2 + 5x4 Step 2 x3 = −3 4 x2 + 1 4 x1 + 5 4 x4 x5 = −x2 − x3 x6 = 10x2 + 5x4 Step 3 x3 = −3 4 x2 + 1 4 x1 + 5 4 x4 x5 = −1 4 x2 − 1 4 x1 − 5 4 x4 x6 = 10x2 + 5x4 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 11 / 21
  • 28. Pivoting Pivot(x, y) is the operation of swapping a basic variable x with a non-basic variable y (how to choose y ? See next slide) It consists of the following steps: 1 Take the row x = ay + R in the tableau (R = rest of the polynome) 2 Rewrite it as y = x−R a 3 Substitute y with x−R a in all the other rows of the tableau (and simplify) Example for Pivot(x1, x3) Step 1 x1 = 3x2 + 4x3 − 5x4 x5 = −x2 − x3 x6 = 10x2 + 5x4 Step 2 x3 = −3 4 x2 + 1 4 x1 + 5 4 x4 x5 = −x2 − x3 x6 = 10x2 + 5x4 Step 3 x3 = −3 4 x2 + 1 4 x1 + 5 4 x4 x5 = −1 4 x2 − 1 4 x1 − 5 4 x4 x6 = 10x2 + 5x4 we moved from B = {x1, x5, x6} to B = {x3, x5, x6} R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 11 / 21
  • 29. Choosing Pivoting Variable Consider the following situation Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 10 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 1 ≤ x4 ≤ 2 −1 ≤ x5 ≤ 10 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too high, I have to decrease it by playing with the values of N: R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
  • 30. Choosing Pivoting Variable Consider the following situation Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 10 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 1 ≤ x4 ≤ 2 −1 ≤ x5 ≤ 10 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too high, I have to decrease it by playing with the values of N: 3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
  • 31. Choosing Pivoting Variable Consider the following situation Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 10 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 1 ≤ x4 ≤ 2 −1 ≤ x5 ≤ 10 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too high, I have to decrease it by playing with the values of N: 3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down −4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
  • 32. Choosing Pivoting Variable Consider the following situation Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 10 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 1 ≤ x4 ≤ 2 −1 ≤ x5 ≤ 10 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too high, I have to decrease it by playing with the values of N: 3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down −4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up 2x4 can decrease, as µ(x4) = ub(x4), and can be moved down R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
  • 33. Choosing Pivoting Variable Consider the following situation Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 10 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 1 ≤ x4 ≤ 2 −1 ≤ x5 ≤ 10 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too high, I have to decrease it by playing with the values of N: 3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down −4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up 2x4 can decrease, as µ(x4) = ub(x4), and can be moved down −x5 can decrease, as µ(x5) = lb(x5), and can be moved up R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
  • 34. Choosing Pivoting Variable Consider the following situation Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 10 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 1 ≤ x4 ≤ 2 −1 ≤ x5 ≤ 10 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 which among N = {x2, x3, x4} do I choose for pivoting ? Clearly, the value of µ(x1) is too high, I have to decrease it by playing with the values of N: 3x2 cannot decrease, as µ(x2) = lb(x2) and cannot be moved down −4x3 cannot decrease, as µ(x3) = ub(x3) and cannot be moved up 2x4 can decrease, as µ(x4) = ub(x4), and can be moved down −x5 can decrease, as µ(x5) = lb(x5), and can be moved up both x4 and x5 are therefore good candidates for pivoting. To avoid loops, choose variable with smallest subscript (Bland’s Rule). This rule is not necessarily efficient, though R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 12 / 21
  • 35. Detect Unsatisfiability There might be cases in which no suitable variable for pivoting can be found. This indicates unsatisfiability. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 13 / 21
  • 36. Detect Unsatisfiability There might be cases in which no suitable variable for pivoting can be found. This indicates unsatisfiability. Consider the following where we have just asserted x1 ≤ 9 Tableau . . . x1 = 3x2 − 4x3 + 2x4 − x5 . . . lb Bounds ub −4 ≤ x1 ≤ 9 1 ≤ x2 ≤ 3 −4 ≤ x3 ≤ −1 2 ≤ x4 ≤ 2 −1 ≤ x5 ≤ −1 µ x1 → 12 x2 → 1 x3 → −1 x4 → 2 x5 → −1 no variable among N = {x2, x3, x4} can be chosen for pivoting. This is because (due to tableau) x2 ≥ 3 ∧ x3 ≤ −1 ∧ x4 ≥ 4 ∧ x5 ≤ −1 ⇒ x1 ≥ 12 ⇒ ¬(x1 ≤ 9) Therefore {x2 ≥ 3, x3 ≤ −1, x4 ≥ 4, x5 ≤ −1, ¬(x1 ≤ 9)} is a T -conflict (modulo the tableau) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 13 / 21
  • 37. Solving 1 while( true ) 2 pick first xi ∈ B such that µ(xi) < lb(xi) or µ(xi) > ub(xi) 3 if ( there is no such xi ) return sat 4 xj = ChoosePivot(xi) 5 if ( xj == undef ) return unsat 6 Pivot(xi, xj) 7 if ( µ(xi) < lb(xi) ) 8 Update(xi, lb(xi)) 9 if ( µ(xi) > ub(xi) ) 10 Update(xi, ub(xi)) 11 end xj = ChoosePivot(xi): returns variable to use for pivoting with xi, or undef if conflict pick first xi . . . : it’s again Bland’s rule R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 14 / 21
  • 38. An Example Consider the following problem x1 − x2 ≤ 8 ∧ x2 − x3 ≤ −1 ∧ x3 − x4 ≤ 2 ∧ x4 − x1 ≤ −10 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 39. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x1 − x2 x6 = x2 − x3 x7 = x3 − x4 x8 = x4 − x1 lb Bounds ub −∞ ≤ x5 ≤ ∞ −∞ ≤ x6 ≤ ∞ −∞ ≤ x7 ≤ ∞ −∞ ≤ x8 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 0 x4 → 0 x5 → 0 x6 → 0 x7 → 0 x8 → 0 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 40. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x1 − x2 x6 = x2 − x3 x7 = x3 − x4 x8 = x4 − x1 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ ∞ −∞ ≤ x7 ≤ ∞ −∞ ≤ x8 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 0 x4 → 0 x5 → 0 x6 → 0 x7 → 0 x8 → 0 Receiving x5 ≤ 8: OK R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 41. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x1 − x2 x6 = x2 − x3 x7 = x3 − x4 x8 = x4 − x1 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ ∞ −∞ ≤ x8 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 0 x4 → 0 x5 → 0 x6 → 0 x7 → 0 x8 → 0 Receiving x6 ≤ −1: µ(x6) out of bounds R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 42. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x1 − x2 x3 = x2 − x6 x7 = x2 − x6 − x4 x8 = x4 − x1 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ ∞ −∞ ≤ x8 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 1 x4 → 0 x5 → 0 x6 → − 1 x7 → 1 x8 → 0 Pivot(x6, x3), Update(x6, −1). Values of x3 and x7 change as well R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 43. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x1 − x2 x3 = x2 − x6 x7 = x2 − x6 − x4 x8 = x4 − x1 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ 2 −∞ ≤ x8 ≤ ∞ µ x1 → 0 x2 → 0 x3 → 1 x4 → 0 x5 → 0 x6 → − 1 x7 → 1 x8 → 0 Receiving x7 ≤ 2: OK R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 44. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x1 − x2 x3 = x2 − x6 x7 = x2 − x6 − x4 x8 = x4 − x1 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ 2 −∞ ≤ x8 ≤ − 10 µ x1 → 0 x2 → 0 x3 → 1 x4 → 0 x5 → 0 x6 → − 1 x7 → 1 x8 → 0 Receiving x8 ≤ −10: µ(x8) out of bounds R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 45. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x5 = x4 − x8 − x2 x3 = x2 − x6 x7 = x2 − x6 − x4 x1 = x4 − x8 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ 2 −∞ ≤ x8 ≤ − 10 µ x1 → 10 x2 → 0 x3 → 1 x4 → 0 x5 → 10 x6 → − 1 x7 → 1 x8 → − 10 Pivot(x8, x1), Update(x8, −10). Values of x5 and x1 change as well. µ(x5) out of bounds R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 46. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x2 = x4 − x8 − x5 x3 = x4 − x8 − x5 − x6 x7 = − x5 − x8 − x6 x1 = x4 − x8 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ 2 −∞ ≤ x8 ≤ − 10 µ x1 → 10 x2 → 2 x3 → 1 x4 → 0 x5 → 8 x6 → − 1 x7 → 3 x8 → − 10 Pivot(x5, x2), Update(x5, 8). Values of x2 and x7 change as well. µ(x7) out of bounds R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 47. An Example Consider the following problem x5 ≤ 8 ∧ x6 ≤ −1 ∧ x7 ≤ 2 ∧ x8 ≤ −10 Tableau x2 = x4 − x8 − x5 x3 = x4 − x8 − x5 − x6 x7 = − x5 − x8 − x6 x1 = x4 − x8 lb Bounds ub −∞ ≤ x5 ≤ 8 −∞ ≤ x6 ≤ − 1 −∞ ≤ x7 ≤ 2 −∞ ≤ x8 ≤ − 10 µ x1 → 10 x2 → 2 x3 → 1 x4 → 0 x5 → 8 x6 → − 1 x7 → 3 x8 → − 10 Cannot find suitable variable for pivoting (ChoosePivot(x7) == undef). Return unsat R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 15 / 21
  • 48. Outline 1 Basic Solving Introduction Preprocessing Solving 2 Improvement for T -solver T -solver features Strict inequalities Integers R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 16 / 21
  • 49. T -solver features Incrementality: it comes for free, as we keep µ updated R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
  • 50. T -solver features Incrementality: it comes for free, as we keep µ updated Backtrackability: use the same trick as for BF: update a model µ , if satisfiable set µ = µ , otherwise forget µ . When backtracking don’t change µ R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
  • 51. T -solver features Incrementality: it comes for free, as we keep µ updated Backtrackability: use the same trick as for BF: update a model µ , if satisfiable set µ = µ , otherwise forget µ . When backtracking don’t change µ Minimal T -conflicts: seen already R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
  • 52. T -solver features Incrementality: it comes for free, as we keep µ updated Backtrackability: use the same trick as for BF: update a model µ , if satisfiable set µ = µ , otherwise forget µ . When backtracking don’t change µ Minimal T -conflicts: seen already Theory Propagation: Bound propagation (cheap): if x ≤ c has been asserted, then all other inactive x ≤ c with c ≤ c are implied (similar for ≥) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
  • 53. T -solver features Incrementality: it comes for free, as we keep µ updated Backtrackability: use the same trick as for BF: update a model µ , if satisfiable set µ = µ , otherwise forget µ . When backtracking don’t change µ Minimal T -conflicts: seen already Theory Propagation: Bound propagation (cheap): if x ≤ c has been asserted, then all other inactive x ≤ c with c ≤ c are implied (similar for ≥) Tableau+Bound propagation: use a row x1 = a2x2 + a3x3 + . . . and bounds on x2, x3, . . . to derive bounds on x1 (similar idea as to find conflicts) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 17 / 21
  • 54. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 55. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a symbolic positive parameter (δ > 0) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 56. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a symbolic positive parameter (δ > 0) We do the following: instead of using Q numbers of form n, we use Qδ numbers of form (n, k) to be intended as n + kδ R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 57. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a symbolic positive parameter (δ > 0) We do the following: instead of using Q numbers of form n, we use Qδ numbers of form (n, k) to be intended as n + kδ Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 58. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a symbolic positive parameter (δ > 0) We do the following: instead of using Q numbers of form n, we use Qδ numbers of form (n, k) to be intended as n + kδ Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2) Scalar multiplication in Qδ: c(n, k) = (cn, ck) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 59. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a symbolic positive parameter (δ > 0) We do the following: instead of using Q numbers of form n, we use Qδ numbers of form (n, k) to be intended as n + kδ Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2) Scalar multiplication in Qδ: c(n, k) = (cn, ck) Comparison in Qδ: (n1, k1) ≤ (n2, k2) iff (n1 < n2) or (n1 = n2 and k1 ≤ k2) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 60. Strict inequalities So far we have used bounds like x ≤ 3, but never strict ones like x < 3 Since we are on the rationals x < 3 is same as x ≤ (3 − δ), where δ is a symbolic positive parameter (δ > 0) We do the following: instead of using Q numbers of form n, we use Qδ numbers of form (n, k) to be intended as n + kδ Addition in Qδ: (n1, k1) + (n2, k2) = (n1 + n2, k1 + k2) Scalar multiplication in Qδ: c(n, k) = (cn, ck) Comparison in Qδ: (n1, k1) ≤ (n2, k2) iff (n1 < n2) or (n1 = n2 and k1 ≤ k2) If constraints are satisfiable, it is always possible to compute a rational value for δ to translate Qδ numbers into Q numbers R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 18 / 21
  • 61. Strict inequalities Example: situation after receiving x3 < −2, x4 > 0 and after Update(x3, (−2, −1)), Update(x4, (0, 1)) Tableau x1 = −x3 + x4 x2 = x3 + x4 lb Bounds ub −∞ ≤ x1 ≤ ∞ −∞ ≤ x2 ≤ ∞ −∞ ≤ x3 ≤ (−2, −1) (0, 1) ≤ x4 ≤ ∞ µ x1 → (2, 2) x2 → (−2, 0) x3 → (−2, −1) x4 → (0, 1) x1 = −(−2, −1) + (0, 1) = (2, 1) + (0, 1) = (2, 2) x2 = (−2, −1) + (0, 1) = (−2, 0) R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 19 / 21
  • 62. Solving LIA with LRA The Simplex can be used also to reason (in a complete way) about the integers (LIA), e.g., using known techniques in linear programming Given a set of LIA constraints S If S is unsatisfiable on LRA1 then it is also unsatisfiable on LIA If S is satisfiable on LRA, then we have to check if there is an integer solution 1 This means that we allow variables to assume values in Q instead of Z. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 20 / 21
  • 63. Solving LIA with LRA The Simplex can be used also to reason (in a complete way) about the integers (LIA), e.g., using known techniques in linear programming Given a set of LIA constraints S If S is unsatisfiable on LRA1 then it is also unsatisfiable on LIA If S is satisfiable on LRA, then we have to check if there is an integer solution For the latter case the convex polytope on Q is explored sistematically. However, in general, search is necessary: LIA is NP-Complete, like SAT in SAT we split a and ¬a, in LIA we split x ≤ c and x ≥ c + 1 in SAT we learn clauses, in LIA we learn new tableau rows (new constraints) 1 This means that we allow variables to assume values in Q instead of Z. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 20 / 21
  • 64. Solving LIA with LRA The Simplex can be used also to reason (in a complete way) about the integers (LIA), e.g., using known techniques in linear programming Given a set of LIA constraints S If S is unsatisfiable on LRA1 then it is also unsatisfiable on LIA If S is satisfiable on LRA, then we have to check if there is an integer solution For the latter case the convex polytope on Q is explored sistematically. However, in general, search is necessary: LIA is NP-Complete, like SAT in SAT we split a and ¬a, in LIA we split x ≤ c and x ≥ c + 1 in SAT we learn clauses, in LIA we learn new tableau rows (new constraints) When on the integers, δ is set to 1 (Qδ numbers are not used) 1 This means that we allow variables to assume values in Q instead of Z. R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 20 / 21
  • 65. Exercizes 1 Show that the T -conflicts generated by the Simplex are minimal 2 Suppose that (0, 1) ≤ x ≤ (1, −1). Compute the biggest possible value for δ 3 Find the candidate for pivoting in this row (for simplicity we use normal numbers) x1 = 3x2 − 9x3 − 7x4 given these bounds −∞ ≤ x1 ≤ 1, 0 ≤ x2 ≤ ∞, −∞ ≤ x3 ≤ −1, 1 ≤ x4 ≤ 2 and this assignment µ = {x1 → 2, x2 → 0, x3 → −1, x4 → 1} 4 Using the row of previous exercize, change the bounds so that the only candidate for pivoting becomes x2 5 Now change the bounds so that no pivoting is possible. Compute the conflict R. Bruttomesso (SMT) T -solver for LRA 24 Novembre 2011 21 / 21