Sei sulla pagina 1di 29

Introduction to Operations Research

Everardo B arcenas ismael.barcenas@uppuebla.edu.mx


U. Polit ecnica de Puebla

Spring 2013

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

1 / 23

Contents
Linear Algebra Linear Programming Queuing Theory Deterministic Inventory Models Discrete Simulation

Bibliography
Winston and Goldberg. Operations Research: Applications and Algorithms. Barnes & Noble.

Evaluation
40% exams (theory), 40% homework (exercises and programming), 10% performance.

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

2 / 23

Warm up test
1

Find x in 10 5 3 17 111 15 3 7 34 12 23 2 0 2 20 20 + x = 11 8 5 5 112 89 56 14 66 144 25 3 69 441 225 0

Find x in 10 5 3 17 111 15 3 7 34 12 23 2 0 2 20 20 x = 11 8 5 5 112 89 56 14 66 144 25 3 69 441 225 0

Find a solutions to the following linear system x1 + x2 = 2 x2 + x3 = 3 x1 + 2x2 + x3 = 5


E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 3 / 23

Wam up test 2

Write a program to solve matrix addition Write a program to solve matrix multiplication Write a program to solve linear systems

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

4 / 23

Linear Equations System


A linear equation system is the following expression a11 x1 + a12 x2 + a13 x3 + . . . + a1n xn = b1 a21 x1 + a22 x2 + a23 x3 + . . . + a2n xn = b2 a31 x1 + a32 x2 + a33 x3 + . . . + a3n xn = b3 . . . ai 1 x1 + ai 2 x2 + ai 3 x3 + . . . + ain xn = bi . . . an1 x1 + an2 x2 + an3 x3 + . . . + ann xn = bn Its compact form is the following
n

aij xj = bi (1 i n)
j =1
E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 5 / 23

Gaussian Elimination

6x1 2x2 + 2x3 + 4x4 = 16 12x1 8x2 + 6x3 + 10x4 = 26 3x1 13x2 + 9x3 + 13x4 = 19 6x1 + 4x2 + x3 18x4 = 41 6x1 2x2 + 2x3 + 4x4 = 16 2x2 + x3 + x4 = 3 24x2 16x3 22x4 = 54 6x2 + x3 + 22x4 = 57

6x1 2x2 + 2x3 + 4x4 = 16 2x2 + x3 + x4 = 3 (10/3)x3 + (35/6)x4 = (41/2) (4/3)x3 + (25/3)x4 = 22 6x1 2x2 + 2x3 + 4x4 = 16 4x2 + 2x3 + 2x4 = 6 (10/3)x3 + (35/6)x4 = (41/2) (80/3)x4 = 96

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

6 / 23

Gaussian Elimination
Example
2x1 + 2x2 + x3 = 9 2x1 x2 + 2x3 = 6 x1 x2 + 2x3 = 5 x1 + 3x2 + 2x3 + x4 = 2 4x1 + 2x2 + x3 + 2x4 = 2 2x1 + x2 + 2x3 + 3x4 = 1 x1 + 2x2 + 4x3 + x4 = 1

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

7 / 23

Gaussian Elimination with Scaled Partial Pivoting


Consider the following equation system 0x1 + x2 = 1 x1 + x2 = 2 What happens when Gaussian elimination is applied? Now consider the following equation system x1 + x2 = 1 x1 + x2 = 2 Applying Gaussian elimination would produce x1 + x2 = 1 (1
E. B arcenas (UPPue)

)x2 = 2

Introduction to Operations Research

Spring 2013

8 / 23

Gaussian Elimination with Scaled Partial Pivoting

if is very close to zero, then x2 = 2 1 Consider for instance = 109 . Then 1

1 1

1 and x1 = 1 (1 x2 ) 0. 1 2 is computed as follows

=0.10000 00000 00000 0 1010

2 =0.00000 00002 00000 0 1010


1

2 =0.09999 99998 00000 0 1010 =0.10000 00000 00000 0 1010 =


1

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

9 / 23

Gaussian Elimination with Scaled Partial Pivoting

Does not work


0x1 + x2 = 1 x1 + x2 = 2 x1 + x2 = 1 x1 + x2 = 2

Works
x1 + x2 = 2 0x1 + x2 = 1 x1 + x2 = 2 x1 + x2 = 1

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

10 / 23

Partial and Complete Pivoting


Partial Pivoting
Selects the pivot row to be the one with the maximum pivot entry in absolute value from those in the leading column of the reduced submatrix.

