Anda di halaman 1dari 42

Chapter 8: Optimization

The Art of Modeling with Spreadsheets


S.G. Powell and K.R. Baker
John Wiley and Sons, Inc.

PowerPoint Slides Prepared By: Tava Olsen Washington University in St. Louis
7-1
8-1

Optimization
Find the best set of decisions for a particular measure of performance Includes:

The goal of finding the best set The algorithms to accomplish this goal

8-2

Excel Optimization Software


Solver

Standard with Excel Comes with text install off text CD More advanced than standard solver Is preferred tool throughout text Click on Premium button in Solver Parameters window to toggle to premium version
8-3

Premium Solver for Education


Decision Variables
Levers to improve performance Want to find the best values for the variables Finding these best values can be challenging

Need Solvers sophisticated software Still relatively easy to construct models beyond Solvers capabilities

8-4

Solver Parameters Window


Target Cell

Maximize, minimize, or set equal to target value Decision variables Restrictions on decision variables

Changing cells

Constraints

Should predict outcome before clicking Solve button


8-5

Solver Window
***insert Figure 8.2

8-6

Adding Constraints
Click on Add button in Parameters window

Use formula cell on left

Use number cell on right

8-7

Solver Options
Only used if need intermediate results e.g., for debugging

Scaling discussed later usually not needed


Check if decision variables known to be non-negative Check unless want to use reports
8-8

Formulation
Decision variables

What must be decided? Be explicit with units What measure compares decision variables? Use only one measure put in target cell What restrictions limit our choice of decision variables?
8-9

Objective function

Constraints

Constraints
Left-hand-side (LHS)

Usually a function Usually a number (i.e., a parameter) LHS <= RHS LHS >= RHS LHS = RHS (LT constraint) (GT constraint) (EQ constraint)
8 - 10

Right-hand-side (RHS)

Three types of constraints


Types of Constraints
LT constraints (LHS<=RHS)

Capacities or ceilings Commitments or thresholds Material balance Define related variables consistently
8 - 11

GT constraints (LHS>=RHS)

EQ constraints (LHS=RHS)

A Standard Model Template Is Recommended


Enhances ability to communicate

Provides common language Reinforces understanding how models shaped

Improves ability to diagnose errors Permits scaling more easily

8 - 12

Layout
Organize in modules

Decision variables, objective function, constraints Use color or border highlighting Use SUM or SUMPRODUCT where appropriate

Place decision variables in single row or column

Place objective in single highlighted cell

Arrange constraints to make LHS and RHS clear

Use SUMPRODUCT for LHS where appropriate


8 - 13

Ranges for Decision Variables and Constraints


Changing cells allows for commas but better to put in one contiguous range Add Constraint window allows for ranges

Group LT, GT, EQ, constraints together Enter as ranges LHS will be matched with RHS in one-to-one correspondence
8 - 14

Results
Optimal values of decision variables

Best course of action for the model Best level of performance possible Constraint is tight or binding if LHS=RHS in LT or GT constraint, otherwise slack
8 - 15

Optimal value of objective function

Constraint outcomes

Optimization Solution
Tactical information

Plan for decision variables What factors could lead to better levels of performance? Binding constraints are economic factors that restrict the value of the objective

Strategic information

8 - 16

Model Classification
Linear optimization or linear programming

Objective and all constraints are linear functions of the decision variables
Either objective or a constraint (or both) are nonlinear functions of the decision variables

Nonlinear optimization or nonlinear programming

Techniques for solving linear models are more powerful

Use wherever possible

8 - 17

Hill Climbing
Technique used by Solver for nonlinear optimization Called GRG (Generalized Reduced Gradient) algorithm Hill climbing in a fog

Try to follow steepest path going up After each step, or group of steps, again find steepest path and follow it Stop if no path leads up
8 - 18

Local and Global Optimum


The highest peak is the global optimum

What we want to find

Any peak higher than all points around it is a local optimum


What the GRG algorithm locates Except in special circumstances, there is no way to guarantee that a local optimum is the global optimum If multiple local optima, then which is found depends on starting point for decision variables may want to run Solver starting from multiple points
8 - 19

Properties of Linear Functions


Additivity Proportionality Divisibility

8 - 20

The Simplex Algorithm For Linear Optimization


1. 2. 3. Start with a feasible set of decision variables that corresponds to a corner on a diamond Check to see if a feasible neighboring corner point is better If not, stop; otherwise move to that better neighbor and return to step 2

Guaranteed to converge to the global optimal solution

8 - 21

Integer Values
If fractional decision variables not appropriate Integer linear programming

Implicitly enumerate all possible assignments of integer values runs simplex algorithm for each Reliable solution but may take a while

Integer nonlinear programming

Solvers solutions cannot be considered reliable


8 - 22

Nonlinear Programming Problems


Revenue maximization

Maximize revenue in the presence of a demand curve

Curve fitting

Fit a function to observed data points


Trade-off ordering and carrying costs for inventory
8 - 23

Economic Order Quantities

Sensitivity Analysis for Nonlinear Programs


Solver Sensitivity

Found under Sensitivity Toolkit

Inputs similar to Data Sensitivity tool Shows effect of parameter changes on optimal value of objective

Resolves optimization for each input value

