a lecture on optimization

32
BITS Pilani Hyderabad Campus Optimization Lecture 6

Upload: seshu-bollineni

Post on 06-May-2017

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A lecture on optimization

BITS PilaniHyderabad Campus

Optimization Lecture 6

Page 2: A lecture on optimization

BITS Pilani, Hyderabad Campus

• Formulation of Linear Programming Problem (LPP) from the real world problem

• Solving LPP using Graphical method • Solving maximization LPP using Simplex method with

less than or equal to constraints• Solving minimization LPP using Simplex method with

less than or equal to constraints• Solving maximization and minimization with greater than

or equal to constraints and equal to constraints – Big-M Method

Topics we have discussed so far

Page 3: A lecture on optimization

BITS Pilani, Hyderabad Campus

Solving maximization and minimization with greater than or equal to constraints and equal to constraints – Two Phase Method

Today’s Topic

Second method for handling artificial variables within simplexHas two phasesPhase I : finds a basic feasible solution for the original problem, if one exists Phase II : finds an optimal solution for original problem

Page 4: A lecture on optimization

BITS Pilani, Hyderabad Campus

Consider a linear programming problem consisting of artificial variablesObjective: to set all artificial variables to zero at optimalityHence, solve a linear programming problem by replacing original objective function by sum of artificial variables with a minimization objectiveObserve: due to non-negativity constraint, sum of artificial variables cannot be negative, i.e., smallest possible feasible value of sum is zeroIf optimal value of modified objective function is not zero (i.e., strictly positive), conclude that problem is not feasible

Two-Phase Method

Page 5: A lecture on optimization

BITS Pilani, Hyderabad Campus

maximize z = -3x1 + x3

subject to

x1 + x2 + x3 + x4 = 4...........(1)

-2x1 + x2 - x3 = 1...........(2)

3x2 + x3 + 3x4 = 10..............(3)

x1 , x2 , x3 , x4 0...........(4)

Observe: not in canonical form

Two-Phase Method

Page 6: A lecture on optimization

BITS Pilani, Hyderabad Campus

maximize z = -3x1 + x3 subject to

x1 + x2 + x3 + x4 + x5 = 4...........(1’)

-2x1 + x2 - x3 + x6 = 1...........(2’)

3x2 + x3 + 3x4 + x7 = 10............(3’)

x1 , x2 , x3 , x4 , x5 , x6 , x7 0...(4’)

Two-Phase Method

Page 7: A lecture on optimization

BITS Pilani, Hyderabad Campus

minimize r = x5 + x6+ x7

i.e., maximize w = -x5 - x6 - x7

subject to

x1 + x2 + x3 + x4 + x5 = 4...........(1’)

-2x1 + x2 - x3 + x6 = 1...........(2’)

3x2 + x3 + 3x4 + x7 = 10............(3’)

x1 , x2 , x3 , x4 , x5 , x6 , x7 0...(5’)

Two-Phase Method

Page 8: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic Vars x1 x2 x3 x4 x5 x6 x7 RHS

w 0 0 0 0 1 1 1 0

x5 1 1 1 1 1 0 0 4

x6 -2 1 -1 0 0 1 0 1

x7 0 3 1 3 0 0 1 10

Two-Phase Method

Page 9: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic Vars x1 x2 x3 x4 x5 x6 x7 RHS

w 1 -5 -1 -4 0 0 0 -15

x5 1 1 1 1 1 0 0 4

x6 -2 1 -1 0 0 1 0 1

x7 0 3 1 3 0 0 1 10Perform the elementary row operation R1 = R1 - (R2 + R3 + R4 ) to make the table in canonical form

Two-Phase Method

Page 10: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic Vars x1 x2 x3 x4 x5 x6 x7

RHS Ratio

w 1 -5 -1 -4 0 0 0 -15x5 1 1 1 1 1 0 0 4 4/1=4

x6 -2 1 -1 0 0 1 0 1 1/1=1

x7 0 3 1 3 0 0 1 10 10/3=3.33

Two-Phase Method

Page 11: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic

Varsx1 x2 x3 x4 x5 x6 x7

RHS Ratio

w -9 0 -6 -4 0 5 0 -10

x5 3 0 2 1 1 -1 0 3 3/3=1

x2 -2 1 -1 0 0 1 0 1 -----

