You are on page 1of 16

Introduction to Solver

INFO 220

Adding the Solver


File Options Add-Ins Solver Add-In Go
1

4
3

2
5

What is solver?
An Excel add-in that can be used to find
an optimal solution to a problem,
based on some pre-determined objective
solved by changing a set of decision
variables such that the solutions meets a
given a set of limitations (constraints).

Ice Cream Example: Problem


Description
Consider a problem of diet optimization. There are four different types of food:
Brownies, Ice Cream, Cola, and Cheesecake. The nutrition values and cost per
unit are as follows:

The objective is to find a minimum-cost diet that contains at least 500 calories,
at least 6 grams of chocolate, at least 10 grams of sugar, and at least 8 grams of
fat.

Step 1: Decision Variables


STEP 1: Decision Variables
To begin we enter a heading for each type of food in
B2:E2
In the range B3: E3, we input trial values for the amount
of each food eaten (Any values will work, but at least
one should be positive)
For example, here we indicate that we are considering
eating three brownies, no scoops of ice cream, one bottle
of cola, and seven pieces of cheesecake

Step 2: Objective Function


STEP 2: Objective Function
To see if the diet is optimal, we must determine its cost
as well as the calories chocolate, sugar, and fat it
provides
In the range B7: E7, we reference the number of units
In the range B8:E8, we input the cost for each available
food.

Step 2: Objective Function


STEP 2: Objective Function
We compute the cost of the diet in cell B10 with the
formula
= SUMPRODUCT (B7:E7, B8:E8)
(E7*E8)

or = (B7*B8) + (C7*C8) + (D7*D8) +

Step 3: Constraints
STEP 3: Constraints
To begin, we create a table in Excel that defines how
many calories and units of chocolate, sugar, and fat are
in each type of dessert.

Step 3: Constraints
STEP 3: Constraints
Next, we need to calculate the total amount of calories,
chocolate, sugar & fat - given the total number of each
item (decision variables).
Create a Total in Column F
=SUMPRODUCT($B$7:$E$7,B14:E14)

Step 3: Constraints
STEP 3: Constraints
Finally, we need to indicate the limitations highlighted in
the problem.
We add a >= in Column G
Add the limits in Column H

SOLVE IT!
Step 1: Set the Objective
Open Solver and click on the
to select the cell in our
spreadsheet that calculates our objective function Cell
B10
Next, we must identify the type of problem we are
solving - MIN

SOLVE IT!
Step 2: Identify the decision variables
Click on the
to select the cell in our spreadsheet to
tell solver which variables it can change to reach the
optimal solution.

SOLVE IT!
Step 3: Add constraints
On the right-hand side of the window there is a button to Add
a constraint
Use the cell reference to input the totals for each constraint
we calculated.
Example for Calories:
Click Add if adding more than constraints or Click OK if
finished.

SOLVE IT!
Step 3: Add constraints
We have now created 4 constraints and Solver will ensure that
the changing cells are chosen so that diet will be chosen to
ensure that enough calories, chocolate, sugar, and fat are eaten.

Note: The Change button allows you to modify a constraint already entered and Delete
allows you to delete a previously entered constraint. If you need to add more constraints,
simply click Add.

SOLVE IT!
Step 4: Minor changes to Solver
Parameters
Check the box Make Unconstrained
Variables Non-Negative (we do not
want any negative values)
Change the Solving Method to
SIMPLEX LP
Click SOLVE

Solution

You might also like