Top Banner
SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke
35

SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Dec 16, 2015

Download

Documents

Ashlyn Anguish
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

SOLVING LINEAR PROGRAMS USING EXCEL

Dr. Ron Lembke

Page 2: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Formulating in Excel

1. Write the LP out on paper, with all constraints and the objective function.

2. Decide on cells to represent variables.

3. Enter coefficients of each variable in each constraint in a block of cells.

4. Compute amount of each constraint being used by current solution.

Page 3: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Formulating in Excel

5. Place inequalities in sheet, so you remember <=, >=

6. Enter amount of each constraint

7. Enter objective coefficients

8. Calculate value of objective function

9. Make sure you have plenty of labels.

10. Widen columns for readability.

Page 4: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Standard Form

Max 7x1 + 5x2

s.t. 4x1 + 3x2 <=240

2x1 + 1x2 <=100

x1 >=0

x2 >=0

electronics

assembly

Page 5: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Constraintcoefficients

Current value of variables

Formulating in Excel

Page 6: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Amount of eachconstraint used by current solution

Formulating in Excel

Page 7: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

RHS of constraints,Inequality signs.

Objective Function Coefficients

Formulating in Excel

Objective Function Value

Page 8: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Fancy “What If” Tool

Trial and error Simplifies the math Can’t solve it for us

Page 9: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Solving in ExcelAll we have so far is a big ‘what if” tool. We

need to tell the LP Solver that this is an LP that it can solve.

Choose ‘Solver’ from ‘Tools’ menu

Page 10: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Click “Data” then “Solver”

Page 11: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

If No Solver, Office2010

Page 12: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

If No Solver, Office 2007

Page 13: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Solving in Excel

1. Choose ‘Solver’ from ‘Data’ tab

2. Tell Solver what is the objective function, and which are variables.

3. Tell Solver to minimize or maximize

Page 14: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Solver Dialog BoxSet the Target SellTell to minimize or maximizeWhere the variables are

Page 15: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Solving in Excel

1. Choose ‘Solver’ from ‘Tools’ menu

2. Tell Solver what is the objective function, and which are variables.

3. Tell Solver to minimize or maximize

4. Add constraints: Click ‘Add’, enter LHS, RHS, choose inequality Click ‘Add’ if you need to do more, or click ‘Ok’ if this

is the last one.

5. Add rest of constraints

Page 16: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Add Constraint Dialog Box

Page 17: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Constraints Added

Page 18: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Assuming Linear

6. You have to tell Solver that the model is Linear. Click ‘options,’ and make sure the ‘Assume Linear Model’ box is checked.

Page 19: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Assume Linear

Page 20: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Assuming Linear

6. You have to tell Solver that the model is Linear. Click ‘options,’ and make sure the ‘Assume Linear Model’ box is checked.

On this box, checking “assume non-negative” means you don’t need to actually add the non-negativity constraints manually.

7. Solve the LP: Click ‘Solve.’ Look at Results.

Page 21: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Office 2010

Page 22: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Office 2010 Options

Set maximum time to look for a solution

OR maximum # of iterationsOur problems

should solve quickly

Page 23: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Solution is Found

When a solution has been found, this box comes up.You can choose between keeping the solution and goingback to your original solution.Highlight the reports that you want to look at.

Page 24: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Successful Solution

Page 25: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Optimality Conditions?

0 50 100 150 200

160

40

80

120

0

200

Sweatshirts

T-shirtsT

S

1 2 30

1000200030004000

Dead Profits

Solution #

Each time we go to another solution,Objective value gets better

Page 26: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Optimality Conditions

Simplex method creates “dual” Max has a min dual,

min has a max dual Dual and “primal”

converge to same value

Solution must be optimal

1 2 3 4 5 6 7 8 90

1000

2000

3000

4000

5000

6000

7000

Dead Profits Primal

Solution #

Page 27: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Answer Report

Gives optimal and initial values of objective function

Gives optimal and initial values of variables

Tells amount of ‘slack’ between LHS and RHS of each constraint, tells whether constraint is binding.

Page 28: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Answer Report

Page 29: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Sensitivity Report

Variables: Final value of each variable Reduced cost: how much objective

changes if current solution is changed Objective coefficient (from problem)

Page 30: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Sensitivity Report

Variables: Allowable increase:

How much the objective coefficient can go up before the optimal solution changes.

Allowable decrease:How much the objective coefficient can go down before optimal

solution changes. Both of these only are accurate for changes made to one

variable at a time. If you change more than one variable, need to re-solve the LP.

Suppose t-shirts had increase of $5 decrease $10 Solution is optimal if t-shirt profits are between $15-$30

Page 31: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Sensitivity Report

Constraints Final Value (LHS) Shadow price: how much objective would

change if RHS increased by 1.0 Allowable increase, decrease: how wide a range of

values of RHS shadow price is good for. Also only accurate for changes made to one

constraint at a time To see the impact of changing more than one

constraint, we just have to re-run the problem

Page 32: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Sensitivity Report

Page 33: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Limits Report

Tells ranges of values over which the maximum and minimum objective values can be found.

Rarely useful

Page 34: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Limits Report

Page 35: SOLVING LINEAR PROGRAMS USING EXCEL Dr. Ron Lembke.

Summary

Entered the LP into Excel Opened Solver, told it how we wanted to

solve the LP Interpreting results of Solver Reports

Answer report – basic resultsSensitivity – how much the situation would

change with different profits per unit, or amounts of constraints