problem is to maximize 2x1 +4x2 +3x3 + x4 subject to: 3x1 + x2 + x3 + 4x4» 12 x1 3x2 + 2x3 + 3x4» 7 2x1 + x2 + 3x3 x4» 10 x 0 : I set up the sample te



Similar documents
USING EXCEL 2010 TO SOLVE LINEAR PROGRAMMING PROBLEMS MTH 125 Chapter 4

EXCEL SOLVER TUTORIAL

Sensitivity Report in Excel

Tutorial: Using Excel for Linear Optimization Problems

Using EXCEL Solver October, 2000

Linear Programming Notes VII Sensitivity Analysis

Instructions for applying data validation(s) to data fields in Microsoft Excel

ECDL. European Computer Driving Licence. Spreadsheet Software BCS ITQ Level 2. Syllabus Version 5.0

MS Excel. Handout: Level 2. elearning Department. Copyright 2016 CMS e-learning Department. All Rights Reserved. Page 1 of 11

Graphing Parabolas With Microsoft Excel

Using MS Excel to Analyze Data: A Tutorial

Instructions for Using Excel as a Grade Book

Q&As: Microsoft Excel 2013: Chapter 2

Microsoft Excel Basics

Basic Pivot Tables. To begin your pivot table, choose Data, Pivot Table and Pivot Chart Report. 1 of 18

CREATING A TABLE IN WORD 2003

Solving Linear Programs using Microsoft EXCEL Solver

EXCEL FINANCIAL USES

Solving Linear Programs in Excel

Excel 2003 A Beginners Guide

Excel 2007 Basic knowledge

Spreadsheets and Laboratory Data Analysis: Excel 2003 Version (Excel 2007 is only slightly different)

MS Excel Template Building and Mapping for Neat 5

Excel 2003 Tutorial I

EXCEL Tutorial: How to use EXCEL for Graphs and Calculations.

Preface of Excel Guide

Intro to Excel spreadsheets

Linear Programming Refining Transportation

What is Linear Programming?

Microsoft Excel Tutorial

EXCEL EXERCISE #8: Consolidating and Linking Spreadsheets

Chapter 4. Spreadsheets

Linear Programming Notes V Problem Transformations

How to Create a Spreadsheet With Updating Stock Prices Version 3, February 2015

Microsoft Excel 2013 Splitting Windows and Fixing Panes (Level 3)

Creating a Gradebook in Excel

Spreadsheet User Guide. First-Year Course

Excel 2007 A Beginners Guide

Linear Programming. Solving LP Models Using MS Excel, 18

Linear Programming II: Minimization 2006 Samuel L. Baker Assignment 11 is on page 16.

Microsoft Excel - XP Intermediate

Using Formulas, Functions, and Data Analysis Tools Excel 2010 Tutorial

How to Make the Most of Excel Spreadsheets

Getting Started with Excel Table of Contents

Table of Contents TASK 1: DATA ANALYSIS TOOLPAK... 2 TASK 2: HISTOGRAMS... 5 TASK 3: ENTER MIDPOINT FORMULAS... 11

Excel supplement: Chapter 7 Matrix and vector algebra

Basic Excel Handbook

How To Analyze Data In Excel 2003 With A Powerpoint 3.5

WHAT S NEW IN MS EXCEL 2013

Excel Level Two. Introduction. Contents. Exploring Formulas. Entering Formulas

Microsoft Excel Tips & Tricks

What is Microsoft Excel?

In-Depth Guide Advanced Spreadsheet Techniques

A Guide to Using Excel in Physics Lab

The Center for Teaching, Learning, & Technology

Excel Spreadsheet Activity Redo #1

Spreadsheets have become the principal software application for teaching decision models in most business

Introduction to Microsoft Excel 1 Part I

Microsoft Excel 2013 Tutorial

As in the example above, a Budget created on the computer typically has:

Monthly Payroll to Finance Reconciliation Report: Access and Instructions

Using VLOOKUP to Combine Data in Microsoft Excel

Microsoft Using an Existing Database Amarillo College Revision Date: July 30, 2008

Microsoft Excel 2010 Linking Worksheets and Workbooks

