Presentation is loading. Please wait.

Presentation is loading. Please wait.

Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Gaussian Elimination and Simplex.

Similar presentations


Presentation on theme: "Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Gaussian Elimination and Simplex."— Presentation transcript:

1 Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Gaussian Elimination and Simplex

2 Gaussian’s elimination Given a linear system Ax = b Manipulate A|b to an upper-triangular form A x = b

3 Gaussian’s elimination Then, solve backwards from the k ’s row according to:

4 Gaussian elimination - example And now… x 3 = -1, x 2 = 3, x 1 = 1 problem solved.

5 Feasibility with Simplex Simplex was originally designed for solving the optimization problem: s.t. We are only interested in the feasibility problem. Is this system optimal ? Is this system feasible ?

6 General simplex We will learn a variant called general simplex. Very suitable for solving the feasibility problem fast. The input:  A is a m £ n coefficient matrix  The problem variables: First step: convert the input to general form

7 General form General form: A combination of:  Linear equalities of the form  Lower and upper bounds on variables.

8 Converting to General Form A: Replace (where ) with and s 1,..., s m are called the additional variables.

9 Example 1 Convert to: It is common to keep the conjunctions implicit

10 Example 2 Convert to:

11 Simplex basics… Linear inequality constraints, geometrically, define a convex polyhedron. © Wikipedia

12 Our example from before, geometrically General Simplex begins in the origin...

13 Matrix form xys1s2s3xys1s2s3 Recall the general form: Due to the additional variables:  now A is an m £ ( n + m ) matrix.

14 The tableau The diagonal part is inherent to the general form We can instead write: xys1s2s3xys1s2s3 xyxy s1s2s3s1s2s3 This is called the tableau

15 The tableau The tableau changes throughout the algorithm, but maintains its m £ n structure Distinguish between basic and nonbasic variables Initially, basic variables = the additional variables. xyxy s1s2s3s1s2s3 Basic variables Nonbasic variables

16 The tableau Denote by  B – Basic variables  N – Nonbasic variables The tableau is simply a rewrite of the system: The basic variables are also called the dependent variables.

17 The general simplex algorithm Simplex maintains:  The tableau,  an assignment ® to all variables  The bounds Initially,  B = additional variables  N = problem variables  ® ( x i ) = 0 for i 2 {1,..., n + m }

18 Invariants Two invariants are maintained throughout: 1. 2. All nonbasic variables satisfy their bounds Can you see why these invariants are maintained initially ? We should check that they are indeed maintained

19 The general simplex algorithm The initial assignment satisfies If the bounds of all basic variables are satisfied by ®, return `Satisfiable’. Otherwise... pivot.

20 Pivoting Find a basic variable x i that violates its bounds.  Suppose that ® ( x i ) < l i Find a nonbasic variable x j such that  a ij > 0 and  ( x j ) < u j, or  a ij l j Why ?

21 Pivoting Find a basic variable x i that violates its bounds.  Suppose that ® ( x i ) < l i Find a nonbasic variable x j such that  a ij > 0 and  ( x j ) < u j, or  a ij l j Such a variable x j is called suitable. If there is no suitable variable – return ‘Unsatisfiable’  Why ?

22 Pivoting x i with x j Solve equation i for x j : From: To: Swap x i and x j, and update the i -th row accordingly. From To: a i1... a ij... a in - a i1 a ij... 1 a ij...- a in a ij

23 Pivoting x i with x j Update all other rows:  Replace x j with its equivalent obtained from row i :

24 Pivoting Update ® as follows: Increase ® ( x j ) by  Now x j is a basic variable: it can violate its bounds. Update ® ( x i ) accordingly  Q: What is now ® ( x i ) ? Update  for all other basic (dependent) variables.

25 Example Recall the tableau and constraints in our example: Initially  assigns 0 to all variables Bounds of s 1 and s 3 are violated

26 Example Recall the tableau and constraints in our example: We will solve s 1 x is a suitable nonbasic variable for pivoting  It has no upper bound So now we pivot s 1 with x

27 Example Recall the tableau and constraints in our example: Solve 1 st row for x : Replace x with s 1 in other rows:

28 Example The new state: Solve 1 st row for x : Replace x with s 1 in other rows:

29 Example The new state: What about the assignment ? We should increase x by  Hence,  ( x ) = 0 + 2 = 2  Now s 1 is equal to its lower bound:  ( s 1 ) = 2  Update all the others

30 Example The new state: Now s 3 violates its lower bound Which nonbasic variable is suitable for pivoting ?  That’s right… y

31 Example The new state: We should increase y by

32 Example The final state: All constraints are now satisfied

33 Observations The additional variables:  Only additional variables have bounds.  These bounds are permanent.  Additional variables exit the base only on extreme points (their lower or upper bounds).  When entering the base, they shift towards the other bound and possibly cross it (violate it).

34 Observations Can it be that we pivot( x i, x j ) and then pivot( x j, x i ) and enter a (local) cycle ?  No.  For example, suppose that a ij > 0.  We increased  ( x j ) so now  ( x i ) = l i.  After pivoting, possibly  ( x j ) > u j  But a ij ’ = 1 / a ij > 0, hence x i is not suitable.

35 Observations Is termination guaranteed ? Not obvious.  Perhaps there are bigger cycles. In order to avoid circles, we use Bland’s rule:  determine a total order on the variables.  Choose the first basic variable that violates its bounds, and first nonbasic suitable variable for pivoting.  It can be proven that this guarantees that no base is repeated, which implies termination.

36 General-Simplex with Bland’s rule


Download ppt "Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Gaussian Elimination and Simplex."

Similar presentations


Ads by Google