x7 6 0 4 3 0 -3 1 7 7/6=1.3

Two-Phase Method

Page 12: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic

Varsx1 x2 x3 x4 x5 x6 x7

RHS Ratio

w 0 0 0 -1 3 2 0 -1

x1 1 0 2/3 1/3 1/3 -1/3 0 1 1/1/3=3

x2 0 1 1/3 2/3 2/3 1/3 0 3 9/2=4.5

x7 0 0 0 1 -2 -1 1 1 1/1=1

Two-Phase Method

Page 13: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic Vars x1 x2 x3 x4 x5 x6 x7

RHS

w 0 0 0 0 1 1 1 0x1 1 0 2/3 0 1 0 -1/3 2/3x2 0 1 1/3 0 2 1 -2/3 7/3x4 0 0 0 1 -2 -1 1 1

•Observe: all artificial variables are now non-basic, i.e., problem is feasible

•Hence x5= x6= x7 = 0

•Initial basic feasible solution: x1=2/3, x2=7/3, x4=1

•End of Phase I

Two-Phase Method

Page 14: A lecture on optimization

BITS Pilani, Hyderabad Campus

In Phase 2 we solve the original problem Maximize z = -3x1 + x3 Subject to x1 + (⅔)x3 = ⅔ x2 + (⅓) x3 = ⅓ x4 = 1x1 , x2 , x3 ≥ 0with initial basic variables as x1 , x2 , x4

Two-Phase Method

Page 15: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic

Varsx1 x2 x3 x4

RHS

z 3 0 -1 0 0x1 1 0 2/3 0 2/3x2 0 1 1/3 0 7/3x4 0 0 0 1 1

Drop –w rowDrop all artificial variable columns

Two-Phase Method

Not in canonical form Hence perform ERO : R1 = R1 – 3R2

Page 16: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic

Varsx1 x2 x3 x4

RHS Ratio

z 0 0 -3 0 -2x1 1 0 2/3 0 2/3 1x2 0 1 1/3 0 7/3 7x4 0 0 0 1 1 ---

Two-Phase Method

Page 17: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic Vars x1 x2 x3 x4

RHS

z 9/2 0 0 0 1

x3 3/2 0 1 0 1

x2-1/2 0 0 0 2

x4 0 0 0 1 1

Coefficients of all non-basic variables in the first row ≥ 0

Hence we have optimal solution

z=1, x2=2, x3=1, x4=1, x1= 0

Two-Phase Method

Page 18: A lecture on optimization

BITS Pilani, Hyderabad Campus

Infeasible Solution

Infeasibility is detected in the simplex method when an artificial variable remains positive in the final tableau.

For Example consider the LPPMAX z = 2x1 + 6x2 s. t. 4x1 + 3x2 < 12

2x1 + x2 > 8

x1, x2 > 0

Page 19: A lecture on optimization

BITS Pilani, Hyderabad Campus

Infeasible Solution

MAX z = 2x1 + 6x2 s. t. 4x1 + 3x2 + S1 = 12

2x1 + x2 - S2 + A1 = 8

x1, x2 , S1, S2 , A1 > 0

Page 20: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic Vars x1 x2 S1 S2 A1

RHS

z -2 1 0 0 M 0S1 4 3 1 0 0 12A1 2 1 0 -1 1 8

Basic Vars x1 x2 S1 S2 A1

RHS Ratio

z -2-2M 1-M 0 M 0 -8MS1 4 3 1 0 0 12 3A1 2 1 0 -1 1 8 4

Infeasible Solution

Page 21: A lecture on optimization

BITS Pilani, Hyderabad Campus

Infeasible Solution

Basic Vars x1 x2 S1 S2 A1

RHS

z 0 (5+M)/2 (1+M)/2 M 0 6-2M

x1 1 3/4 1/4 0 0 3

A1 0 -3/4 -1/4 0 0 3/2

Page 22: A lecture on optimization

BITS Pilani, Hyderabad Campus

Infeasible Solution

Basic Vars x1 x2 S1 S2 A1

RHS

r 0 0 0 0 1 0

S1 4 3 1 0 0 12

A1 2 1 0 -1 1 8

Min r = A1

s. t. 4x1 + 3x2 + S1 = 12

2x1 + x2 - S2 + A1 = 8x1, x2 , S1, S2 , A1 > 0

Page 23: A lecture on optimization

