52
EXCEL SOLVER EXCEL SOLVER for LINEAR for LINEAR PROGRAMMING PROGRAMMING Mathematics Department Ateneo de Zamboanga University

Excel Solver

Embed Size (px)

DESCRIPTION

Solve LP With Excel

Citation preview

Page 1: Excel Solver

EXCEL SOLVER EXCEL SOLVER for LINEAR for LINEAR

PROGRAMMINGPROGRAMMING

Mathematics Department

Ateneo de Zamboanga University

Page 2: Excel Solver

When someone speaks of "linear programming" they are not referring to programming in the sense that someone speaks of today. When the term was introduced in the 1940's, programming was synonymous with scheduling or planning. Linear programming (LP) is a subcategory of mathematical programming.

Page 3: Excel Solver

Basic Steps in the Linear Programming Model

Formulation

1. Determine the decision variables.

2. Formulate the objective function.

3. Formulate the constraints.

Page 4: Excel Solver

General Form of a Linear Programming Model

Example

Objective Function

Constraints

Page 5: Excel Solver

When solving an LP model we assume that all relevant factors are known with certainty

Sensitivity analysis helps answers questions about how sensitive the optimal solution is to changes in various coefficients in an LP model

Page 6: Excel Solver

The Wyndor Glass Co. problem (Hillier & Lieberman, 1995):

The problem concerns a glass manufacturer which uses three production plants to assemble its products, mainly glass doors (x1) and wooden frame windows (x2). Each product requires different times in the three plants and there are certain restrictions on available production time at each plant.

Page 7: Excel Solver

Data for the Wyndor Glass Co. Problem

$3,000 $5,000

Profit

41218

1 0 0 23 2

123

Production Time

Available per Week, Hours

ProductionTimeProduct

1 2Plant

Page 8: Excel Solver
Page 9: Excel Solver

The best approach to entering the problem into Excel is first to list in a column the names of the objective function, decision variables and constraints. You can then enter starting values in the cells for the decision variables, usually zero.

Page 10: Excel Solver

Setting up the problem in Excel

The objective function in B5 will

be given by : =3*B9+5*B10 The constraints will be given

by:Plant One (B14) =B9 Plant Two (B15) =2*B10Plant Three (B16)

=3*B9+2*B10Non-neg 1 (B17) =B9Non neg 2 (B19) =B10

The right hand side values are entered in adjacent cells

LPInitial Tableau

Page 11: Excel Solver

On selecting the menu option Tools | Solver the dialogue box shown below is revealed, and if you select the objective cell before invoking Solver the correct Target Cell will be identified. This is the value Solver will attempt either to maximize or minimize.

Excel

Page 12: Excel Solver

Next you enter the range of cells you want Solver to vary, the decision variables. Click on the white box and select cells B9 & B10, or alternatively type them in.

Excel

Page 13: Excel Solver

You can now enter the constraints by first clicking the 'Add ..' button. This reveals the dialogue box shown below.

Excel

Page 14: Excel Solver

Having added all the constraints, click 'OK' and the Solver dialogue box should look like the one below.

Excel

Page 15: Excel Solver

Before clicking 'Solve' it is good practice when doing LPs to go into the Options and check the 'Assume Linear Model' box as this allows Solver to provide more sensitivity information. And if you want to see each step of the calculation, check the 'Show Iteration Results' box.

Excel

Page 16: Excel Solver

2nd iterationExcel

After 1 iteration, we have the following solution: x1=0, x2=6 with z=30 whichsatisfy the linear program

max z = 3x1 + 5x2

subject to: x1 <= 4

x2 <= 12 3x1 + 2x2 <= 18

x1, x2 >= 0

Page 17: Excel Solver

We have the following optimum solution:x1=2, x2=6 with z=36 which satisfy the linear program max z = 3x1 + 5x2 subject to: x1 <= 4 x2 <= 12 3x1 + 2x2 <= 18 x1, x2 >= 0

3rd iterationExcel

Page 18: Excel Solver

Solver Answer Report

Conclusion3rd iteration

Page 19: Excel Solver
Page 20: Excel Solver

Sensitivity Report

Page 21: Excel Solver

Changes in Objective Function Coefficients

Values in the “Allowable Increase” and “Allowable Decrease” columns for the Changing Cells indicate the amounts by which an objective function can change without changing the optimal solution, assuming all other coefficients remain constant.

Sensitivity Report

Page 22: Excel Solver

We change the objective function to:

max z=7.5x1 + 7x2

Page 23: Excel Solver

We have the following optimum solution:x1=2, x2=6 with z=57 which satisfy the linear program max z = 7.5x1+ 7x2 subject to: x1 <= 4 x2 <= 12 3x1 + 2x2 <= 18 x1, x2 >= 0

Page 24: Excel Solver

max z=7.5x1 + 7x2max z=3x1 + 5x2

Page 25: Excel Solver

If we change the objective coefficients within the allowable range, the optimum solution does not change.

