Chapter 2 - Linear Programming
Chapter 2 - Linear Programming
Li Linear P Programming i
Some of the major application areas to which LP can be applied li d are: Work scheduling Production P d ti planning l i &P Production d ti process Capital budgeting Financial planning Blending (e.g. Oil refinery management) Farm planning Distribution Multi-period decision problems
Inventory model Financial models Work scheduling
AmareMatebu(Dr.) BDUIOT
Linear Programming Assumptions Linearity: the impact of decision variables is linear in constraints and objective function. function Divisibility: non-integer values of decision variables are acceptable. Certainty: values of parameters are known and constant. Non-negativity: negative values of decision variables are unacceptable.
AmareMatebu(Dr.) BDUIOT
Requirements of a LP Problem 1. LP problems seek to maximize or minimize some quantity (usually profit or cost) expressed d as an objective bj ti function f function. ti . 2 The 2. presence of restrictions restrictions, or
constraints, , limits the degree g to which we can pursue our objective. objective.
AmareMatebu(Dr.) BDUIOT
2. Linear programming (LP) 1. LP model formulation An LP is one of the bedrocks of OR It is a tool for solving optimization problems 2. Any linear program consists of 4 parts: a set of decision variables, the objective function, and a set of constraints Sign g Restrictions
AmareMatebu(Dr.) BDUIOT
Example 1 1. The KADISCO company owns a small paint factory that produces both i t i and interior d exterior t i house h paints i t for f wholesale h l l distribution. di t ib ti T Two b i basic raw materials, A and B, are used to manufacture the paints. The maximum availability of A is 6 tons a day; that of B is 8 tons a day. The daily requirements of the raw materials per ton of interior and exterior paints are summarized in the following table.
Tons of Raw Material per Ton of Paint Exterior Raw Material A Raw Material B 1 2 Interior 2 1 Maximum Availability (tons) 6 8
A market survey has established that the daily demand for the interior paint cannot exceed that of exterior paint by more than 1 ton. The survey y also showed that the maximum demand for the interior p paint is limited to 2 tons daily. The wholesale price per kg is $3000 for exterior paint and $2000 per interior p paint. How much interior and exterior p paint should the company p y produce daily to maximize gross income?
AmareMatebu(Dr.) BDUIOT
Define XE = Tons of exterior paint to be produced XI = Tons of interior paint to be produced Maximize Z = 3000XE + 2000XI Subject to: XE + 2XI 6 (1) (availability of raw material A) 2XE + XI 8 (2) (availability of raw material B) _X XE + XI 1 (3) (Restriction in production) XI 2 (4) (demand restriction) XE, XI 0
AmareMatebu(Dr.) BDUIOT
LP Applications
E Example l 2. 2 P Production-Mix d ti Mi Example E l
Department Product XJ201 XM897 TR29 BR788 Wiring .5 1.5 1.5 15 1.0 Drilling 3 1 2 3 Assembly 2 4 1 2 Inspection .5 1.0 .5 5 .5 Unit Profit $ 9 $12 $15 $11
Capacity Department (in hours) Wiring Drilling Assembly Inspection 1,500 2,350 2,600 1,200
AmareMatebu(Dr.) BDUIOT
LP Applications
X1 = number of units of XJ201 produced X2 = number of units of XM897 produced X3 = number of units of TR29 p produced X4 = number of units of BR788 produced Maximize p profit = 9X1 + 12X2 + 15X3 + 11X4
subject to .5X1 3X1 2X1 .5X1 + 1.5X2 + 1.5X3 + + 1X2 + 2X3 + + 4X2 + 1X3 + + 1X2 + .5X3 + 1X4 3X4 2X4 .5X4 X1 X2 X3 X4 1,500 hours of wiring 2,350 hours of drilling 2,600 hours of assembly 1,200 hours of inspection 150 units of XJ201 100 units of XM897 300 units of TR29 400 units it of f BR788
AmareMatebu(Dr.) BDUIOT
Example 3 : Advertisement
3. Dorian makes luxury cars and jeeps for high-income men and women. It wishes to advertise with 1 minute spots in comedy shows and football games. E h comedy Each d spot t costs t $50 and d is i seen by b 7M highhigh income women and 2M high-income men. Each football spot costs $100 and is seen by 2M highincome women and 12M high high-income income men. men How can Dorian reach 28M high-income women and 24M highincome men at the least cost.
AmareMatebu(Dr.) BDUIOT
AmareMatebu(Dr.) BDUIOT
A PO requires different numbers of employees on different days of the week. Union rules state each employee must work 5 consecutive days and then receive two days off. Find the minimum number of employees needed.
Monday Staff Needed Tuesday Wednesday Thursday Friday Saturday Sunday
17
13
15
19
14
16
11
AmareMatebu(Dr.) BDUIOT
3 4 1 $25
1 3 3 $50
8 19 7
The p problem is to find a diet ( (a choice of the numbers of units of the two foods) that meets all minimum i i nutritional t iti l requirements i t at t minimal i i l cost. Formulate the problem LP. Mini {Z = $25X1 + $50X2} 3X1 + X2 4X1 + 3X2 X1 + 3X2 X1 , X2 8 19 7 0
Solution:
A Blending g Problem Let X1 and X2 be the number of regular and deluxe pizza, i then the LP formulation is: Maximize: { Z = X1 + 1.5 X2 } S bj t to: Subject t X1 + X2 150 0.25 X1 + 0.5 X2 50 X1 50 X2 25 X1 , X2 0
B. Iso-Profit or Iso-Cost Line Method 1. Define the problem mathematically 2. Graph by constraints by treating each inequality as equality 3 Locate the feasible region and the corner points 3. 4.Draw out a line having the slope of Objective Function i Equation i ( hi is (this i called ll d Iso-Cost C / Profit P fi Line in Minimization and Maximization problems respectively) somewhere in the middle of the feasible region.
Amare Matebu (Dr.) BDUIOT
Formulating LP Problems
Example1. The product-mix problem at Shader Electronics
Two products 1. Shader X-pod, a portable music player 2. Shader BlueBerry, y, an internet-connected color telephone Determine D i the h mix i of f products d that h will ill produce d the maximum profit
AmareMatebu(Dr.) BDUIOT
Formulating LP Problems
Hours Required to Produce 1 Unit Department Electronic Assembly Profit per unit X-pods (X1) 4 2 $7 BlueBerrys (X2) 3 1 $5 Available Hours This Week 240 100
Formulating LP Problems Objective Function: Maximize Profit = $7X1 + $5X2 There are three types of constraints Upper limits where the amount used is the amount of a resource Lower limits where the amount used is the amount of the resource Equalities where the amount used is = the amount of the resource
AmareMatebu(Dr.) BDUIOT
Formulating LP Problems First Constraint: Electronic time used is Electronic time available
4X1 + 3X2 240 (hours of electronic time) Second Constraint: Assembly time used is Assembly time available
Graphical Solution Can be used when there are two decision variables 1. Plot the constraint equations at their limits by converting i each h equation i to an equality li 2. Identify the feasible solution space 3. Create an iso-profit line based on the j function objective 4. Move this line outwards until the optimal point is identified
AmareMatebu(Dr.) BDUIOT
Graphical Solution
X2
100
80 60 40 20 Feasible | 0
Assembly (constraint B)
region
| 20
Electronics (constraint A)
| | 40 | | 60 | | 80 | | 100
X1
Number of X-pods
Amare Matebu (Dr.) BDUIOT
Graphical Solution
X2
100 Iso Profit LineSolutionMethod
Solve for the axis intercepts of theElectronics function and plot the (constraint A) line
20 Figure .3 | 0
Feasible region
| | | | | | | | X = 42 X = 30 2 20 160 40 80 | | 100
X1
Number of XX -p pods
AmareMatebu(Dr.) BDUIOT
Graphical Solution
X2
100
80 60 40 20 | 0 | | 20 | | 40 | | 60 | | 80 | | 100
N b of Number fX X-pods d
AmareMatebu(Dr.) BDUIOT
Graphical Solution
X2
100
80 60 40 20 | 0 | | 20 | | 40
| 60
| 80
| 100
X1
Figure .5
Number of X-pods p
Amare Matebu (Dr.) BDUIOT
Graphical Solution
X2
100
80 60 40 20 | 0 | | 20 | | 40 | | 60 | | 80 | | 100
Number of X-pods
AmareMatebu(Dr.) BDUIOT
Corner-Point Method
X2
100
80
60 40
20
1 | |
0
| 20
| 40
| 60
| 80
| 100
X1
Figure .7
AmareMatebu(Dr.) BDUIOT
Corner-Point Method Theoptimal p valuewillalways y beatacorner Solve for the intersection of two constraints point
+ 3X2 240 (electronics time) 1j functionvalueateachcorner Findthe4X objective 2X 100 (assembly time) 1 + 1X2 pointand choose the onewith thehighestprofit 4X1 + 3X2 = Point1: P i t2: Point Point4: 240 4X1 + 3(40) = 240 - 4X1 - 2X2 = -200 (X1 =+ 0,X 0) 1X 2= 40 2 = (X1 =0, 0 X2 =80) (X1 =50,X2 =0) 4X1 + 120 = 240 Profit$7(0)+$5(0) X1=$0 = 30 P fit$7(0)+$5(80)=$400 Profit Profit$7(50)+$5(0)=$350
AmareMatebu(Dr.) BDUIOT
Corner-Point Method The optimal p value will always y be at a corner point j function value at each corner Find the objective point and choose the one with the highest profit
Point1: Point2: Point4: Point3: (X1 =0,X2 =0) (X1 =0,X2 =80) (X1 =50,X2 =0) (X1 =30, ( ,X2 =40) ) Profit$7(0) $ +$5(0) $ =$0 $ Profit$7(0)+$5(80)=$400 Profit$7(50)+$5(0)=$350 Profit$ $7(30) ( )+$5(40) $ ( )=$410 $
Solving Minimization Problems Formulated and solved in much the same way as maximization problems In the g graphical p approach pp an iso-cost line is used The Th objective bj ti i to is t move the th iso-cost i t line li inwards until it reaches the lowest cost corner point
Example 2: Minimization
X1 = number of tons of black-and-white picture chemical produced X2 = number of tons of color picture chemical produced
Minimize total cost = 2,500X1 + 3,000X2 Subject to: X1 30 tons of black-and-white chemical X2 20 tons of color chemical X1 + X2 60 tons total $0 non-negativity g y requirements q X 1, X 2 $
Minimization Example
X2
60 50 40 30 20 10 | 0
X1 + X2 = 60
Feasible region
X1 = 30
| 10 | 20 | 30
b X2 = 20
| 40 Table .9
| 50
| 60
X1
4. (LP) Simplex Method Realistic linear programming problems often have several decision variables and many constraints. Such problems cannot be solved graphically; instead an algorithm such as the simplex procedures is used. Simplex method is thus the most effective analytical method of solving linear programming p problems.
AmareMatebu(Dr.) BDUIOT
The simplex method is an ITERATIVE or step step by step method or repetitive algebraic approach that moves automatically from one basic feasible solution to another basic feasible solution improving the situation each time until the optimal solution is reached h d at. t
AmareMatebu(Dr.) BDUIOT
4. (LP) Simplex Method Objective Function Optimize (Max. or Min.) z = cj xj for j = 1..n Subject j to: (Constraints) ( ) a ij xj (, =, ) bi ; for j = 1 ..n, i = 1,2, m (Non negativity restrictions) xj 0 ; j= 1, 2, , n
AmareMatebu(Dr.) BDUIOT
4. Simplex methods
General G l Mathematical M th ti l F Formulation l ti of f LP Optimize (Maximize or Minimize) Z = c1 x1 + c2 x2++cn xn Subject to: a11 x1 + a12 x2 ++ a1n xn (, =, ) b1 a21 x1 + a22 x2 ++ a2n xn (, =, ) b2 . . am1 x1 + am2 x2 ++ amn xn (, =, ) bm and x1, x2, x xn 0
AmareMatebu(Dr.) BDUIOT
4. (LP) Simplex Method 1. The Th standard t d d form f of f LP problem bl i. All the constraints should be expressed as equations by slack or surplus and/or artificial variables ii ii. The right hand side of each constraint should be made non-negative; if it is not, this should be done by multiplying both sides of the resulting constraint by -1 Example:
2X1+3X2-4X3+X4 -50, that gives -2X1-3X2+4X3-X4 50
iii Three iii. Th types of f additional ddi i l variables, i bl namely l a. Slack Variable (S) b. Surplus variable (-S), and c. Artificial variables (A) are added in the given LP problem to convert it into standard form for two reasons: To convert an inequality into equation to have a standard form of an LP model, model and To get an initial feasible solution represented by the columns of an identity matrix. matrix
AmareMatebu(Dr.) BDUIOT
4. (LP) Simplex Method The summery of the extra variables needed to add in the given LP problem to convert it into standard form is given below.
Types of constraint Extra variables to be added Coefficient of extra variables in the objective function Max Z Min Z 0 0 -M -M 0 0 +M +M Presence of variables in the initial solution mix Yes No Yes Yes
Add only slack variable Subtract surplus variable and Add artificial variable
AmareMatebu(Dr.) BDUIOT
4. (LP) Simplex Method Some Definitions S D fi iti Solution: pertains to the values of decision variables that satisfies constraints Feasible solution: Any solution that also satisfies the non negativity restrictions Basic Solution: For a set of m simultaneous equations in n unknowns (n>m), a solution obtained by setting n n- m of the variables equal to zero and solving the m equation in m unknowns is called basic solution. solution
Amare Matebu (Dr.) BDUIOT
Basic Feasible solution: A feasible solution that is also basic Optimum Feasible solution: Any basic feasible solution which optimizes the objective function g Solution: when one or more basic Degenerate variable becomes equal to zero. 2 Test of optimality 2.
i. If all Zj - Cj > 0, then the basic feasible solution is optimal ti l (Maximization (M i i ti case) ) ii. If all Zj - Cj < 0, then the basic feasible solution is optimal (Minimization case)
AmareMatebu(Dr.) BDUIOT
4. (LP) Simplex Method 3. Variable to enter the basis i. A variable that has the highest g negative g value in the Zj-Cj row (Maximization case) ii A variable that has the most positive value in ii. the Zj-Cj row(Minimization case) 4. Variable to leave the basis The row with the worst negative/largest positive and minimum replacement ratio (or both maximization & minimization cases respectively). respectively)
AmareMatebu(Dr.) BDUIOT
Example:1 E l 1 Solve the problem using the simplex approach Max. Z=300x1 +250x2 Subject to: 2x1 + x2 < 40 (Labor ) x1+3x 3 2 < 45 (M (Machine) hi ) x1 < 12 (Marketing) x1, x 2 > 0 Example:2 Simplex Method
AmareMatebu(Dr.) BDUIOT
5. Big M-method
Mi i i Z with Minimize ith inequalities i liti of f constraints t i t in i > form. There are two methods to solve minimization LP problems: bl 1. Direct method/Big M-method/: Using artificial variables 2 Conversion method: Minimization by maximizing 2. the dual
AmareMatebu(Dr.) BDUIOT
Surplus Variable (-s): - A variable inserted in a greater than or equal to constraint to create equality. It represents the amount of resource usage above the minimum required usage. - Surplus variable is subtracted from a > constraint in the process of converting the constraint to standard form. Neither the slack nor the surplus is negative value. They must be positive or zero.
AmareMatebu(Dr.) BDUIOT
5. Big M-method
E Example: l let l us consider id 5x 5 1+2x 2 2 20 When x1 = 4.5 and x2 = 2 ==>5(4.5)+2(2)-s = 20 ==> s=11 When x1= 2 and x2= 5 ==> s= 0 But when x1= 0 and x2= 0 ( (No p production) ) ==> s = -20 (This is mathematically unaccepted). Thus, , in order to avoid the mathematical contradiction, , we have to add artificial variable (A) Artificial variable (A): Artificial variable is a variable that has no meaning in a physical sense but acts as a tool to create an initial feasible LP solution. solution
Amare Matebu (Dr.) BDUIOT
Note that: Type of constrain To put into standard form ----------------------- Add a slack variable = ----------------------- Add an artificial variable ---------------------- Subtract a surplus variable & add artificial variable
AmareMatebu(Dr.) BDUIOT
5. Big M-method
Following are the characteristics of Big-M Method: 1. High penalty cost (or profit) is assumed as M 2. M is assigned to artificial variable A in the objective j function Z.
3. Big-M g method can be applied pp to minimization as well as maximization problems with the f ll i distinctions: following di ti ti Minimization problems: -Assign +M as coefficient of artificial variable A in an objective function Z. Maximization M i i ti problems: bl -Here H M M is i assigned ig d as coefficient of artificial variable A in the objective function Z.
AmareMatebu(Dr.) BDUIOT
5. Big M-method
4. Coefficient of S (slack/surplus) takes zero values in the objective function Z 5. For minimization problem, the incoming variable corresponds to a highest positive value of Zj- Cj. 6. Solution is optimal when all the values of Zj- Cj non positive (For minimization case)
AmareMatebu(Dr.) BDUIOT
Example 2 : Big - method Minimize Z= 25x1 +30x2 Subject to: 20x1+15x2 > 100 2x1+ 3x2 > 15 x1, x2 >0
AmareMatebu(Dr.) BDUIOT
6. Duality and Sensitivity Every LP has another LP associated with it, which is called ll d its it dual. d l The Th first fi t way of f starting t ti a linear li problem is called the primal of the problem. The second way of starting the same problem is called the dual. dual The optimal solutions for the primal and the dual are equivalent, but they are derived through alternative procedures.
AmareMatebu(Dr.) BDUIOT
The dual contains economic information useful to management, g , and it may y also be easier to solve, , in terms of less computation than the primal problem. Corresponding p g to every y LP, there is another LP. The given problem is called the primal. The Th related l t d problem bl t the to th given i problem bl i is known as the dual.
AmareMatebu(Dr.) BDUIOT
The dual of a dual is the primal If the primal has optimal solution ,the dual will have optimal solution If the primal has no optimal solution, the dual will not have optimal solution. Whether we follow the dual or primal system, the optimal solution will remain equal.
AmareMatebu(Dr.) BDUIOT
Coefficient of objective function RHS value RHS values Coefficient of objective function
AmareMatebu(Dr.) BDUIOT
Finding the Dual of an LP Define the variables for a max problem to be z, x1, x2, ,x xn and the variables for a min problem to be w, y1, y2, , yn. Finding the dual to a max problem in which all the variables are required to be nonnegative and all the constraints are constraints ( (called normal max problem) is shown on the next slide.
AmareMatebu(Dr.) BDUIOT
Economic Interpretation of the Dual Problem The first dual constraint is associated with desks, the second with tables, and the third with chairs. Decision variable y1 is associated with Timber, y2 with finishing hours, and y3 with carpentry hours. Suppose an entrepreneur wants to purchase all of Dakotas resources. The entrepreneur must determine the price he or she is willing to pay for a unit of each of Dakotas resources.
AmareMatebu(Dr.) BDUIOT
To determine these prices we define: y1 = price paid for 1 boards ft of lumber y2 = price paid for 1 finishing hour y3 = price paid for 1 carpentry hour The resource prices y1, y2, and y3 should be determined by solving the Dakota dual. dual
The total price that should be paid for these resources is 48 y1 + 20y2 + 8y3. Since the cost of purchasing the resources is to minimized: Min w = 48y1 + 20y2 + 8y3 is the objective function for Dakota dual. In setting resource prices, the prices must be high enough to induce Dakota to sell. sell
AmareMatebu(Dr.) BDUIOT
For example, the entrepreneur must offer Dakota at least $60 for a combination of resources that includes 8 board feet of timber, 4 finishing hours, and 2 carpentry hours because Dakota could, if it wished, i h d use the h resources to produce d ad desk k that h could be sold for $60. Since the entrepreneur is offering 8y1 + 4y2 + 2y3 for the resources used to produce a desk desk, he or she must chose y1, y2, and y3 to satisfy: 8y1 + 4y2 + 2y3 60.
AmareMatebu(Dr.) BDUIOT
produce one chair. combination of resources used to p Thus y1, y2, and y3 must satisfy: y1 + 1.5y2 + 0.5y3 20 Th solution The l i to the h Dakota D k d l yields dual i ld prices i f for timber, finishing hours, and carpentry hours.
AmareMatebu(Dr.) BDUIOT
In summary, when the primal is a normal max problem, the dual variables are related to the value of resources available to the decision maker. maker resource shadow prices. For this reason, dual variables are often referred to as
AmareMatebu(Dr.) BDUIOT
6.2 Sensitivity Analysis In an LP model, the input data (also known as parameters) such as: i) Profit (cost) contribution Cj per unit of decision variable ii) Availability of resources (bj) iii) Consumption of resources per unit of decision variables (aij) are assumed constant and known with certainty y during gap planning gp period.
AmareMatebu(Dr.) BDUIOT
However, in real-world situations some data may y change over time because of the dynamic nature of f business: b i such h changes h i any of in f these th parameters may raise doubt on the validity of the optimal solution of the given LP model. Thus, Th th decision the d i i maker k in i such h situation it ti would ld like to know how sensitive the optimal solution is to the changes in the original input data values.
AmareMatebu(Dr.) BDUIOT
Sensitivity
analysis
and
parametric
linear
programming are the two techniques that evaluate the relationship between the optimal solution and the changes g in the LP model parameters. Sensitivity analysis is the study of sensitivity of the optimal p solution of an LP p problem due to discrete variations (changes)in its parameters.
AmareMatebu(Dr.) BDUIOT
The degree of sensitivity of the solution due to these variations can range from no change at all to a substantial change in the optimal solution of the given LP problem. Thus, in sensitivity analysis, we determine the range over which the LP model parameters can change without affecting the current optimal solution.
AmareMatebu(Dr.) BDUIOT
Example: Sensitivity analysis A company wants to produce three products: A, B and d C. C the th unit it profit fit on these th products d t is i Birr Bi 4, 4 Birr 6, and Birr 2 respectively. These products require two types of resources, human power and raw material. material The LP model formulated for determining the optimal product mix is as follows:
AmareMatebu(Dr.) BDUIOT
Example: Sensitivity analysis Maximize Z = 4x1 + 6x2 + 2x3 Subject j to the constraints: i) Human power constraint X1 + X2 +X3 3 ii) ) Raw material constraint X1 + 4X2 + 7X3 9 and d X1, X2, X3 0
Where X1, X2, and X3 = number of units of product A, B and C, respectively to be produced.
AmareMatebu(Dr.) BDUIOT
a. Find the optimal product mix and the corresponding profit of f the th company. b. Find the range of the profit contribution of product C (i.e coefficient C3 of variable X3) in the objective function such that current optimal product mix remains unchanged. unchanged c. What shall be the new optimal product mix when the profit p p per unit from p product C is increased from Birr 2 to Birr 10? d. Find the range of the profit contribution of product A (i.e coefficient C1 of variable X1) in the objective function such that current optimal product mix remains unchanged.
AmareMatebu(Dr.) BDUIOT