Sie sind auf Seite 1von 33

Excel Solver

Overview

Goal Seek in Excel

Linear Programming Problems : a brief


introduction

Excel Solver

Exercises

Goal Seek

A tool for finding the value of an independent


variable (input cell) which produces a desired
output in a dependant cell (the cell containing a
formula dependent on the independent variable)

It can solve only for a single independent variable

It returns only if there is a single solution

Optimization: Basics

Major field within the discipline of Operations


Research and Management Science

Optimization Problem Components


Decision Variables
Objective Function (to maximize or minimize)
Constraints (requirements or limitations)

Basic Idea:
Find the values of the decision variables
that maximize (minimize) the objective
function value, while staying within the
constraints.

Linear Programming (LP)

If the objective function and all the constraints are


linear functions of the decision variables, then the
problem is called a Linear Programming (LP)
problem.

LPs are much easier to solve by computer than


problems involving nonlinear functions.

Real-world LPs may contain hundreds of variables,


and may require specialized software!.

Real-World Examples

Product Mix

Scheduling/Allocation of workforce

Supply Chain Optimization

Capital Budgeting

Financial Planning

etc.

Mathematical Background
Find x which
Minimizes or Maximizes f(x)
Subject to
di(x) ai
ei(x) = bi

i = 1,2,m
i=1,2,p

x can be a vector

Mathematical
Background(contd...)

If f(x) and the constraints are linear, we have a


linear programming problem

If f(x) is quadratic, and the constraints are linear,


we have a quadratic programming problem

If f(x) is non-linear (and not quadratic either),


and/or the constraints are nonlinear, we have
nonlinear programming problem

How to solve an optimization


problem

Understand the problem and write a problem formulation


in words

Write the algebraic formulation:


Identify the decision variables

Decide if the problem is maximization or minimization,


and then write the objective function in terms of the
decision variables
Write the constraints in terms of the decision variables
Write the non-negativity constraints, if any

An Example

A gas processing plant receives a fixed amount of raw gas each week

Capable of producing two grades of heating gas (Regular and


Premium) each yielding different profit

Each grade has different production time and on-site storage


constraints

High demand for its products (i.e. guaranteed to sell)

Facility is open only 120 hrs/week

Use the data in next page to develop a linear programming


formulation to maximize profit

Data
Product
Resource
Raw Gas

Regular
7

Premium
11

Resource Availability
77

Production Time
(hr/tonne)

10

120

Storage
(tonne)

Profit (/tonne)

150

175

(m /tonne)

Problem Formulation : Decide the amount of regular gas and


premium gas to be produced to maximize profit

Identify the Decision Variables


Product
Resource
Raw Gas

Regular
7

Premium
11

Resource Availability
77

Production Time
(hr/tonne)

10

120

Storage
(tonne)

Profit (/tonne)

150

175

(m /tonne)

Decision Variables : Amount of regular gas (x1) and


Amount of premium gas (x2) to be produced

Write down the Objective


Function
Product
Resource
Raw Gas

Regular
7

Premium
11

Resource Availability
77

Production Time
(hr/tonne)

10

120

Storage
(tonne)

Profit (/tonne)

150

175

(m /tonne)

Total Profit

Z = 150 x1 + 175 x2

Maximize

Z = 150 x1 + 175 x2

Objective
function

Write the Constraints


Product
Resource
Raw Gas

Regular
7

Premium
11

Resource Availability
77

Production Time
(hr/tonne)

10

120

Storage
(tonne)

Profit (/tonne)

150

175

(m /tonne)

7x1 + 11x2 77
10x1 + 8x2 120

(material constraint)
(time constraint)

x1 9

(storage constraint)

x2 6

(storage constraint)

x1,x2 0

(positivity constraint)

We have an LP problem
Maximize

150 x1 + 175 x2

Subject to :
7x1 + 11x2 77
10x1 + 8x2 120
x1 9
x2 6
x1,x2 0

Graphical Solution
7x1 + 11x2 77
x2 -7/11 x1 +7

8
7
6

Constraint 1

x2

5
4
3
2
1
0
0

x1

10

Graphical Solution
(contd)
10x1 + 8x2 120
x2 -5/4x1 + 15
16

Constraint 1

14

Constraint 2

12

x2

10
8
6
4
2
0
0

10

x1

15

Graphical Solution
(contd)
x1 9
16

Constraint 1

