0% found this document useful (0 votes)
90 views4 pages

How To Use Excel Solver

This document provides instructions for using the Solver tool in Microsoft Excel to solve linear programming problems. It presents three exercises - the first maximizes a linear objective function subject to linear constraints, the second solves an integer linear program with 0-1 variables, and the third encourages practicing other examples from class notes. Helpful tips are provided on setting up the spreadsheet correctly and interpreting solution reports.

Uploaded by

Mwango
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
90 views4 pages

How To Use Excel Solver

This document provides instructions for using the Solver tool in Microsoft Excel to solve linear programming problems. It presents three exercises - the first maximizes a linear objective function subject to linear constraints, the second solves an integer linear program with 0-1 variables, and the third encourages practicing other examples from class notes. Helpful tips are provided on setting up the spreadsheet correctly and interpreting solution reports.

Uploaded by

Mwango
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

MATH2013 Introduction to Operational Research

Excel Solver Computer Lab

Introduction

We will be using the Solver facility in Microsoft Excel (created by Frontline Systems Inc.) to
solve linear and integer linear programming problems.

Solver is an add-in to Excel. For older versions of Windows/Excel, check that you have it by
going to Tools and seeing if Solver… is listed. If it is not, go to Add-ins… and select Solver
Add-in. For Windows 7, you will find it under Data, Analysis. If it is not there, go to File,
Options, Add-ins… If you have trouble finding Solver, go to Help and type “Solver Add-in”.

Exercise 1

The problem we are going to solve is:

Max 550 x1  600 x 2  350 x3  400 x 4  200 x5


Subject to 16 x1  20 x 2  25 x 4  15 x5  288
10 x1  8 x 2  16 x3  192
20 x1  20 x 2  20 x3  20 x 4  20 x5  384
xi  0, i  1,...,5.

1) Open a new Excel Worksheet. (Remember to save it often to avoid data loss.)

2) Enter the data into an Excel Spreadsheet in a similar way to that shown in Figure 1.

Figure 1 Sample Input for Solver

The inputs for the cells are exactly as shown, except for Cells B6, G8, G9 and G10 which are
input as follows.

Cell Content
B6 =SUMPRODUCT(B4:F4,B$2:F$2)
G8 =SUMPRODUCT(B8:F8,B$2:F$2)
G9 =SUMPRODUCT(B9:F9,B$2:F$2)
G10 =SUMPRODUCT(B10:F10,B$2:F$2)

1
Notes:
 The ‘$’ symbols are a way of fixing the following part of the cell reference (making it
“absolute” rather than “relative”). They can be omitted, but if they are included you can
type one formula and then copy and paste the rest. For more information on this, type
“absolute reference” into the Excel Help and read the two topics “About cell and range
references” and “Switch between relative, absolute, and mixed references”.
 SUMPRODUCT() is a function in Excel which multiplies corresponding components in
the given arrays and returns the sum of those products (i.e. the Dot product). For example
in cell G8, Excel will perform the calculation (B8*B2+C8*C2+D8*D2+E8*E2+F8*F2).
 The cells B2, C2, …, F2 represent the values of the decision variables. You will instruct
Solver to try changing these cells to maximise your objective function (cell B6). It’s often
handy first to try out a few values for the decision variables by hand; this allows you to
see whether your objective function and constraint calculations are working properly.
3) Bring up the Solver window from the Tools menu and enter the parameters as shown in
Figure 2.
Note: The constraints are not entered directly into the large window at the bottom, but
rather by using the Add button.
4) For older versions of Windows, go to the Options menu of Solver, tick the Assume Linear
Model and Assume Non-negative boxes. For Windows 7, the solver window looks slightly
different: select the solving method Simplex LP.
5) Solve it!

Figure 2 Solver Window


Note: (1) As this is an LP problem, Solver will invoke a simplex algorithm to find an optimal
solution, if it exists.
Exercise 2
Now try to solve:
Max 4 x1  4 x 2  x3  6 x 4  5 x5

2
Subject to x1  3 x 2  4 x3  3 x 4  2 x5  8
8 x1  x 2  9 x3  x5  10
0  x j  1, j  1,...,5.
x j integer, j  1,...,5
Notes: (1) All the constraints are specified using Add. The last set of constraints is of type
“int” (integer).
(2) Since the only possible values for the variables are 0 or 1, it is possible to combine
the last two constraints. Try using the type “bin” (binary) for the variables.
(3) This problem has (at least) two different optimal solutions, i.e. two different
solutions that satisfy the constraints and give the maximum value for the objective
function. Experiment with different initial values for the variables in order to try to
find different optimal solutions.
(4) For ILP problems, Solver will invoke a branch-and-bound algorithm. For large
problems, solution time will typically become (very) large compared to solving the LP
relaxation of the problem.
Exercise 3
Look at the other examples in your notes we have studied in the lectures. Try putting them
into Solver and verifying the results.
When you have found a solution, you can get Solver to produce various reports.

Figure 3 Solver Report Window

Of particular interest are the Answer Report and the Sensitivity Report:

 The Answer Report is available for both LP and ILP models. It summarises
information about the solution found, including which constraints are binding and
which are not binding.
 The Sensitivity Report is available only for LP models. It summarises how sensitive
the optimal solution is to individual changes in the model; i.e. how much a single
value of the model’s input data can be changed on its own while keeping the found
solution optimal. It specifies by howx` much the coefficients in the objective function
can change and by how much the constant values (the right hand side, RHS) in the
constraints can change.

3
MATH2013 Introduction to Operational Research 

Mathematical Programming Software 

Additional notes to the Lab session – general information 

Solvers 

 `Solvers’ is a general name to denote which algorithms are implemented. You have solvers 
that can handle Linear Programming (LP) only, but also solvers that can handle both LP and 
Integer Programming (IP) and even non‐linear optimisation problems. 
 Modelling systems are providing user interfaces to allow users to model large problems 
efficiently, and set‐up instances to be solved by linking into e.g. corporate databases. 
 Some solvers and modelling systems are tailored towards large corporations and academic 
researchers. These are typically expensive and not easy for learning the basics for users new 
to the area.  

Example 1: Microsoft’s Solver add‐in to Excel 

 Very good as a first introduction to, but not for professional use. 
 Available whenever you have Excel. The Solver add‐in must be activated the first time you 
wish to use it. An instance of a problem is modelled in an Excel spreadsheet. The equations 
are specified in a Solver window. 
 Solution values are shown in the Excel spreadsheet, and also in separate sheets. 
 LP problems are solved by a simplex algorithm; IP problems with b‐a‐b (some issues); non‐
linear optimisation problems are ‘solved’ by a range of heuristics.  
 See also: the computer lab, and the extra examples. 

Example 2: LINGO 

 LINDO, LINGO, What’s best. Quite reliable and at least semi‐professional. Solver + modelling 
Free trial versions and software manuals available at www.lindo.com. A student version of 
LINGO is typically included when purchasing the book of Winston (see L1). 
 The book ‘Optimization Modeling with LINGO’ by Linus Schrage is freely available from Lindo, 
with many management science problems, and how to model them in LINGO. Highly 
recommended! 
 The trial versions have the drawback that only problems of small size can be solved. 

Professional packages 

 The industry solver standard is likely CPLEX. It is very powerful and runs behind the scenes of 
many other software packages of various large consultancy firms. It is also used by many 
researchers as it can be called from C++ and other programming environments. 
 An industry modelling system standard is MPL by Maximal Software, see www.maximal‐
usa.com. Provides links to a series of different compatible solvers. 

Patrick Beullens, 29/10/2012 

You might also like