21
IN THE NAME OF GOD An introduction to Excel Solver By : Mahsa Rezaei 1

Excel Solver(By Mahsa Rezaei)

Embed Size (px)

Citation preview

Page 1: Excel Solver(By Mahsa Rezaei)

IN THE NAME OF GOD

An introduction to Excel Solver

By : Mahsa Rezaei

1

Page 2: Excel Solver(By Mahsa Rezaei)

Why Excel?

One advantage of the spreadsheet approach to optimization is thatmany optimization models can be represented in an understandablefashion in a spreadsheet.

Another benefit is that many people are already familiar with usingspreadsheets.

The spreadsheet copy command allows large models with many similarconstraints to be created and solved quickly in a spreadsheetenvironment.

Page 3: Excel Solver(By Mahsa Rezaei)

Enabling SOLVER in Excel:

Solver is an Add-in for Microsoft Excel which is typically not enabled during the initial installation of Excel. If ‘Solver’ does not appear on the ‘Date’ tab in Excel ,then youneed to enable it as follows:

Page 4: Excel Solver(By Mahsa Rezaei)

Go to ‘office button / excel options’.

Choose ‘add-in’ from the page appeared.

Then choose ‘Solver add-in’ from the menu.

Click ‘Go…’.

Make sure that solver is enabled.

Now go to Data tab menu, Solver must be there.

Page 5: Excel Solver(By Mahsa Rezaei)

Solving a linear problem in excel requires four main steps:

1.Organize your information:There are three categories of information needed for solving anoptimization problem in Excel: an Objective Function, Decision Variables,and Constraints.

2.Set up the problem in the excel spreadsheet

3.Running Solver

4.Interpreting the Results

For better understanding we will follow an example and implement theinstructions on it.

Page 6: Excel Solver(By Mahsa Rezaei)

Problem:

An electronics firm manufactures integrated circuit for radios,televisions, and stereos. For the next month it has available 1500 units ofmaterials and 920 units of labor. The requirements and selling price ofone of each of the above products is given in the following table. Thegoal of this problem is to maximize income.

Selling price(dollars)Units of laborUnits of material

812Radio

60812TV

45615Stereo

Page 7: Excel Solver(By Mahsa Rezaei)

1.Organize problem’s information:

Decision variables: X1=units of radioX2=units of TVX3=units of stereo

Constraints: 2 X1+12 X2+15 X3 ≤ 1500X1 +8 X2+6 X3 ≤ 920

Objective function: income=8 X1+60 X2+45 X3

Page 8: Excel Solver(By Mahsa Rezaei)

2.Set up the problem in the excel spreadsheet

Enter the names of the Objective Function, Decision Variablesand Constraints into cells in column A-the more descriptive thelabels are, the easier it is to keep track of the relationshipsamong the variables and constraints.

Also enter the coefficients related to each one ,in thespreadsheet.

For the Decision Variables, you can enter a 0 into each of thecorresponding cells in column B or you can leave them blankSolver will calculate the optimum values for these variables.

Page 9: Excel Solver(By Mahsa Rezaei)
Page 10: Excel Solver(By Mahsa Rezaei)

In the cell corresponding to objective function enter the formula based on the profit, also you need to do the same for each of the constraints.

Page 11: Excel Solver(By Mahsa Rezaei)
Page 12: Excel Solver(By Mahsa Rezaei)

3.Running SolverAs mentioned before you can find Solver in data tab. As you click on it, the following dialog box will appear:

Page 13: Excel Solver(By Mahsa Rezaei)

In ‘Set Target Cell’ enter the cell corresponding to your ObjectiveFunction and choose the appropriate outcome under ‘Equal To:’(maximize, minimize, or set to a specific value).NOTE: You can enter cells into any of these target boxes by selectingthem on the spreadsheet using the cursor ;it’s easier than typing incell addresses.Select the cells corresponding to all of your Decision Variables inthe ‘By Changing Cells:’ target box.To set up the Constraints, select ‘Add’ under ‘Subject to theConstraints:’ The following dialog box opens:

Page 14: Excel Solver(By Mahsa Rezaei)

Enter the cell location (in column E here) for each Constraint intothe left hand box (‘Cell Reference:’) and the cell location (incolumn F here) of the Constraint value into the right hand box. Usethe pull-down menu in the middle to select the appropriateinequality relation. Continue to click the “Add” button until all ofyour Constraints are entered, then select ‘OK’.NOTE: You can later change or delete these Constraints from theSolver dialog box if necessary.

Page 15: Excel Solver(By Mahsa Rezaei)

Click OK. This will return you to the Solver dialog box. When allthe targets and constraints have been entered, select ‘Solve’. Theoptimized values and following dialog box will appear :

You may encounter different messages in the solver results dialogbox. for more information about this you can check the followinglink:http://www.solver.com/suppstdmsgresult.htm

Page 16: Excel Solver(By Mahsa Rezaei)

At this point you have the option to generate any of three reports:Answer, Sensitivity, and Limits. These are inserted as new workbooksin the Excel file. Select any you wish to have included. If Solver wasable to find a solution, it will notify you that all constraints andoptimality conditions were satisfied. You may elect to Keep theSolver Solution or Restore the Original Values. NOTE: If you chooseto generate an Answer Report, you can still select ‘Restore OriginalValues’ to continue working with the unaltered spreadsheet; theresults from Solver will be saved in the Answer Report.

Click ‘OK’. You are then returned to the spreadsheet.

HINT: The last set of target and constraints used in the Solverdialog box will be saved with each worksheet in the Excel file, andwill be copied with the worksheet if you need to duplicate it. So youcan repeatedly run Solver in the sheet to investigate the effects ofchanging Constraint values or relationships.

Page 17: Excel Solver(By Mahsa Rezaei)

4.Interpreting the Results

Until you become familiar with each report and the information itholds you may wish to generate all possible reports to ensure youdo not miss any required information. The following is an exampleof the answer report generated for this Problem.

Answer ReportThe Answer Report identifies the names, the corresponding cells,the initial and optimal (final) values of the Target (i.e. theObjective Function), and the values of Adjustable Cells (i.e. theDecision Variables) that produced it. In the Constraint section thestatus column indicates if a Constraint was binding or not. Fornonbinding Constraints, the slack column shows how far from theConstraint your results are.

Page 18: Excel Solver(By Mahsa Rezaei)
Page 19: Excel Solver(By Mahsa Rezaei)

Sensitivity ReportThe Sensitivity Report gives the final optimal values of both theDecision Variables and the Constraints, along with the Lagrangemultiplier (i.e. shadow prices) of the binding Constraints.

Page 20: Excel Solver(By Mahsa Rezaei)

Limits ReportThe Limits Report holds some interesting information. It has the upperand lower limits of the decision variables given all the constraints of theproblem.. The target result for each lower limit tells us what value theobjective function will take on if that particular constraint drops to thelower limit and all other constraints remain at the optimal value. Thetarget result for the maximum column tells us the profit that is realizedif all decision variables are at their optimal values.

Page 21: Excel Solver(By Mahsa Rezaei)

Question?