Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

CIVL 1112 Excel - Solver 1/7

Excel Solver Function Excel Solver Function


What is the Excel Solver good for?
 What is the Excel Solver good for?
 Solvers, or optimizers, are software tools that help users
 What must I do to use a solver? find the best way to allocate scarce resources.
 How do I define a model?
 The resources may be raw materials, machine time or
 What kind of solution can I expect? people time, money, or anything else in limited supply.

 What makes a model hard to solve?  The "best" or optimal solution may mean maximizing
profits, minimizing costs, or achieving the best possible
 Can you show me step by step?
quality.

Excel Solver Function Excel Solver Function


What must I do to use a solver? What must I do to use a solver?

 To use a solver, you must build a model that specifies:  Spreadsheets such as Excel provide a convenient way to
build a model
 The resources to be used, using decision variables  Anyone who has used a spreadsheet is already familiar
 The limits on resource usage, called constraints, and with the process:
 The measure to optimize, called the objective.  Cells on a worksheet can hold numbers, labels, or formulas that
calculate new values -- such as the objective of an optimization
 The solver will find values for the decision variables that  Constraints are simply limits (specified with <=, = or >= relations)
satisfy the constraints while optimizing (maximizing or on formula cells
minimizing) the objective.  And the decision variables are simply input cells containing
numbers

Excel Solver Function Excel Solver Function


How do I define a model? Decision Variables How do I define a model? Decision Variables

 A solver deals with numbers, so you'll need to quantify the  For example, if you are shipping goods from 3 different
various elements of your model: decision variables, plants to 5 different warehouses, there are 3 x 5 = 15
constraints, and the objective -- and their relationships different routes along which products could be shipped

 Decision variables usually measure the amounts of  So, you might have 15 variables, each one measuring the
resources, such as time and money, to be allocated to some number of products shipped along that route
purpose, or the level of some activity

 For example, the number of products to be manufactured, the


number of pounds or gallons of a chemical required for some
process, etc.
CIVL 1112 Excel - Solver 2/7

Excel Solver Function Excel Solver Function


How do I define a model? Decision Variables How do I define a model? Objective

 In addition, you might also have 4 different product types,  Once you've defined the decision variables, the next step
and you might want to plan shipments in each of the next is to define the objective, which is a function that depends
6 months on the variables
 So this might lead to 15 x 4 x 6 = 360 variables
 For example, suppose you were planning how many units
 This illustrates how a model can become large rather to manufacture of three products:
quickly!
TV sets, stereos, and speaker
 Part of the art of modeling is deciding how much detail is
really required

Excel Solver Function Excel Solver Function


How do I define a model? Objective How do I define a model? Objective

 Your objective might be to maximize profit  On a spreadsheet where the number of TV sets, stereos
and speakers are in cells D9, E9 and F9 respectively, the
 Assume that: each TV set yields a profit of $75, formula would be:
each stereo $50, and
each speaker $35 = 75*D9 + 50*E9 + 35*F9

 Then your objective function might be:


 You'd be finished at this point, if the model did not require
any constraints
75*TV sets + 50*stereos + 35*speakers

Excel Solver Function Excel Solver Function


How do I define a model? Constraints How do I define a model? Constraints
 In most models constraints play a key role in determining
what values can be assumed by the decision variables General Constraints
 For example, the cell range A1:A5 contains the
 Constraints reflect real-world limits on variables percentage of funds to be used to purchase 5 different
types of material
 To define a constraint, you first compute a value based
on the decision variables  You could use cell B1 to calculate =SUM(A1:A5)

 Then you place a limit (<=, = or >=) on this computed  Then define a constraint of B1 = 1 so that the
value percentages allocated must sum up to 100%.
CIVL 1112 Excel - Solver 3/7

Excel Solver Function Excel Solver Function


How do I define a model? Constraints How do I define a model? Constraints
Physical Constraints
Bounds on Variables
 Of course, you can also place a limit directly on a decision  Many constraints are determined by the physical nature of
variable, such as A1 <= 100 the problem.

 Upper and lower bounds on the variables are efficiently  For example, if your decision variables measure the
handled by most optimizers and are very useful in many physical dimensions of an object, negative values for these
problems. variables would make no sense.

Excel Solver Function Excel Solver Function


How do I define a model? Constraints How do I define a model? Constraints
Physical Constraints Integer Constraints
 Advanced optimization software also allows you to specify
 This type of non-negativity constraint is very common constraints that require decision variables to assume
only integer (whole number) values at the solution
 Constraints such as A1 >= 0 must be stated explicitly,  If you are scheduling a fleet of trucks, for example, a
because the solver has no other way to know that negative solution that called for a fraction of a truck to travel a
values are disallowed certain route would not be useful.
 Integer constraints normally can be applied only to
decision variables, not to quantities calculated from them.

Excel Solver Function Excel Solver Function


What kind of solution can I expect?
What kind of solution can I expect?
 A solution (set of values for the decision variables) for
