1.21k likes | 1.65k Views
Operations Research First Year Computer. Text Book: Operations Research 8 th Edition Hamdy A. Taha. Course Outline Part1: Deterministic Models Chapter 2: Introduction to Linear Programming 2.1 Introduction. 2.2 Construction of the LP Model. 2.3 Graphical LP Solution.
E N D
Operations ResearchFirst Year Computer Text Book: Operations Research 8thEdition Hamdy A. Taha
Course Outline Part1: Deterministic Models Chapter 2: Introduction to Linear Programming 2.1 Introduction. 2.2 Construction of the LP Model. 2.3 Graphical LP Solution. 2.3.1 Solution of a Maximization Model. 2.3.2 Solution of a Minimization Model. 2.3.3 Slack, Surplus, and Unrestricted Model. 2.4 Graphical Sensitivity Analysis. 2.4.1 Changes in the Objective Function Coefficient. 2.4.2 Unit Worth of a Resource. 2.5 Computer Solution of Linear Programming Problems. 2.6 Analysis of Selected Linear Programming Model. Dr.Farouk Sha'ban
Chapter 3: The Simplex Method 3.1 Introduction. 3.2 Standard Linear Programming Form and Its Solutions. 3.2.1 Standard Linear Programming Form. 3.2.2 Determination of Basic Solutions. 3.2.3 Unrestricted Variables and Basic Solution. 3.3 The Simplex Algorithm. 3.4 Simplex Method Application. 3.5 Special Cases in Simplex Method Application. 3.5.1 Degeneracy. 3.5.2 Alternative Optima. 3.5.3 Unbounded Solution. 3.5.4 Infeasible Solution. Dr.Farouk Sha'ban
Chapter 4: Duality. 4.1 Introduction. 4.2 Definition of the Dual Problem. 4.3 Relationship between the Optimal Primal and Dual. Chapter 5: Transportation Model. 5.1 Definition of the Transportation Model. 5.3 The Transportation Algorithm. 5.3.1 Determination of the Starting Solution. 5.3.2 Iterative Computation of the Algorithm. 5.4 The Assignment Model. Dr.Farouk Sha'ban
Chapter 6: Network Models 6.1 Scope of Network Application. 6.2 Network Definitions. 6.3 Minimal Spanning Tree Algorithm. 6.4 Shortest Route Problem. 6.5 Maximal Flow Model. 6.7 CPM and PERT. 6.7.1 Network Representation. 6.7.2 Critical Path Computation. 6.7.3 Construction of the Time Schedule. Dr.Farouk Sha'ban
Introduction Operations Research (OR) It is a scientific approach to determine the optimum (best) solution to adecision problem under the restriction of limited resources.Using the mathematical techniques to model, analyze, and solve the problem. Phases of OR • 1. Definition of the problem includes:- • The description of the decision variables (alternatives) • The determination of the objective of the study • The specification of the limitations under which the modeled system operates. Dr.Farouk Sha'ban
2. Model Construction • Translating the real world problem into mathematical relationships (the most suitable model to represent the system, LP, dynamic programming, integer programming, ………..) • 3.Solution of the model • Using well-defined optimization techniques. • An important aspect of model solution is sensitivity analysis. Dr.Farouk Sha'ban
4.Model validity • Testing and evaluation of the model. A common method for testing a validity of a model is to compare its performance with some past data available for the actual system. • 5.Implementation of the solution • Implementation of the solution of validated model involves the translation of the model's results into instructions issued in understandable form to the individual Dr.Farouk Sha'ban
Basic components of the model • 1.Decision Variables • It is the unknown to be determined from the solution of a model (what does the model seek to determine). It is one of the specific decisions made by a decision maker (DM). • 2.Objective Function • It is the end result (goal) desired to be achieved by the system. A common objective is to maximize profit or minimize cost. It is expressed as a mathematical function of the system decision variables. Dr.Farouk Sha'ban
3.Constraints • These are the limitations imposed on the variables to satisfy the restriction of the modeled system. They must be expressed as mathematical functions of the system decision variables (D.V.). Dr.Farouk Sha'ban
Example 1: • A company manufactures two products A&B. with profit 4 & 3 units. A&B take 3&2 minutes respectively to be machined. The total time available at machining department is 800 hours (100 days or 20 weeks). A market research showed that at least 10000 units of A and not more than 6000 units of B are needed. It is required to determine the number of units of A&B to be produced to maximize profit. Dr.Farouk Sha'ban
Problem Formulation Decision variables X1= number of units produced of A. X2= number of units produced of B. • Objective Function Maximize Z= 4 X1 + 3 X2 Constraints 3 X1 + 2 X2 <= 800x60 X1 >=10000 X2 <=6000 X1, X2 >=0 Dr.Farouk Sha'ban
Example 2: Feed mix problem • A farmer is interested in feeding his cattle at minimum cost. • Two feeds are used A&B. Each cow must get at least 400 grams/day of protein, at least 800 grams/day of carbohydrates, and not more than 100 grams/day of fat. Given that A contains 10% protein, 80% carbohydrates and 10% fat while B contains 40% protein, 60% carbohydrates and no fat. A costs 2 L.E/kg, and B costs 5 L.E/kg. Formulate the problem to determine the optimum amount of each feed to minimize cost. Dr.Farouk Sha'ban
Problem Formulation Decision variables X1= weight of feed A kg/day/animal X2= weight of feed B kg/day/animal • Objective Function Minimize Z= 2 X1 + 5 X2 Constraints Protein0.1 X1 + 0.4 X2 >=0.4 Carbohydrates 0.8 X1 + 0.6 X2 >=0.8 Fats 0.1 X1<= 0.1 X1, X2>=0 Dr.Farouk Sha'ban
Problem Formulation • Decision variables • X1= weight of feed A kg/day/animal • X2= weight of feed B kg/day/animal • Objective Function • Minimize Z= 2 X1 + 5 X2 Constraints Dr.Farouk Sha'ban
Example 3: Blending Problem An iron ore from 4 mines will be blended. The analysis has shown that, in order to obtain suitable tensile properties, minimum requirements must be met for 3 basic elements A, B, and C. Each of the 4 mines contains different amounts of the 3 elements (see the table). Formulate to find the least cost blend for one ton of iron ore. Dr.Farouk Sha'ban
Problem Formulation Decision variables • X1= Fraction of ton to be selected from mine number 1 • X2= Fraction of ton to be selected from mine number 2 • X3= Fraction of ton to be selected from mine number 3 • X4= Fraction of ton to be selected from mine number 4 Objective Function Minimize Z= 800 X1 + 400 X2 + 600 X3 + 500 X4 Constraints 10 X1 + 3 X2 + 8 X3 + 2X4>= 5 90 X1 + 150 X2 + 75 X3 + 175 X4 >= 10 45 X1 + 25 X2 + 20 X3 + 37 X4>= 30 X1 + X2 + X3 + X4 = 1 X1, X2, X3, X4 >= 0 Dr.Farouk Sha'ban
Example 4: Inspection Problem A company has 2 grades of inspectors 1&2. It is required that at least 1800 pieces be inspected per 8 hour/day. Grade 1 inspectors can check pieces at the rate of 25 per hour with an accuracy of 98%. Grade 2 inspectors can check at the rate of 15 pieces per hour with an accuracy of 95%. Grade 1 costs 4 L.E/hour, grade 2 costs 3 L.E/hour. Each time an error is made by an inspector costs the company 2 L.E. There are 8 grade 1 and 10 grade 2 inspectors available. The company wants to determine the optimal assignment of inspectors which will minimize the total cost of inspection/day. Dr.Farouk Sha'ban
Problem Formulation Decision variables X1= Number of grade 1 inspectors/day. X2= Number of grade 2 inspectors/day. Objective Function Cost of inspection = Cost of error + Inspector salary/day Cost of grade 1/hour = 4 + (2 X 25 X 0.02) = 5 L.E Cost of grade 2/hour = 3 + (2 X 15 X 0.05) = 4.5 L.E Minimize Z= 8 (5 X1 + 4.5 X2) • = 40 X1 + 36 X2 Constraints X1 <= 8 X2 <= 10 8(25) X1+ 8(15) X2 >= 1800 200 X1 + 120 X2 >= 1800 X1, X2 >=0 Dr.Farouk Sha'ban
Example 5: Trim-loss Problem. A company produces paper rolls with a standard width of 20 feet. Each special customer orders with different widths are produced by slitting the standard rolls. Typical orders are summarized in the following tables. Possible knife settings Dr.Farouk Sha'ban
Formulate to minimize the trim loss and the number of rolls needed to satisfy the order. Dr.Farouk Sha'ban
Problem Formulation Decision variables Xj = Number of standard rolls to be cut according to setting j j = 1, 2, 3, 4, 5, 6 Number of 5 feet rolls produced = 2 X2 + 2 X3 + 4 X4 + X5 Number of 7 feet rolls produced = X1 + X2+ 2 X5 Number of 9 feet rolls produced = X1 + X3+ 2 X6 Let Y1, Y2, Y3 be the number of surplus rolls of the 5, 7, 9 feet rolls thus Y1= 2 X2 + 2 X3 + 4 X4 + X5 - 150 Y2= X1 + X2+ 2 X5 - 200 Y3= X1 + X3+ 2 X6 - 300 The total trim losses = L (4X1 +3 X2+ X3 + X5 + 2 X6 + 5Y1+ 7Y2+ 9Y3) Where L is the length of the standard roll. Objective Function Minimize Z= L(4X1 +3 X2+ X3 + X5 + 2 X6 + 5Y1+ 7Y2+ 9Y3) Constraints 2 X2+ 2 X3+ 4 X4+ X5 - Y1 = 150 X1+ X2 +2X5 - Y2 = 200 X1+ X3 + 2 X6 - Y3 = 300 X1, X2, X3, X4, X5, X6 >= 0 • Y1, Y2, Y3 >= 0 Dr.Farouk Sha'ban
General form of a LP problem with m constraints and n decision variables is: Maximize Z = C1X1+ C2X2+ …………………. + CnXn Constraints A11X1 + A12X2+……………………+ A1nXn <= B1 A21X1 + A22X2+……………………+ A2nXn <= B2 . . . . Am1X1 + Am2X2+……………………+ AmnXn <= Bm X1, X2, ……………………………………, Xn >= 0 Dr.Farouk Sha'ban
OR Maximize Z= Σnj=1CjXj Constraints • Σnj=1aijXi <= bi Xi >=0 i = 1, …., m j = 1, …., n Where n = Number of activities. Xj= Level of activity j Cj =Contribution of the objective function/unit of activity j m = Number of resources Bi = Amount of resource i available. Aij=Amount of resource i consumed by one unit of activity j • Other forms • Minimize Z= Σnj=1 CjXj • Σnj=1 AijXi >= Bi for some values of i • Σnj=1AijXi = Bi for some values of i • Xi unrestricted in sign for some values of i Dr.Farouk Sha'ban
Terminology of solutions for a LP model: A Solution Any specifications of values of X1, X2, ………, Xn is called a solution. A Feasible Solution Is a solution for which all the constraints are satisfied. An Optimal Solution Is a feasible solution that has the most favorable value of the objective function (largest for maximize or smallest for minimize). Dr.Farouk Sha'ban
Note • If there is exactly one optimal solution it must be a corner point feasible solution. • If there are multiple optimal solutions, then at least two of them must be adjacent corner- point feasible solutions. Two corner-point feasible solutions are said to be adjacent if the line segment connecting them lies on the boundary of the feasible region (one of the constraints). Dr.Farouk Sha'ban
Graphical Solution Construction of the LP model Example 1: The Reddy Mikks Company Reddy Mikks produces both interior and exterior paints from two raw materials, M1&M2. The following table provides the basic data of the problem. Dr.Farouk Sha'ban
A market survey indicates that the daily demand for interior paint cannot exceed that of exterior paint by more than 1 ton. Also, the maximum daily demand of interior paint is 2 ton. Reddy Mikks wants to determine the optimum (best) product mix of interior and exterior paints that maximizes the total daily profit. Dr.Farouk Sha'ban
Problem Formulation Decision variables X1= Tons produced daily of exterior paint. X2= Tons produced daily of interior paint. Objective Function Maximize Z= 5 X1 + 4 X2 Constraints 6 X1+4 X2 <= 24 X1 +2 X2 <= 6 - X1+X2 <= 1 X2 <= 2 • X1, X2 >=0 • Any solution that satisfies all the constraints of the model is a feasible solution. For example, X1=3 tons and X2=1 ton is a feasible solution. We have an infinite number of feasible solutions, but we are interested in the optimum feasible solution that yields the maximum total profit. Dr.Farouk Sha'ban
Graphical Solution • The graphical solution is valid only for two-variable problem which is rarely occurred. • The graphical solution includes two basic steps: • The determination of the solution space that defines the feasible solutions that satisfy all the constraints. • The determination of the optimum solution from among all the points in the feasible solution space. Dr.Farouk Sha'ban
. ABCDEF consists of an infinite number of points; we need a systematic procedure that identifies the optimum solutions. The optimum solution is associated with a corner point of the solution space. Dr.Farouk Sha'ban
To determine the direction in which the profit function increases we assign arbitrary increasing values of 10 and 15 5 X1 + 4 X2=10 And 5 X1 + 4 X2=15 The optimum solution is mixture of 3 tons of exterior and 1.5 tons of interior paints will yield a daily profit of 21000$. Dr.Farouk Sha'ban
Example 2: The Diet Problem Farm uses at least 800lb of special feed daily. The special feed is a mixture of corn and soybean with the following composition. The food mixture must contain at least 30% protein and at most 5% fiber. They want to determine the daily minimum cost feed mix. Dr.Farouk Sha'ban
Problem Formulation Decision variables X1= lb of corn in the daily mix. X2= lb of soybean in the daily mix. Objective Function Minimize Z= 0.3 X1 + 0.9 X2 Constraints X1+X2>= 800 0.09X1+0.6 X2 >= 0.3(X1+X2) = -0.21X1+0.3 X2 >= 0 0.02X1+0.06 X2 <= 0.05(X1+X2) = 0.03X1-0.01 X2 >= 0 X1, X2 >= 0 Dr.Farouk Sha'ban
Slack, Surplus, and Unrestricted variables Slack Variable: • For constraints of the type (<=) the R.H.S normally represents the limit on the availability of a resources and the L.H.S represents the usage of this limited resource by the different activities (variables) of the model. • A slack represents the amount by which the available amount of the resource exceeds its usage by the activities. • For example (6 X1+4 X2<= 24) is equivalent to • (6 X1+4 X2 + S1= 24) provided that S1>=0. • The slack variable S1=24-6 X1-4 X2 represents the unused amount of raw material M1. Dr.Farouk Sha'ban
Surplus Variable: • It is used in the constraints of type (>=) normally set minimum specification requirements. • Surplus represents the excess of the L.H.S over the minimum requirement. • For example (X1+X2 >= 800) is equivalent to (X1+X2 - S1= 800) provided that S1>=0, this signifies that a surplus amount of feed over the minimum requirement will be produced. Unrestricted Variable: The variable which can be positive or negative. Dr.Farouk Sha'ban
The Simplex Method Introduction • It is a general algebraic method to solve a set of linear equations. • We use simplex method to get extreme (or corner) point solution. • We must first convert the model into the standard LP form by using slack or surplus variables to convert the inequality constraints into equations. • Our interest in the standard LP form lies in the basic solutions of the simultaneous linear equations. Dr.Farouk Sha'ban
Standard LP Form and its Basic Solution Example 1: Express the following LP model in standard form. Maximize Z= 2X1 + 3 X2 + 5X3 S.T X1 + X2 - X3 >= -5 -6X1+ 7X2 - 9X3 <= 4 X1+ X2 + 4X3 = 10 X1, X2 >= 0 • X3 unrestricted = X+3 - X-3 • where X+3 , X-3 Standard LP form Maximize Z= 2X1 + 3 X2 + 5 X+3 - 5 X-3 S.T -X1 - X2 + 3 X+3 - 3 X-3 + X4= 5 -6X1+ 7X2 - 9 X+3 + 9 X-3+ X5= 4 X1+ X2 + 4X+3 - 4 X-3 = 10 X1, X2, X+3, X-3, X4, X5>=0 Dr.Farouk Sha'ban
Determination of basic solutions The standard LP form includes m simultaneous linear equations in n unknowns or variables (m<n). We divide the n variables into 2 sets: • (n-m) variables to which we assign zero values which are called • non-basic variables. • Remaining m variables whose values are determined by solving the resulting m equations which is called • basic variables. The resulting solution is Basic Solution(BS). If all values are satisfying non- negativity then resulting BS is Feasible Basic Solution(BFS), otherwise, it is infeasible. The maximum number of possible basic solution for m equations in n unknowns is Dr.Farouk Sha'ban
Example 2: Maximize Z= 5X1 + 6 X2 S.T 2X1 + 3X2 >= 18 2X1 +X2 <= 12 3X1 + 3X2 = 24 X1, X2 >=0 Standard LP form Maximize Z=5X1 + 6X2 S.T 2X1 +3X2 + X3 = 18 2X1 + X2 + X4 = 12 3X1 + 3X2 + X5 = 24 X1, X2, X3, X4, X5 >=0 Dr.Farouk Sha'ban
The basic feasible solutions are the corner points Dr.Farouk Sha'ban
The Simplex Algorithm We solve the Reddy Mikks model, where X1= Tons produced daily of exterior paint. X2= Tons produced daily of interior paint. Exterior and interior paints are produced from two types of raw materials M1 and M2 Maximize Z- 5 X1 - 4 X2 + 0 X3 + 0 X4 + 0 X5 +0 X6 = 0 S.T. 6 X1+4 X2 + X3 <= 24 X1 +2 X2 + X4 <= 6 - X1+ X2 + X5 <= 1 X2 + X6 <=2 X1, X2, X3, X4, X5, X6 >=0 The variables X3, X4, X5, X6 are the slacks associated with the four (<=) constraints. Dr.Farouk Sha'ban
The Starting Basic Feasible Solution is Is the starting solution optimal? No, since the coefficients of X1 and X2 are still negative so they can increase the profit of Z. We choose X1 with more negative (-5) i.e.; X1 is the entering variable. Dr.Farouk Sha'ban
Since none of the Z-row coefficients associated with the non-basic variables X3, X4 is negative the last table is optimal. Dr.Farouk Sha'ban
The rules for selecting the entering and leaving variables are referred to as the optimality and feasibility conditions (a) Optimality conditions: The entering variable in maximization (minimization) problem is the non-basic variable having the most negative (positive) coefficient in the Z-row. Ties are broken arbitrarily. The optimum is reached at the iteration where all the Z-row coefficients of the non-basic variables are non-negative (non-positive) (b) Feasibility Condition: for both the maximum and minimum problems the leaving variables is the basic variables associated with the smallest non-negative ratio. Ties are broken arbitrarily. The steps of the simplex method are: • Determine a starting basic feasible solution • Select an entering variable using the optimality condition. Stop if there is no entering variable. • Select a leaving variable using the feasibility condition. • Determine the new basic solution by using the appropriate Gauss-Jordan computation. • Go to step 1 Dr.Farouk Sha'ban
Special Cases in Simplex Method • Degeneracy • Alternative optima (Infinity of Solution) • Unbounded Solution • Non-existing or Infeasible Solution • 1) Degeneracy one or more basic variable(s) has zero value. If you find more than one leaving variable (i.e.; we have two or more variables having the same ratio in the R.H.S) so one or more of the basic variable(s)will be equal zero in the next iteration. This condition indicates that the model has at least one redundant constraint. Dr.Farouk Sha'ban
Example 1: Maximize Z= 3 X1 + 9X2 X1 +4 X2 <= 8 X1 +2 X2 <= 4 X1, X2 >=0 Standard LP form Maximize Z=3X1 + 9X2 S.T X1 +4X2 + X3 = 8 X1 + 2X2 + X4 = 4 X1, X2, X3, X4 >=0 Dr.Farouk Sha'ban
X1=0, X2 =2, X3 =0, X4=0, Z=18 Is it possible to stop at the second iteration (when degeneracy first appears) even though it is not optimum? The answer is NO, because the solution may be temporarily degenerate. Dr.Farouk Sha'ban
2) Alternative optima (Infinity ofSolution): When the objective function is parallel to a binding constraint. So the objective function (Z) will have the same optimal value at more than one solution point. Example 2: Maximize Z= 2 X1 + 4 X2 X1+ 2X2 <= 5 X1 + X2 <= 4 X1,X2 >=0 Standard LP form Maximize Z=2X1 + 4X2 S.T X1+2X2+ X3 = 8 X1+ X2+ X4= 4 X1, X2, X3, X4>=0 Dr.Farouk Sha'ban