WEBFOCUS QUICK DATA FOR EXCEL

APPLYING BENFORD'S LAW This PDF contains step-by-step instructions on how to apply Benford's law using Microsoft Excel, which is commonly used by

Chapter 6. Linear Programming: The Simplex Method. Introduction to the Big M Method. Section 4 Maximization and Minimization with Problem Constraints

Images of Microsoft Excel dialog boxes Microsoft. All rights reserved. This content is excluded from our Creative Commons license.

Maximizing the Use of Slide Masters to Make Global Changes in PowerPoint

Excel Guide for Finite Mathematics and Applied Calculus

EXCEL 2010: PAGE LAYOUT

PA Payroll Exercise for Intermediate Excel

How to Create a Data Table in Excel 2010

MICROSOFT ACCESS STEP BY STEP GUIDE

IEOR 4404 Homework #2 Intro OR: Deterministic Models February 14, 2011 Prof. Jay Sethuraman Page 1 of 5. Homework #2

Excel Budget Homework

1. Linking among several worksheets in the same workbook 2. Linking data from one workbook to another

Linear Programming. March 14, 2014

Excel 2003: Ringtones Task

Notes on Excel Forecasting Tools. Data Table, Scenario Manager, Goal Seek, & Solver

Spreadsheet - Introduction

OPRE 6201 : 2. Simplex Method

Sage Timesheet Web Access How To Use Timesheet

Create a Poster Using Publisher

Almost all spreadsheet programs are based on a simple concept: the malleable matrix.

USC Marshall School of Business Marshall Information Services

Building Qualtrics Surveys for EFS & ALC Course Evaluations: Step by Step Instructions

Accounts Receivable: Importing Remittance Data

Introduction To Microsoft Office PowerPoint Bob Booth July 2008 AP-PPT5

0 Introduction to Data Analysis Using an Excel Spreadsheet

How to Use Excel for Law Firm Billing

User Guide. Opening secure from the State of Oregon Viewing birth certificate edits reports in MS Excel

Introduction to Microsoft Access 2003

How to Excel with CUFS Part 2 Excel 2010

Top 10 Excel Questions WHY A TECHTORIAL?

UNIT 3 CALCULATIONS in MS EXCEL

Microsoft Excel 2013 Step-by-Step Exercises: PivotTables and PivotCharts: Exercise 1

Using the Solver add-in in MS Excel 2007

Sensitivity Analysis 3.1 AN EXAMPLE FOR ANALYSIS

Special Situations in the Simplex Algorithm

Transcription:

Linear Programming Notes IV: Solving Linear Programming Problems Using Excel 1 Introduction Software that solves moderately large linear programming problems is readily available. You can find programs on the internet. Software comes with many textbooks. Standard spreadsheet programs often can solve linear programming problems. In this course, we will use the solver tool found on Excel to solve problems. I request that you use this program. If you would strongly prefer to use other software, then talk to me. You can find Excel on the machines in the computation lab in Econ 100. You may have access to Excel (it comes bundled with Microsoft Office). If you do, then use it. The capacity to solve linear programs is only available if you install the solver tool. If you find that the solver is not available on your machine, you must either re-install Excel or use the computation lab. These notes explain how to use Excel to solve linear programming problems. I will assume that you know the basics of using a computer in the computation lab. That is, you must know how to log on, locate and start Excel, save your work, print your work, and log out. (One pointer: If you use the machines in Econ 100, you must know that your account is on iacs5 in order to log on.) 2 Creating a Spreadsheet This section explains how tosetup a spreadsheet to solve LPs. On the class webpage there are companion.pdf files that contain an Excel spreadsheet that Ihave created to illustrate the procedure. You should refer to that spreadsheet when you read these notes. The webpagealsocontains the same spreadsheet in.xls format. You can copy this and use it as a template spreadsheet for class assignments or your own experimentation. In any event, you need not prepare a new starting spreadsheet for each program. (When you do a homework assignment, make suretotype in the assignment number, the problem you are solving, and your name at the top of the page. If you use my template, it would be a good idea to erase my name before handing in the assignment.) I will describe how to set up and solve the basic linear programming example that I solved in class. This problem has four variables. The variables are constrained to be non-negative and there are three additional constraints. The 1