Complete Pivoting
Selects the pivot entry as the maximum privot entry from all entries in the submatrix.

Example
2 2 c 2c 1 1 2 where c is big.

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

11 / 23

Gaussian elimination with scaled partial pivoting


In the Gaussian elimination method with scaled partial pivoting, the pivot at each step k (as in naive Gaussian elimination) is dened by the greatest li , where for each k i n: li = |ai 1 | 1j n max{|aij |}

Consider the following equation system: 3 13 9 3 x1 19 6 4 1 18 x2 34 = 6 2 2 4 x3 16 12 8 6 10 x4 26

Solve the given equation system by Gaussian elimination with scaled partial pivoting.
E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 12 / 23

Gaussian elimination with scaled partial pivoting

Solve the following equations system


1 1 2 2 2 1 1 2 4 1 2 1

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

13 / 23

Introduction to linear programming


Denition (Linear Programming Problem)
max C T X | AX b X 0

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

14 / 23

Introduction to linear programming


Denition (Linear Programming Problem)
max C T X | AX b X 0 i.e., maximize the function f (x1 , . . . , xn ) = c1 x1 + c2 x2 + . . . + cn xn

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

14 / 23

Introduction to linear programming


Denition (Linear Programming Problem)
max C T X | AX b X 0 i.e., maximize the function f (x1 , . . . , xn ) = c1 x1 + c2 x2 + . . . + cn xn such that a11 x1 + a12 x2 + . . . + a1n xn b1 a21 x1 + a22 x2 + . . . + a2n xn b2 . . . am1 x1 + am2 x2 + . . . + amn xn bm

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

14 / 23

Introduction to linear programming


Denition (Linear Programming Problem)
max C T X | AX b X 0 i.e., maximize the function f (x1 , . . . , xn ) = c1 x1 + c2 x2 + . . . + cn xn such that a11 x1 + a12 x2 + . . . + a1n xn b1 a21 x1 + a22 x2 + . . . + a2n xn b2 . . . am1 x1 + am2 x2 + . . . + amn xn bm and xk1 , xk2 , . . . , xkl 0, ki {1, . . . , n} for all i .
E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 14 / 23

Giapettos problem
Giappeto manufactures two types of wooden toys: soldiers and trains. A soldier sells for $27 and uses $10 worth of raw materials. Each soldier that is manufactured increases Giapettos variable labor and overhead costs by $14. A train sells for $21 and uses $9 worth of raw materials. Each train built increases Giapettos variable labor and overhead costs by $10. The manufacture of wooden soldiers and trains requires two types of skilled labor: carpentry and nishing. A soldier requires 2 hours of nishing labor and 1 hour of carpentry labor. A train requires 1 hour of nishing and 1 hour of carpentry labor. Each week, Giapetto can obtain all the needed raw material but only 100 nishing hours and 80 carpentry hours. Demand for trains is unlimited, but at most 40 soldiers are bought each week. Giapetto wants to maximize weekly prot (revenues minus costs). Formulate a mathematical model of Giapettos situation that can be used to maximize Giapettos weekly prot.

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

15 / 23

Mathematical model for Giapettos problem


Objective function
Weekly revenues (wr) = wr from soldires + wr from trains (27x1 + 21x2 ) Weekly raw material costs = 10x1 + 9x1 Other weekly costs = 14x1 + 10x2 Then Giapetto wants to maximize f (x1 , x2 ) = 3x1 + 2x2 .

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

16 / 23

Mathematical model for Giapettos problem


Objective function
Weekly revenues (wr) = wr from soldires + wr from trains (27x1 + 21x2 ) Weekly raw material costs = 10x1 + 9x1 Other weekly costs = 14x1 + 10x2 Then Giapetto wants to maximize f (x1 , x2 ) = 3x1 + 2x2 .

Constraints and sign restrictions


Each week, no more than 100 hours of nishing time may be used: 2x1 + x2 100 Each week, no more than 80 hours of carpentry time may be used: x1 + x2 80 Because of limited demand, at most 40 soldiers should be produced each week: x1 40 Sign restrictions: x1 0 and x 0.
E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 16 / 23

Graphical solution of two-variable linear inequality


x2 5 Satisfies 2x1 + 3x2 6 4
Satisfies 2x1 + 3x2 6

line 2x1 3x2 6 and the points above the line 2x1 3x2 6. This agrees

3
x2 = 2 2 x1 3