BITS Pilani, Hyderabad Campus

Infeasible Solution

Basic Vars x1 x2 S1 S2 A1

RHS

r -2 -1 0 1 0 8

S1 4 3 1 0 0 12

A1 2 1 0 -1 1 8

Page 24: A lecture on optimization

BITS Pilani, Hyderabad Campus

Solve the following linear programming problem by using the simplex method:Min Z =2 X1 + 3 X2

S.t.½ X1 + ¼ X2 ≤ 4X1 + 3X2 20X1 + X2 = 10X1, X2 0

Page 25: A lecture on optimization

BITS Pilani, Hyderabad Campus

SolutionStep 1: standard formMin Z, s.t.Z – 2 X1 – 3 X2 - M A1 -M A2 = 0 ½ X1 + ¼ X2 + S1 = 4 X1 + 3X2 - S2 + A1 = 20 X1 + X2 + A2 = 10X1, X2 ,S1, S2, A1, A2 0 Where: M is a very large number

Page 26: A lecture on optimization

BITS Pilani, Hyderabad Campus

M, a very large number, is used to ensure that the values of A1 and A2, …, and An will be zero in the final (optimal) tableau as follows:

1. If the objective function is Minimization, then A1, A2, …, and An must be added to the RHS of the objective function multiplied by a very large number (M).

Example: if the objective function is Min Z = X1+2X2, then the obj. function should be Min Z = X1 + X2+ MA1 + MA2+ …+ MAn

OR Z – X1 - X2- MA1 - MA2- …- MAn = 0

2. If the objective function is Maximization, then A1, A2, …, and An must be subtracted from the RHS of the objective function multiplied by a very large number (M).

Example: if the objective function is Max Z = X1+2X2, then the obj. function should be Max Z = X1 + X2- MA1 - MA2- …- MAn

OR Z - X1 - X2+ MA1 + MA2+ …+ MAn = 0

N.B.: When the Z is transformed to a zero equation, the signs are chang

Page 27: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic variables

X1

2

X2

3

S1

0

S2

0

A1

M

A2

M

RHS

S1 ½ ¼ 1 0 0 0 4

A1 1 3 0 -1 1 0 20A2 1 1 0 0 0 1 10

Z -2 -3 0 0 -M -M 0

Page 28: A lecture on optimization

BITS Pilani, Hyderabad Campus

To correct this violation before starting the simplex algorithm, the elementary row operations are used as follows:New (Z row) = old (z row) ± M (A1 row) ± M (A2 row)In our case, it will be positive since M is negative in the Z row, as following:Old (Z row): -2 -3 0 0 -M -M 0M (A1 row): M 3M 0 -M M o 20MM (A2 row): M M 0 0 0 M 10MNew (Z row):2M-2 4M-3 0 -M 0 0 30M

Page 29: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic variables

X1

2

X2

3

S1

0

S2

0

A1

M

A2

M

RHS

S1 1/2 1/4 1 0 0 0 4

A1 1 3 0 -1 1 0 20A2 1 1 0 0 0 1 10

Z 2M-2 4M-3 0 -M 0 0 30M

Page 30: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic variables

X1

2

X2

3

S1

0

S2

0

A1

M

A2

M

RHS

S15/12 0 1 1/12 -1/12 0 7/3

X21/3 1 0 -1/3 1/3 0 20/3

A22/3 0 0 1/3 -1/3 1 10/3

Z 2/3M-1 0 0 1/3M-1 1-4/3M 0 20+10/3M

Page 31: A lecture on optimization

BITS Pilani, Hyderabad Campus

Basic variables

X1 X2 S1 S2 A1 A2 RHS

S10 0 1 -1/8 1/8 -5/8 1/4

X20 1 0 -1/2 1/2 -1/2 5

X11 0 0 1/2 -1/2 3/2 5

Z 0 0 0 -1/2 ½-M 3/2-M 25

Page 32: A lecture on optimization

BITS Pilani, Hyderabad Campus

•In the final tableau, if one or more artificial variables (A1, A2, …) still basic and has a nonzero value, then the problem has an infeasible solution•If there is a zero under one or more nonbasic variables in the last tableau (optimal solution tableau), then there is a multiple optimal solution.•When determining the leaving variable of any tableau, if there is no positive ratio (all the entries in the pivot column are negative and zeroes), then the solution is unbounded.