14

Constraint 2

12

Constraint 3

x2

10
8
6
4
2
0
0

10

x1

15

Graphical Solution
(contd)
x2 6
Constraint 1
16

Constraint 2

14

Constraint 3

12

Constraint 4

x2

10
8
6
4
2
0
0

10

x1

15

Graphical Solution
(contd)
x1,x2 0
Constraint 1
16

Constraint 2

14

Constraint 3

12

x2

Convex Polytope

Constraint 4

10
8
6
4
2
0
0

10

x1

15

Graphical Solution
(contd)
Now we need to find the maximum value of the objective
function, while satisfying the constraints. Let us plot the
objective function for various values of Z and see:
Z=0

0=150x1 + 175x2

.
Z = 500

500=150x1 + 175x2

....
Z = 1200

1200=150x1 + 175x

Graphical Solution
(contd)
Z=0
Z=500
Z=1200

16
14
12
10
8

x2

6
4
2
0
-5

-2 0

-4

x1

10

15

Excel : solve an optimization


problem

Develop a Spreadsheet Model

Set up the Solver settings and solve the


problem

Examine results, make corrections to the model


and/or Solver settings

Interpret the results and draw insights

Solver : Basics

Use Solver only after you have a working


spreadsheet model

Solver Settings

Specify Target Cell (objective function)


Specify Changing Cells (decision variables)
Add Constraints
Specify Solver Settings (Linear model, non-negativity
etc.)

Solve button : Solve the problem to find Optimal


Solution

Concepts:

Feasibility
Feasible Solution: A solution is feasible if all constraints are
satisfied.
Infeasible Solution: A solution is infeasible if one or more
constraints is violated.

Optimal Solution: It is the feasible solution with the largest (for


maximization problem) value for the objective value (smallest for a
minimization problem).

Binding Constraints: Constraints at the optimal solution with the LHS


equal to the RHS; equivalently for a resource, a binding constraint is
one in which all the resource is used up. Other constraints are called
non-binding constraints

Spreadsheet Model
Development

Develop a correct, flexible and documented model.

Use algebraic formulation and natural structure of the


problem to guide structure of the spreadsheet.

Use one cell for each decision variable

Store objective function coefficients in separate cells, and


use another cell to compute the objective function value.

Store constraint coefficients in cells, compute the LHS value


of each constraint, for comparison to the RHS value.

Solution Reports

Solver can generate three solution reports


Answer Report
Sensitivity Report
Limits Report

The Answer Report presents in a standard format the Solver


Settings and the optimal solution.

The Sensitivity Report shows what will happen if certain


problem parameters are changed from their current values.

The Limits Report shows how much the decision variable


values can change but still stay within your constraints.

Solver Results:

Optimal Solution

Unbounded
Problem

Infeasible
Problem

Solving an LP Problem : a review

Trial and error: possible for very small problems; virtually impossible
for large problems.

Graphical approach: It is possible to solve a 2-variable problem


graphically to find the optimal solution.

Simplex Method: A mathematical approach developed by George


Dantzig.

Computer Software. Most optimization software actually uses the


Simplex Method to solve the problems. Excels Solver Add-In is an
example of such software.

Solver can solve LPs of up to 200 variables. Enhanced versions of


Solver are available from Frontline Systems (http://www.solver.com).

Exercise: Solver for Capital


Budgeting
Chapter 32 : Templates\Capbudgetemp.xlsx
Which Projects to choose to get maximum NPV
Resource Constraints on capital and labor

Identify the Decision Variables : To Do or Not to Do


Objective Function : Maximize the NPV generated from the
selected projects
Constraints : in any year t
Capital used is less than or equal to available capital
Labor used is less than equal to available labor

Thank YOU

Another Example
Minimize the amount of material used to make the can while
keeping the volume constant.

The Solver would return the


values for height, h, and
radius, r.

Solving Equations:

Solver can also solve a single algebraic equation.


2x5 -3x2 5 = 0

Find a positive real root of this


equation, the added restriction is that
x 0.

Simultaneous algebraic equations arise in many engineering


applications. Solver is capable of finding the solution.

3x1 + 2x2 x3 4 = 0
2x1 x2 + x3 3 = 0

x1 + x2 2x3 + 3 = 0
Find the values of x1, x2, and x3 that will cause all three equations to equal zero.

Das könnte Ihnen auch gefallen