Hence, max z=7.5x1 + 7x2

57=7.5(2)+7(6)Hence, max z=5x1 + 8x2

58=5(2)+8(6)

Page 26: Excel Solver

Alternate Optimal Solutions

Values of zero (0) in the “Allowable Increase” and “Allowable Decrease” columns for the Changing Cells indicate that an alternate optimal solution exist.

Sensitivity Report

Page 27: Excel Solver

Changes in Constraint RHS Values

The shadow price of a constraint indicates the amount by which the objective function value changes given a unit increase in the RHS value of the constraint, assuming all other coefficients remain constant.

Shadow prices hold only within Right-Hand-Side (RHS) changes falling within the values in “Allowable Increase” and “Allowable Decrease” columns.

Shadow prices for nonbinding constraints are always zero.

Sensitivity Report

Page 28: Excel Solver

We change the RHS values to:

Plant One =4Plant Two = 18Plant Three =24

Page 29: Excel Solver

If we will resolve the problem, we will have an increase of 15 in profit.

Page 30: Excel Solver

If we will change the RHS values within the allowable range, we can obtain the increase or decrease in profit without resolving the problem.

Hence, The increase of 15 in profit is obtained by: 6(1.5)+6(1)

If we will have the following RHS values: Plant Two = 14 and

Plant Three = 22Then the increase is equal to 2(1.5)+4=7 which gives z=43.

However, we do not know how many of each type of product we need to produce. Resolving the problem will give us the new optimal solution.

Page 31: Excel Solver

The new optimal solution is: x1=2 and x2=9 with z=51

Page 32: Excel Solver

Comments About Changes in Constraint

RHS Values Shadow prices only indicate the

changes that occur in the objective function value as RHS values change

Changing a RHS value for a binding constraint also changes the optimal solution

To find the optimal solution after changing a binding RHS value, you must resolve the problem.

Sensitivity Report

Page 33: Excel Solver

amounts objective coefficients can change without changing the solution

the impact on the optimal objective function value of changes in the constraint RHS values

Besides the optimal solution, Solver also produced a sensitivity report which answered questions about

Page 34: Excel Solver

Advantages of the Excel Solver

Most Filipinos are familiar with Excel

Solver provides a simple, yet effective, medium for allowing users to explore linear programs

Solver allows users to explore their models in a structured, yet flexible, way

Page 35: Excel Solver

The Simplex Method

• Put the linear program into standard form.

• Construct the initial simplex tableau with all slack variables in the basic variable set (BVS). The first row in the table contains the coefficients of the objective function.

SF

Page 36: Excel Solver

max z - 3x1 - 5x2 = 0

subject to: x1 + s1 = 4

2x2 + s2 = 12

3x1+ 2x2 + s3 = 18

Simplex

Page 37: Excel Solver

3. If all elements of the first row are non- negative, the tableau is optimal; stop. Otherwise, go to the next step.

4. Determine the entering variable.

5. Determine the leaving variable.

6. Pivot and establish a new tableau.

7. Go to step 3.

The Simplex Method

Solver

Page 38: Excel Solver

Step 3

Page 39: Excel Solver
Page 40: Excel Solver
Page 41: Excel Solver

Given the optimum solution:x1=2 and x2=6 with z=36,

we conclude that the company must produce:

2 batches of doors per week, 6 batches of windows per week

for a maximum profit of $36,000.

Page 42: Excel Solver

What is Mathematical Programming?

Mathematical programming is a term which represents the maximization or minimization of objective functions. The minimization or maximization is done subject to constraints.

Intro

Page 43: Excel Solver

What is an Objective Function?

An objective function is the function of one or more variables that one is interested in either maximizing or minimizing. The function could represent the cost or profit of some manufacturing process.

Page 44: Excel Solver

What are Constraints?Constraints are equalities or

inequalities that describe restrictions involved with the minimization or maximization of the objective function.

Page 45: Excel Solver

What are Decision Variables?

Decision variables are variables which are both under the control of the decision maker and could have an impact on the solution to the problem of interest.

Page 46: Excel Solver

What is Linear Programming?

Linear Programming (LP) is a subcategory of mathematical programming. As the name suggests, both the objective function and the constraints are linear.

Page 47: Excel Solver

What is a slack variable ?

A slack variable is a variable added to the problem to eliminate less-than constraints.

Page 48: Excel Solver

The basic variable set consists of variables with values greater than zero.

Page 49: Excel Solver

The entering variable is the one with the most negative value (In case of a tie, we select the variable that corresponds to the leftmost of the columns) .

Initial Tableau

Page 50: Excel Solver

The leaving variable is the one with smallest non-negative column ratio (to find the column ratios, divide the RHS column by the entering variable column, wherever possible). In case of a tie we select the variable that corresponds to the up-most of the tied rows.

Initial Tableau

Page 51: Excel Solver

Constraints that are satisfied as equalities at a given point are said to be binding.

Page 52: Excel Solver

Thank you!!!