which all of the constraints in the Solver model are  A globally optimal solution is one where there are no
satisfied is called a feasible solution other feasible solutions with better objective function
values
 Most solution algorithms first try to find a feasible solution,
and then try to improve it by finding another feasible  A locally optimal solution is one where there are no other
solution that increases the value of the objective function feasible solutions "in the vicinity" with better objective
(when maximizing, or decreases it when minimizing) function values

 An optimal solution is a feasible solution where the  The Solver is designed to find optimal solutions -- ideally
objective function reaches a maximum (or minimum) value the global optimum -- but this is not always possible
CIVL 1112 Excel - Solver 4/7

Excel Solver Function Excel Solver Function


What makes a model hard to solve? Can you show me step by step?
 Three major factors interact to determine how difficult it will Consider the following problem:
be to find an optimal solution to a solver model:  Imagine that you are managing a factory that is building
three products: TV sets, stereos and speakers
 The mathematical relationships between the objective and
constraints, and the decision variables
 Each product is assembled from parts in inventory, and
 The size of the model (number of decision variables and there are five types of parts: chassis, displays, speaker
constraints) cones, power supplies and electronics units

 The use of integer variables - memory and solution time may rise  Your goal is to produce the mix of products which will
exponentially as you add more integer variables
maximize profits, given the inventory of products on hand

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?
 From this description, we can see that:  To assemble a TV set, you need 1 chassis, 1 display, 2
 The decision variables are the number of products to build speaker cones, 1 power supply and 2 sets of electronics
 The objective function will be (gross) profit  To make a stereo, you need 1 chassis, 2 speaker cones, 1
power supply and 1 set of electronics
 Assume that you can sell TV sets for a gross profit of $75  To build a speaker, all you need is 1 speaker cone and 1
each, stereos for a profit of $50 each, and speaker cones set of electronics
for $35 each  The parts you have on hand are 450 chassis, 250 dispalys,
800 speaker cones, 450 power supplies and 600 sets of
75*TV sets + 50*stereos + 35*speakers electronics

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?
 Before we implement this problem statement in either  Building each product requires a certain number of parts of
Excel, let's write out formulas corresponding to the verbal each type.
description above.  The number of parts used depends on the mix of products
 If we temporarily use the symbols: built (constraint left hand side), and the number of parts of
 x for the number of TV sets assembled, each type on hand (constraint right hand side):
 y for the number of stereos, and 1 x + 1 y + 0 z <= 450 (Chassis)
 z for the number of speakers, 1 x + 0 y + 0 z <= 250 (Dispalys)
2 x + 2 y + 1 z <= 800 (Speaker cones)
 The total profit is: 1 x + 1 y + 0 z <= 450 (Power supplies)

Maximize 75 x + 50 y + 35 z (Profit) 2 x + 1 y + 1 z <= 600 (Electronics)


CIVL 1112 Excel - Solver 5/7

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?
 The next step is to create a worksheet where the formulas
for the objective function and the constraints are
calculated

 In the worksheet on the next slide, we have reserved cells


E4, F4, and G4 to hold our decision variables x, y and z:
the number of TV sets, stereos and speakers to build

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?
 The objective function is:  The Excel formula for the
75 x + 50 y + 35 z number of chassis used is:
=E7*$E$4+F7*$F$4+G7*$G$4

 The Excel formula is:  The Excel formula for the


=E4*E14+F4*F14+G4*G14 number of dispalys used is:
=E8*$E$4+F8*$F$4+G8*$G$4

 The remaining “# Used” values


are computed in similar ways

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?
 The constraints are:
 Number of TV sets, stereos,
and speakers must be non-
negative, or

E4:G4 >= 0

 Number of used parts must be


less than inventory, or
 To run Solver, click on the Data
D7:D11 <= C7:C11 tab, in the Analysis group, click
Solver.
CIVL 1112 Excel - Solver 6/7

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?

 Set the “By Changing Variable Cells”


 Set the target cell, or the value of the or the value of the decision
objective function, in this case, the variables, in this case, the number of
Total Profit, cell E16 TVs, stereos, and speakers: E4:G4

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?

 Set the inventory constraint:  Set the inventory constraint:

D7:D11 <= C7:C11 D7:D11 <= C7:C11

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?

 Set the non-negative  Excel Solver is ready to run.


constraint:
 Just click on Solve

E4:G4 >= 0
CIVL 1112 Excel - Solver 7/7

Excel Solver Function Excel Solver Function


Can you show me step by step? Can you show me step by step?
 When you click on Solve the
results appear in the
spreadsheet.

 You can select an Answer


Report and Excel inserts a
new sheet into the workbook

Excel Solver Function Excel Solver Function


How do I define a model? Questions?
 See if you can use Solver to:

Maximize the Cost-Adjusted SWR for the reinforced


concrete beam project

 What are the decision variables?


 What is the objective function?
 What are the constraints?

You might also like