Excel Solver

Post on 11-Aug-2015

110 views 1 download

Tags:

description

Solve LP With Excel

Transcript of Excel Solver

EXCEL SOLVER EXCEL SOLVER for LINEAR for LINEAR

PROGRAMMINGPROGRAMMING

Mathematics Department

Ateneo de Zamboanga University

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.

Basic Steps in the Linear Programming Model

Formulation

1. Determine the decision variables.

2. Formulate the objective function.

3. Formulate the constraints.

General Form of a Linear Programming Model

Example

Objective Function

Constraints

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

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.

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

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.

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

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

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

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

Excel

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

Excel

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

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

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

Solver Answer Report

Conclusion3rd iteration

Sensitivity Report

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

We change the objective function to:

max z=7.5x1 + 7x2

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

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

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)

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

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

We change the RHS values to:

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

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

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.

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

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

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

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

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

max z - 3x1 - 5x2 = 0

subject to: x1 + s1 = 4

2x2 + s2 = 12

3x1+ 2x2 + s3 = 18

Simplex

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

Step 3

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.

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

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.

What are Constraints?Constraints are equalities or

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

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.

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.

What is a slack variable ?

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

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

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

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

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

Thank you!!!