problem is to maximize 2x1 +4x2 +3x3 + x4 subject to: 3x1 + x2 + x3 + 4x4» 12 x1 3x2 + 2x3 + 3x4» 7 2x1 + x2 + 3x3 x4» 10 x 0 : I set up the sample template to deal with a problem of this size (four variables and three resource constraints). You would need to make adjustments to deal with smaller or larger problems. The boxes that have dark borders are the ones in which you enter numbers. The coefficients of the objective function (the cj) go in cells E5 through H5. The resource constraints (the bj) go in K13 through K15. The technological coefficients (the matrix A) go in the block frometo H and 13 to 15. In addition, the cells E8 through H8 are reserved for values of the variables. The program will find the best values for these xj and put them in these cells. B18 contains a formula. It is the formula for the value of the objective function. If you did not have fourvariables you would need P to adjust n the range of entries in the formula so that it would properly compute j=1 cj xj. For reference, I wrote the formula that appears in cell B18 on the spreadsheet (starting in A20). A20 does not enter into any of the computations; it is just a comment. Similarly, I13 through I15 contain formulas. These formulas compute the left hand side of a resource constraint. I wrote the formula that appears in I13 for reference in A21. I14 and I15 contain similar formulas. You need not retype them. If you copy I13by dragging downward, clever Excel makes the necessary changes in the formula. (The dollar signs in this formula tell Excel not to adjust the cell number when it copies.) If you had additional resource constraints, you would just use more rows in the spreadsheet. If you had a different number of variables, you would need to adjust the range of the variables that appear in the formulas. Finally, L13 through L15 contain a formula that gives you the difference (in absolute value) between the right and left hand side of each constraint. When you solve the problem, this difference must be zero for equality constraints. Otherwise, a strictly positive number corresponds to a non-binding constraint. I have not discussed J13-15. This column reports the way in which you compare the left-hand side of the resource constraint to the right-hand side (=,», or ). The computer program lets you enter any of the three comparison operators (and different constraints can use different comparisons). Once you have a template, you can create copies of it. Go to the pull down Edit menu at the top of the Excel page. Click onmove orcopysheet... Under To Book: Book1 (or some other destination). Under Before Sheet: Highlight Template (or whatever you call your template). Put a check mark in Copy. Click OK. This creates a copy of the template. Excel calls it Template (2). The name of the sheet is on a tab at the bottom of the sheet. You can change the name by putting the cursor on the tab, right clicking, clicking on Rename..., and entering the new name. 2

I renamed the copy Example 1. The spreadsheet is now in perfect shape to solve aproblem with 4 variables and 3 resource constraints. If your problem has more constraints, you can enter them below the ones in the problem (after line 15). Make sure to copy theformulas for the left-hand side and the slack. If your problem has more variables, then you need to adjust all of the formulas to include extra terms in the sums. A comment about spreadsheets. Cells in Excel spreadsheets can contain words (like A1). I use these as comments. The cells can contain numbers. Some of these cells contain the basic data of the problem (the A, b, andc). Some of the cells contain formulas. You enter the formula; Excel inserts a value into the cell using the formula. To enter a formula in a cell put the cursor on the cell and then type something that starts with an equal sign. The formulas that you use will compute linear functions - products of given coefficients and variables. Excel does this using the sumproduct" function. For example, when your write Excel computes: =SUMPRODUCT(E5:H5,E8:H8) (E5)(E8) + (F 5)(F 8) + (G5)(G8) + (H5)(H8); where (E5) is the number in cell E5 of the spreadsheet. Excel will find some way to whine at you if the formula is improperly configured (for example, if there are four cells to the left of the comma and three cells to the right; or if the entry in any one of the cells is not a number). Numbers should appear in cells that contain formulas. These numbers are the value obtained if you plug in current referenced values from other parts of the spreadsheet. 3 Solving the Problem On this spreadsheet I entered the data from the example. You may also enter guesses for the variables in E8 through H8; if you do not put anything there, Excel will assign the initial value of zero to each variable. Once you have entered the data (and adjusted the formulas, if necessary), you are ready to solve. Go to the Tools column on the menu bar at the top of the page. Click once to bring down the menu. Click on Solver... A Solver Parameter box should appear. In the Set Target Cell box: Insert B18. (Youcandothisbyclicking on cell B18 of the spreadsheet.) In general, what goes into the Set Target Cell box is the cell in your spreadsheet that has the formula for your objective function. Put the bullet in the circle to the left of max (of course, if you were solving a minimization problem, you would put the bullet to the left of min). By changing cells: enter E8:H8 (in general, indicate the cells that you have reserved for the variables). To the right of the Subject to the Constraints" box, click on Add... An Add Constraint Box should appear. Enter each resource constraint. For this 3