8 - 24

Linear Programming Problems


Allocation models

Maximize objective (e.g., profit) subject to LT constraints on capacity


Minimize objective (e.g., cost) subject to GT constraints on required coverage Mix materials with different properties to find best blend Describe patterns of flow in a connected system
8 - 25

Covering models

Blending models

Network models

Model Scaling
Consider scaling parameters to appear in thousands or millions Saves work in data entry decreases errors Spreadsheet looks less crowded Helps with Solver algorithms

Value of objective, constraints, and decision variables should not differ from each other by more than a factor of 1000, at most 10,000

Can always display model output on separate sheet with separate units
8 - 26

Automatic Scaling
Use if scaling problems difficult to avoid Consider when:

Solver claims linearity conditions not met in a model that is definitely linear Solver reports convergence but not that the optimality conditions are satisfied in a nonlinear model

Preferable for model-builder to do the scaling


8 - 27

Sensitivity Analysis for Linear Programs


A distinct pattern to the change in the optimal solution when varying a coefficient in the objective function In some interval around the base case

No change in optimal decisions Objective will change if decision variable is positive

Outside this interval a different set of values is optimal for decision variables
8 - 28

Shadow Prices
Improvement in objective function from a unit increase (or decrease) in RHS of constraint Presented in third column of Solver Table from Solver Sensitivity Break-even price where attractive to acquire more of a scarce resource
8 - 29

Sensitivity Analysis for Binding Capacity Constraints


A distinct pattern in sensitivity tables when varying availability of scare resource In some interval around the base case:

Marginal value (shadow price) of capacity remains constant Some variables change linearly with capacity Others remain the same

Below this interval the value decreases and eventually reaches zero
8 - 30

Patterns in Linear Programming Solutions


The optimal solution tells a story about a pattern of economic priorities

Leads to more convincing explanations for solutions Can anticipate answers to what-if questions Provides a level of understanding that enhances decision making

After optimization should always try to discern the qualitative pattern in the solution

8 - 31

Constructing Patterns
Decision variables

Which are positive and which are zero?


Which are binding and which are not?

Constraints

Construct the optimal solution from the given parameters


Determine one variable at a time Can be interpreted as a list of priorities which reveal the economic forces at work
8 - 32

Defining Patterns
Qualitative description Pattern should be complete and unambiguous

Leads to full solution Always leads to same solution Should be able to trace the incremental changes to derive shadow price of constraint
8 - 33

Ask where shadow prices come from

Integer Programming
Fractional solutions are less important for strategic rather than tactical implications of model Solver constraints window allows choices of int and bin for any variable

int: variable must be an integer bin: variable must be binary, i.e, 0 or 1


Distance away from the optimal solution given solution allowed to be Default is 5% (quite large) allows for fast solutions
8 - 34

Tolerance parameter under options

Binary Variables
All or nothing variables (0 or 1) Represent go/no-go decisions PROJi = Indicator for Project i =

1 accept Project i 0 reject Project i

Can use to represent structural or policy relationships


Select at least m of the possible projects Select at most n of the possible projects

8 - 35

Logical Relationships with Binary 0/1 Variables


1. K out of N Projects Constraint
Example: Must Choose at least one of Projects 5, 6, 7
PROJ5 + PROJ6 + PROJ7 1

2. Mutually Exclusive Constraints


Example: Cant select both Project 1 and Project 3
PROJ1 + PROJ3 1

3. Contingency Constraints
Example: Project 4 cannot be done unless Project 2 is done
PROJ4 PROJ2 or PROJ4 - PROJ2 0
8 - 36

Excel Use
The logical functions in Excel (IF, AND, OR, etc.) can express logical relationships Such functions are nonlinear Models with IF statements will often stop at local optimum Using binary variables is the preferred approach
8 - 37

Fixed Costs
F fixed cost c per unit cost x units of activity (regular variable) y go/no go of activity (binary variable) Cost = Fy + cx Constraint: x <= My or x - My <= 0

M = upper bound on x x =0 if y=0 (cant have activity if no-go)

8 - 38

Threshold Levels
A decision variable must be at least as large as a specified minimum m, else it is zero x units of activity (regular variable) y go/no go of activity (binary variable) Constraints:

x >= my or x my >=0 x <= My or x - My <= 0 M = upper bound on x x >= m if y=1 (must meet minimum level if go) x = 0 if y=0 (cant have activity if no-go)
8 - 39

Guidelines for Optimization Modeling


Follow a standard form whenever possible Enter cell references in Solver windows

Keep numerical values in cells

Use linear models in preference to nonlinear Use the weak form of a constraint

Give the model maximum flexibility

8 - 40

Guidelines for Optimization Modeling (Continued)


Explore some feasible (and infeasible) possibilities as a way of debugging Test intuition and suggest hypotheses before running Solver Identify the patterns of economic priorities that appear in the solution

8 - 41

Summary
Optimization: what values of the decision variables lead to the best possible value of the objective? Excel Solver: Collection of procedures

Linear, (linear) integer, non-linear programs

Steps: Formulating, Solving, and Interpreting Results Results still need to be interpreted in the real world

Look for the pattern, or economic priorities, in solution


8 - 42

Anda mungkin juga menyukai