FIGURE

1 1

(0, 0)

x1

raphing a Linear Inequality


HAPTER E. B arcenas C(UPPue)

3 Introduction to LineartoProgramming Introduction Operations Research

Spring 2013

17 / 23

the line segmentsolution AB. Thus (40,of 30) two-variable is infeasible, because it fails toprogramming satisfy (2). Graphical linear problems
x2
100

equalities (2)(6). For example, the point (40, 30) lies outside DGFEH because it is above

B (2)

Feasible region

Giappetos problem
Find max z = 3x1 + 2x2

80

60

(4)

such that 2x1 + x2 100


(40, 30)

40 z = 100

x1 + x2 80 x1 40 x1 0 x2 0
C
80

(3)
20

F z = 60 E A
50

z = 180
60

10

20

40

x1
Spring 2013 18 / 23

E. B arcenas (UPPue)

Introduction to Operations Research

Minimization problem

Find min z = 50x1 + 100x2 such that 7x1 + 2x2 28 2x1 + 12x2 24 x1 0 x2 0

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

19 / 23

Minimization problem

graphically, we begin by graphing the feasible region ed by points on or above the line AB (AB is part of
x2

Find min z = 50x1 + 100x2 such that 7x1 + 2x2 28 2x1 + 12x2 24 x1 0 x2 0
FIGURE

14 12 10 8 6 4

(10)

(4, 4) z = 320 E D 2 (11) A 4 6 8 10 12 C 14 x1 z = 600

Graphical Solution of Dorian Problem


E. B arcenas (UPPue)

3Research .2 Introduction to Operations

The Graphical Solution of Two-Variable Linear Prog Spring 2013 19 / 23

Two-variable linear programming problem

Find max z = 3x1 + 2x2 such that 1 x1 + 40 1 x1 + 50 1 x2 1 60 1 x2 1 50 x1 0 x2 0

E. B arcenas (UPPue)

Introduction to Operations Research

Spring 2013

20 / 23

Two-variable linear programming problem


x2

Find max z = 3x1 + 2x2 such that 1 x1 + 40 1 x1 + 50 1 x2 1 60 1 x2 1 50 x1 0 xF 0RE 5 2 I GU


Graphical Solution of Example 3
E. B arcenas (UPPue)

60

B (13)

50

40

30

z = 100

20

(14)
10

z = 60 A C
50 60

10

20

30

40

x1

Introduction to Operations Research

Spring 2013

20 / 23

Cononical form of a linear programming problem


Canonical form
Consider the following linear programming problem max z = c1 x1 + c2 x2 + . . . + cn xn s.t. a11 x1 a21 x1 . . . am1 x1 +a12 x2 +a22 x2 +... +... +a1n xn +a2n xn b1 b2

+am2 x2

+...

+amn xn x1 , x2 , . . . , xn

bm 0

its canonical form is z c1 x1 a11 x1 a21 x1 . . . am1 x1 +am2 x2 +... +amn xn +sm x1 , x2 , . . . , xn
E. B arcenas (UPPue) Introduction to Operations Research

c2 x2 +a12 x2 +a22 x2

... +... +...

cn xn +a1n xn +a2n xn +s1 +s2

=0 =b1 =b2

=bm 0
Spring 2013 21 / 23

Canonical form of a LP
Convert the following LP to conaonical form
max z = 3x1 + 2x2 s.t. 2x1 + x2 100 x1 + x2 80 x1 40 x1 , x2 0 max z = 3x1 + 2x2 such that 1 x1 + 40 1 x1 + 50 1 x2 1 60 1 x2 1 50 x1 , x2 0

min z = 50x1 + 100x2 such that 7x1 + 2x2 28 2x1 + 12x2 24 x1 , x2 0


E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 22 / 23

Basic Feasible Solutions


Denition (Basic solution)
Consider a system AX = B of m linear equations in n variables (n m). A basic solution to AX = B is obtained by setting n m variables (nonbasic variables) equal to 0 and solving for the values of the remaining m variables (basic variables).

Denition (Basic feasible solutions)


Consider a system AX = B , of m linear equations in n variables (n m), to be the normal form of a linear programming problem. A basic feasible solution of the LP is a basic solution of the system AX = B .

Denition (Optimal solution)


If an LP has an optimal solution, then it has an optimal basic feasible solution.
E. B arcenas (UPPue) Introduction to Operations Research Spring 2013 23 / 23

Potrebbero piacerti anche