Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

22
Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1

Transcript of Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Page 1: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Artificial Variables, 2-Phase and Big M Methods

For the example, go to p. 16.

1

Page 2: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Artificial Variables, 2-Phase and Big M Methods

Facts:1. To start, we need a canonical form2. If we have a constraint with a nonnegative right-

hand side, it will contain an obvious basic variable (which?) after introducing a slack var.

3. If we have an equality constraint, it contains no obvious basic variable

4. If we have a constraint with a nonnegative right-hand side, it contains no obvious basic variable even after introducing a surplus var.

© 2008 MGS2

Page 3: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Compare!

• 2x + 3y 5 2x + 3y + s = 5, s 0 (s basic)

• 2x + 3y = 5 ??????? Infeasible if x=y=0!

• 2x + 3y 5 2x + 3y - s = 5, s 0 (??????) Infeasible if x=y=0! ??????????????????

© 2008 MGS3

Page 4: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

One Equality???

• 2x + 3y = 5 2x + 3y + a = 5, a = 0 (E) (a is basic, but it should be 0!)

• How do we force a = 0? This is of course not feasible if x=y=0, as 0+0+0 5!

© 2008 MGS4

Page 5: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

One Equality???

• 2x + 3y = 5 2x + 3y + a = 5, a = 0 (E) (a basic, but it should be 0!)

• How do we force a = 0? This is of course not feasible if x=y=0, as 0+0+0 5

• Idea: ! solve a first problem with

Min {a | constraint (E) + (a 0) + other constraints }!

© 2008 MGS5

Page 6: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Artificial Variables

Notice: In an equality constraint, the extra variable is called an artificial variable.

For instance, in 2x + 3y + a = 5, a = 0 (E)

a is an artificial variable.

© 2008 MGS6

Page 7: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

One Inequality ???

• 2x + 3y 5 2x + 3y - s = 5, s 0 (I) s could be the basic variable, but it should be 0 and for x=y=0, it is -5 ! • How do we force s 0?

?© 2008 MGS

7

Page 8: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

One Inequality ???

• 2x + 3y 5 2x + 3y - s = 5, s 0 (I) s could be the basic variable, but it should be 0 and it is -5 for x=y=0! • How do we force s 0? • By making it 0!

how?© 2008 MGS

8

Page 9: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

One Inequality ???

• 2x + 3y 5 2x + 3y - s = 5, s 0 (E) s could be basic, but it should be 0 and it is -5 for x=y=0! • How do we force s 0? • By making it 0! But we have to start with a canonical form… so

treat is as an equality constraint!

2x + 3y - s + a = 5, s 0, a 0 and Min a

© 2008 MGS9

Page 10: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Artificial Variables

Notice: In a inequality constraint, the extra variable a is called an artificial variable.

For instance, in 2x + 3y – s + a = 5, s 0, a 0 (E)

a is an artificial variable.

In a sense, we allow temporarily a small amount of cheating, but in the end we cannot allow it!

© 2008 MGS10

Page 11: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

What if we have many such = and constraints?

7x - 3y – s1 + a1 = 6, s1,a1 0 (I) 2x + 3y + a2 = 5, a2 0 (II)a1 and a2 are artificial variables, s1 is a surplus

variable.One minimizes their sum:Min {a1+a2 | a1, a2 0, (I), (II), other constraints}i.e., one minimizes the total amount of cheating!

© 2008 MGS11

Page 12: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Then What?

We have two objectives:• Get a “feasible” canonical form• Maximize our original problem

Two methods:2-phase method (phase 1, then phase 2)big M method

© 2008 MGS12

Page 13: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

2-Phase Method

• Phase I: find a BFSMinimize the sum of the artificial variables

If min = 0, we have found a BFSIf min > 0, then we cannot find a solution

with no “cheating”… the original problem is infeasible

• Phase 2: solve original LPStart from the phase 1 BFS, and maximize the original objective function.

© 2008 MGS13

Page 14: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Big-M Method

• Combine both objectives :(1) Min i ai

(2) Max j cj xj

into a single one:(3) Max – M i ai + j cj xj

where M is a large number, larger than anything subtracted from it.

If one minimizes j cj xj

then the combined objective function is Min M i ai + j cj xj

© 2008 MGS14

Page 15: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

The Big M Method

The simplex method algorithm requires a starting bfs.

Previous problems have found starting bfs by using the slack variables as our basic variables.

If an LP have ≥ or = constraints, however, a starting bfs may not be readily apparent.

In such a case, the Big M method may be used to solve the problem. Consider the following problem.

© 2003 Brooks/Cole15

Page 16: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

Example

• Bevco manufactures an orange-flavored soft drink called Oranj by

combining orange soda and orange juice. Each orange soda contains

0.5 oz of sugar and 1 mg of vitamin C. Each ounce of orange juice

contains 0.25 oz of sugar and 3 mg of vitamin C. It costs Bevco 2¢ to

