Presentation on theme: "Part 3IE 3121 Solving LP Models Improving Search Unimodal Convex feasible region Should be successful! Special Form of Improving Search Simplex method."— Presentation transcript:
Part 3IE 3121 Solving LP Models Improving Search Unimodal Convex feasible region Should be successful! Special Form of Improving Search Simplex method (now) Interior point methods (later)
Part 3IE 3122 Simple Example Top Brass Trophy Company Makes trophies for football wood base, engraved plaque, brass football on top $12 profit and uses 4 ’ of wood soccer wood base, engraved plaque, soccer ball on top $9 profit and uses 2 ’ of wood Current stock 1000 footballs, 1500 soccer balls, 1750 plaques, and 4800 feet of wood
Part 3IE 3123 Formulation
Part 3IE 3124 Graphical Solution Optimal Solution
Part 3IE 3125 Feasible Solutions Feasible solution is a boundary point if at least one inequality constraint that can be strict is active interior point if no such constraints are active Extreme points of convex sets do not lie within the line segment of any other points in the set
Part 3IE 3126 Example
Part 3IE 3127 Optimal Solutions Every optimal solution is a boundary point We can find an improving direction whenever we are at an interior point If optimum unique the it must be an extreme point of the feasible region If optimal solution exist, an optimal extreme point exists
Part 3IE 3128 LP Standard Form Easier if we agree on exactly what a LP should look like Standard form only equality main constraints only nonnegative variables variables appear at most once in left-hand- side and objective function all constants appear on right hand side
Part 3IE 3129 Converting to Standard Inequality constraints Add nonnegative, zero-cost slack variables Add in inequalities Subtract in inequalities Variables not nonnegative nonpositive - substitute with negatives unrestrictive sign (URS) - substitute difference of two nonnegative variables
Part 3IE Top Brass Model
Part 3IE Why? Feasible directions Check only if active Keep track of active constraints Equality constraints Always active Inequality constraints May or may not be active Prefer equality constraints!
Part 3IE Standard Notation
Part 3IE LP Standard Form In standard notation In matrix notation
Part 3IE Write in Matrix Form
Part 3IE Extreme Points Know that an extreme point optimum exists Will search trough extreme points An extreme point is define by a set of constraints that are active simultaneously
Part 3IE Improving Search Move from one extreme point to a neighboring extreme point Extreme points are adjacent if they are defined by sets of active constraints that differ by only one element An edge is a line segment determined by a set of active constraints
Part 3IE Basic Solutions Extreme points are defined by set of active nonnegativity constraints A basic solution is a solution that is obtained by fixing enough variable to be equal to zero, so that the equality constraints have a unique solution
Part 3IE Example Choose x 1, x 2, x 3, x 4 to be basic
Part 3IE Where is the Basic Solution?
Part 3IE Example Compute the basic solution for x 1 and x 2 basis: Solve
Part 3IE Existence of Basis Solutions Remember linear algebra? A basis solution exists if and only if the columns of corresponding equality constraint form a basis (in other words, a largest possible linearly independent collection)
Part 3IE Checking The determinant of a square matrix D is A matrix is singular if its determinant = 0 and otherwise nonsingular Need to check that the matrix is nonsingular
Part 3IE Example Check whether basic solutions exist for
Part 3IE Basic Feasible Solutions A basic feasible solution to a LP is a basic solution that satisfies all the nonnegativity contraints The basic feasible solutions correspond exactly to the extreme points of the feasible region
Part 3IE Example Problem Suppose we have x 3, x 4, x 5 as slack variables in the following LP: Lets plot the original problem, compute the basic solutions and check feasibility
Part 3IE Solution Algorithm Simplex Algorithm Variant of improving search Standard display:
Part 3IE Simplex Algorithm Starting point A basic feasible solution (extreme point) Direction Follow an edge to adjacent extreme point: Increase one nonbasic variable Compute changes needed to preserve equality constraints One direction for each nonbasic variable
Part 3IE Top Brass Example Initial solution Basic variables
Part 3IE Looking in All Directions … Must adjust these! Can increase either one of those
Part 3IE So Many Choices... Want to try to improve the objective The reduced cost of a nonbasic variable: Want Defines improving direction
Part 3IE Top Brass Example Improving x 1 gives Improving x 2 gives Both directions are improving directions!
Part 3IE Where and How Far? Any improving direction will do If no component is negative Improve forever - unbounded! Otherwise, compute the minimum ratio
Part 3IE Computing Minimum Ratio
Part 3IE Moving to New Solution
Part 3IE Updating Basis New basic variable Nonbasic variable generating direction New nonbasic variable(s) Basic variables fixing the step size
Part 3IE What Did We Do?
Part 3IE Where Will We Go? Why is this guaranteed? Optimum in three steps!
Part 3IE Simplex Algorithm (Simple) Step 0: Initialization. Choose starting feasible basis, construct basic solution x (0), and set t=0 Step 1: Simplex Directions. Construct directions Dx associated with increasing each nonbasic variable x j and compute the reduced cost c j =c · x. Step 2: Optimality. If no direction is improving, then stop; otherwise choose any direction x (t+1) corresponding to some basic variable x p. Step 3: Step Size. If no limit on move in direction x (t+1) then stop; otherwise choose variable x r such that Step 4: New Point and Basis. Compute the new solution and replace x r in the basis with x p. Let t = t+1 and go to Step 1.
Part 3IE Stopping The algorithm stop when one of two criteria is met: In Step 2 if no improving direction exists, which implies local optimum, which implied global optimum In Step 3 if no limit on improvement, which implies problem is unbounded
Part 3IE Optimization Software Spreadsheet (e.g, MS Excel with What ’ s Best!) Optimizers (e.g., LINDO) Combination Modeling Language Solvers Either together (e.g., LINGO) or separate (e.g., GAMS with CPLEX) LINDO and LINGO are in Room 0010 (OR Lab) Also on disk with your book
Part 3IE LINDO The main software that I ’ ll ask you to use is called LINDO Solves linear programs (LP), integer programs (IP), and quadratic programs (QP) We will look at many of its more advanced features later on, but as of yet we haven ’ t learned many of the concepts that we need
Part 3IE Example
Part 3IE LINDO Program MAX 12 x1 + 9 x2 ST x1 + x2 = 1000 x2 + x4 = 1500 x1 + x2 + x5 = x1+ 2x2 + x6 = 4800 x1>=0 x2>=0 x3>=0 x4>=0 x5>=0 x6>=0 END
Part 3IE 31244
Part 3IE 31245
Part 3IE Output LP OPTIMUM FOUND AT STEP 4 OBJECTIVE FUNCTION VALUE 1) VARIABLE VALUE REDUCED COST X X X X X X
Part 3IE LINDO: Basic Syntax Objective Function Syntax: Start all models with MAX or MIN Variable Names: Limited to 8 characters Constraint Name: Terminated with a parenthesis Recognized Operators (+, -, >, <, =) Order of Precedence: Parentheses not recognized
Part 3IE Syntax (cont.) Adding Comment: Start with an exclamation mark Splitting lines in a model: Permitted in LINDO Case Sensitivity: LINDO has none Right-hand Side Syntax: Only constant values Left-hand Side Syntax: Only variables and their coefficients
Part 3IE Why Modeling Language? More to learn! More ‘ complicated ’ to use than LINDO (at least at first glance) Advantages Natural representations Similar to mathematical notation Can enter many terms simultaneously Much faster and easier to read
Part 3IE Why Solvers? Best commercial software has modeling language and solvers separated Advantages: Select solver that is best for your application Learn one modeling language use any solver Buy 3rd party solvers or write your own!
Part 3IE Example Problem
Part 3IE Problem Formulation
Part 3IE LINDO Solution max 1.60 x x x x4 st x1 + x2 + x3 + x4 <=1200 x1 >= 310 x1 <= 434 x2 >= 245 x2 <= 343 x3 >= 255 x3 <= 357 x4 >= 190 x5 <= 266 end
Part 3IE LINGO Solution Objective function MAX PROFIT*CASES(I)); We also need to define REGIONS, CASES, etc, and type in the data.
Part 3IE LINGO Solution Defining sets SETS: REGIONS / NE SE MW W/: LBOUND, UBOUND, PROFIT, CASES; ENDSETS
Part 3IE LINGO Solution Enter the data DATA: LBOUND = ; UBOUND = ; PROFIT = ; ENDDATA
Part 3IE Sensitivity Analysis Basic Question: How does our solution change as the input parameters change? The objective function? More/less profit or cost The optimal values of decision variables? Make different decisions! Why? Only have estimates of input parameters May want to change input parameters
Part 3IE What We Know Qualitative Answers for All Problems Quantitative Answers for Linear Programs (LP) Dual program Same input parameters Decision variables give sensitivities Dual prices Easy to set up Theory is somewhat complicated
Part 3IE Back to Example Problem
Part 3IE LINDO Formulation max 1.60 x x x x4 st x1 + x2 + x3 + x4 <=1200 x1 >= 310 x1 <= 434 x2 >= 245 x2 <= 343 x3 >= 255 x3 <= 357 x4 >= 190 x5 <= 266 end
Part 3IE Dual Prices The Dual is Automatically Formed Also in LINGO Also in (all) other optimization software Report dual prices Gives us sensitivities to RHS parameter Know how much objective function will change When will the optimal solution change? Need to select that we want sensitivity analysis
Part 3IE LINDO Sensitivity Analysis (part) RANGES IN WHICH THE BASIS IS UNCHANGED: OBJ COEFFICIENT RANGES VARIABLE CURRENT ALLOWABLE ALLOWABLE COEF INCREASE DECREASE X X INFINITY X INFINITY X INFINITY X INFINITY
Part 3IE Interpretation As long as prices for the NE region are between $1.4 and $1.9, we want to sell the same quantity to each region, etc.
Part 3IE Example An insurance company is introducing two new product lines: special risk insurance and mortgages. The expected profit is $5 per unit on special risk insurance and $2 per unit on mortgages. Management wishes to establish a sales target for the new product lines to maximize the expected profit. The work requirements are as follows:
Part 3IE LINDO Formulation max 5 x1 + 2 x2 st 3 x1 + 2 x2 <= 2400 x2 <= x1 <= 1200 x1 >=0 x2 >=0 end
Part 3IE Graphical Solution
Part 3IE Solution VARIABLE VALUE REDUCED COST X X ROW SLACK OR SURPLUS DUAL PRICES 2) ) ) ) )
Part 3IE Sensitivity Analysis RANGES IN WHICH THE BASIS IS UNCHANGED: OBJ COEFFICIENT RANGES VARIABLE CURRENT ALLOWABLE ALLOWABLE COEF INCREASE DECREASE X INFINITY X RIGHTHAND SIDE RANGES ROW CURRENT ALLOWABLE ALLOWABLE RHS INCREASE DECREASE INFINITY INFINITY INFINITY
Part 3IE New Decisions! Optimum Moves!
Part 3IE What-If ? Solve New Problem max 5 x1 + 2 x2 st 3 x1 + 2 x2 <= 2400 x2 <= x1 <= 1200 x1 >=0 x2 >=0 end
Part 3IE New Solution VARIABLE VALUE REDUCED COST X X ROW SLACK OR SURPLUS DUAL PRICES 2) ) ) ) )
Part 3IE Interior Point Methods Simplex always stays on the boundary Can take short cuts across the interior Interior point methods More effort in each move More improvement in each move Much faster for large problems
Part 3IE Simple Example Frannie ’ s Firewood sells up to 3 cords of firewood to two customers One will pay $90 per half-cord Other will pay $150 per full cord
Part 3IE Graphical Solution
Part 3IE Improving Directions Which direction improves the objective function the most? The gradient Direction:
Part 3IE Most Improving Direction?
Part 3IE Back to Example
Part 3IE Maintaining Feasibility At the initial point all directions are feasible because it is an interior point At the new point we have to make sure that a direction x at x (1) satisfies Interior point algorithms begin inside and move through the interior, reaching the boundary only at an optimal solution
Part 3IE Valid Interior Point Search?
Part 3IE Valid Interior Point Search?
Part 3IE Valid Interior Point Search?
Part 3IE LP Standard Form For Simplex used the form In Frannie ’ s Firewood
Part 3IE Benefits of Standard Form? In Simplex: Made easy to check which variables are basic, non- basic, etc. Needed to know which solutions are on boundary Here quite similar: Know which are not on boundary Check that nonnegativity constraints are strict! A feasible solution to standard LP is interior point if every component is strictly positive
Part 3IE Interior Points?
Part 3IE Projections Must satisfy main equality constraints Want direction x that satisfies this equation and is as nearly d as possible The projection of a vector d onto a system of equalities is the vector that satisfies the constraints and minimizes the total squared difference between the components
Part 3IE Obtaining Projection The projection of d onto A x=0 is where is the projection matrix.
Part 3IE Example: Frannie ’ s Firewood
Part 3IE Example The cost vector is c=( )
Part 3IE Improvement The projection matrix is design to make an improving direction feasible with minimum changes Is it still an improving direction? Yes! The projection x=Pc of c onto Ax=b is an improving direction at every x
Part 3IE Sample Exercise Determine the direction d of most rapid improvement Project it onto the main equality constraints to get x Verify that the move direction x is feasible Verify that the move direction x is improving