problem, I typed I13:15" in the left hand box (under cell reference); I made sure that the middle cell showed the operator <=" (that is,»); I typed K13:15" in the right hand box (below and to the right of Constraint:"). I then clicked OK. I then clicked add again and entered the non-negativity constraints by putting E8:H8" in the left; >=" in the center; and 0" in the right. I clicked OK again. There are other ways to enter this information. The important thing to note is that you should enter each constraint and that the Add Constraint Box lets you designate the constraint as an equation or either kind of inequality. You need to tell Excel to treat the program as a linear model. To do this, click on Options... Put a check mark next to Assume Linear Model" (you can ignore the rest of the box). Click OK. Now you can try to get the solution to your problem by clicking on Solve. The Solver Results box now appears. You should place a bullet to the left of Keep Solver Solution" and highlight Sensitivity" in the Reports list of options on the right. Click onok. You now have a spreadsheet that contains the answer to the problem and another sheet that has sensitivity results. You should be able to interpret the answer page: the spreadsheet now tells you the solution (xλ in E8 through H8) and the value of the problem (in B18). The spreadsheet also tells you which of the constraints were binding and the amount of slack in the non-binding constraints. (This information is in L11:13.) The sensitivity report contains a lot of useful information that you'll learn about later. At this point you can print out and save your results. Sometimes the output looks nicer if you print in using the landscape option rather than the portrait option. Click: File, then Page Setup, then highlight the bullet to the left of Landscape if you think that your results would look better in that format. Similarly by going through: File, Page Setup, Sheet, you can check boxes that will (or will not) print the grid lines and the row and column headings. If all has gone well, then you can reproduce the answer to the Example that we found using direct computation. My spreadsheet (Example 1) does contain the data from the problem and its solution. You can read off the values of the variables (in dark bordered box under x1;:::;x4). You can read off the value and the slack as well. Note that the computer decided that the slack in the first and third constraints was not quite zero. This is due to rounding error. 2:17E 12 means 2:17 10 12,which is closer to zero than most of us will ever get. 4 Loose Ends I have described how to use Excel to solve linear programming problems. There are a couple of details. 4

4.1 Infeasible Problems If your feasible set is empty, then Excel will tell you. After you ask Excel to find a solution, the Solver Results Box appears with the statement that Solver could not find a feasible solution." Provided that there are no mistakes, this means that the problem is not feasible. There is no solution to find and there is nothing else to do. 4.2 Unbounded Problems If your problem is unbounded, then Excel will tell you. The Solver Results Box appears with the statement that The Set Target Cell Values do not converge." The spreadsheet then provides you with a finite guess for all of the variables, but the guess will have the property thatyou can increase (at least) one of the variables without bound; maintain feasibility by varying only the variables that have positive values; and increase the objective function without bound. 4.3 Mysterious Failures Almost certainly something will go wrong at some point. Maybe it is the hardware. Maybe it is the software. Probably you made an incorrect assumption about how the program interprets the data you give itoryou just typed a formula or cell address incorrectly. Identifying the problem is frustrating and often time consuming. If you obtain a numerical answer, then I urge you to examine it to see whether it looks sensible. It could be the answer to the wrong problem. If Solver does not work, then go over the data and formulas slowly and carefully. Usually you will find a mistake. 4.4 Sensitivity Analysis At this point you can general a report on the sensitivity of your solution, but you cannot interpret this report. Sensitivity analysis is a major topic of the course. I will teach you what this report means soon. 5