produce an ounce of orange soda and 3¢ to produce an ounce of

orange juice. Bevco’s marketing department has decided that each

10-oz bottle of Oranj must contain at least 30 mg of vitamin C and at

most 4 oz of sugar. Use linear programming to determine how Bevco

can meet the marketing department’s requirements at minimum cost.© 2003 Brooks/Cole16

Page 17: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

The Big M Method

Let x1 = number of ounces of orange soda in a bottle of Oranj

x2 = number of ounces of orange juice in a bottle of Oranj

x2

x1

17

Page 18: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

The Big M Method

Letting x1 = number of ounces of orange soda in a bottle of Oranj

x2 = number of ounces of orange juice in a bottle of Oranj

The LP is:

min z = 2x1 + 3x2

st 0.5x1 + 0.25x2 ≤ 4 (sugar constraint)

x1 + 3x2 ≥ 20 (Vitamin C constraint)

x1 + x2 = 10 (10 oz in 1 bottle)

x1, x2 0

The LP in standard form is shown on the next slide.

© 2003 Brooks/Cole18

Page 19: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

The Big M Method

Row 1:-z + 2x1 + 3x2 = 0

Row 2: 0.5x1 + 0.25x2 + s1 = 4

Row 3: x1 + 3x2 - s2 = 20

Row 4: x1 + x2 = 10

The LP in standard form has z and s1 which could be used for BVs but row 2 would violate sign restrictions and row 3 no readily apparent basic variable.

In order to use the simplex method, a bfs is needed. To remedy the predicament, artificial variables are created. The variables will be labeled according to the row in which they are used as seen below. The basic variables are in red:

Row 1:-z + 2x1 + 3x2 = 0

Row 2: 0.5x1 + 0.25x2 + s1 = 4

Row 3: x1 + 3x2 - s2 + a2 = 20

Row 4: x1 + x2 + a3 = 10

© 2003 Brooks/Cole19

Page 20: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

The Big M Method

If all artificial variables in the optimal solution equal zero, the solution is optimal. If some artificial variables are positive in the optimal solution, the problem is infeasible.

The Bevco example continued:

Initial Tableau

Row z x1 x2 s1 e2 a2 a3 rhs0 -1.00 2.00 3.00 M M 0.001 0.50 0.25 1.00 4.002 1.00 3.00 -1.00 1.00 20.003 1.00 1.00 1.00 10.00

© 2003 Brooks/Cole20

Page 21: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

4.10 – The Big M MethodPivot 1 z x1 x2 s1 e2 a2 a3 rhs ratio ero

0 1.00 2M- 2 4M -3 -M 30M Row 0 + M(Row 2) + M(Row 3)

1 0.50 0.25 1.00 4.00 162 1.00 3 -1.00 1.00 20.00 6.673 1.00 1.00 1.00 10.00 10

ero 1 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 2M- 2 4M -3 -M 30M 1 0.50 0.25 1.00 4.002 0.33 1 -0.33 0.33 6.67 Row 2 divided by 33 1.00 1.00 1.00 10.00

ero 2 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 Row 0 - (4M-3)*(Row 2)1 0.50 0.25 1.00 4.002 0.33 1 -0.33 0.33 6.673 1.00 1.00 1.00 10.00

ero 3 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/3 1 0.42 1.00 0.08 -0.08 2.33 Row 1 - 0.25*(Row 2)2 0.33 1 -0.33 0.33 6.673 1.00 1.00 1.00 10.00

ero 4 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1 -0.33 0.33 6.673 0.67 0.33 -0.33 1.00 3.33 Row 3 - Row 2

Page 22: Artificial Variables, 2-Phase and Big M Methods For the example, go to p. 16. 1.

The Big M MethodPivot 2 z x1 x2 s1 e2 a2 a3 rhs ratio

0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.33 5.602 0.33 1 -0.33 0.33 6.67 20.003 0.67 0.33 -0.33 1.00 3.33 5.00

ero 1 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 (2M-3)/3 (M-3)/3 (3-4M)/3 (60+10M)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00 (Row 3)*(3/2)

ero 2 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.00 Row 0 + (3-2M)*(Row 3)/31 0.42 1.00 0.08 -0.08 2.332 0.33 1.00 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00

ero 3 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.001 1.00 -0.13 0.13 -0.63 0.25 Row 1 - (5/12)*Row 3)2 0.33 1.00 -0.33 0.33 6.673 1.00 0.50 -0.50 1.50 5.00

ero 4 z x1 x2 s1 e2 a2 a3 rhs ero0 1.00 -0.50 (1-2M)/2 (3-2M)/2 25.001 1.00 -0.13 0.13 -0.63 0.252 1.00 -0.50 0.50 -0.50 5.00 Row 2 -(1/3)*Row 33 1.00 0.50 -0.50 1.50 5.00

Optimal Solution