The Solver and Mathematical Programing

download The Solver and Mathematical Programing

of 39

Transcript of The Solver and Mathematical Programing

  • 8/14/2019 The Solver and Mathematical Programing

    1/39

    The Solver and MathematicalProgramming

  • 8/14/2019 The Solver and Mathematical Programing

    2/39

    2

    Overview

    Introduction

    Formulating Mathematical Programs

    The Excel SolverApplications of the Solver

    Summary

  • 8/14/2019 The Solver and Mathematical Programing

    3/39

    3

    Introduction

    Formulating a mathematical program by determining its decision

    variables, constraints, and objective function

    The difference between linear, integer, and nonlinear programmingproblems

    Using the Excel Solver to solve a mathematical program

    Preparing the spreadsheet with the model parts and then enter thecorresponding cells into the Solver window

    Reading the Solver reports

    Example linear, integer, and nonlinear programming problems

  • 8/14/2019 The Solver and Mathematical Programing

    4/39

    4

    Formulating Mathematical Programs

    Parts of the Mathematical Program

    Linear, Integer, and Nonlinear Programming

  • 8/14/2019 The Solver and Mathematical Programing

    5/39

    5

    Parts of the Mathematical Program

    Decisio n Variables= variables assigned to a quantity or response thatmust be determined in the problem

    Object ive Funct io n= equation which states the goal of the model Maximize

    Minimize

    Constraints= equations which state limitations of the problem

    To solve the model, each constraint must be considered simultaneously

    in conjunction with the objectivefunction

  • 8/14/2019 The Solver and Mathematical Programing

    6/39

    6

    Linear Integer and Nonlinear Programming

    Linear Programm ingproblem = there is a linear relationship among all

    constraints and the objectivefunction

    Integer Programm ingproblem = decisionvariables can only take

    integer values in a given range (these integer values can also be

    boolean= 0 or 1 only)

    Nonl inear Programm ing problem = do not have a linear objective

    function and/or constraints. NLP problems must use more challenging

    methods to solve these complex equations.

  • 8/14/2019 The Solver and Mathematical Programing

    7/39

    7

    The Excel Solver

    The Solver Steps

    Understanding Solver Reports

  • 8/14/2019 The Solver and Mathematical Programing

    8/398

    The Solver Steps

    Step 1: Read and Interpret the Problem

    Step 1.1: determine the decision variables Step 1.2: state the objective function

    Step 1.3: state any constraints

    Step 2: Prepare the Spreadsheet

    Step 2.1: Enter the decision variables Step 2.2: Enter the constraints

    Step 2. 3: Enter the objective function

    Step 3: Solve the model with the Solver

    Step 3.1: Set the Target Celland choose Minor Max Step 3.2: Select Changin g Cel ls

    Step 3.3: Add Constraints

    Step 3.4: Set SolverOpt ions

    Step 3.5: Solve and review Results

  • 8/14/2019 The Solver and Mathematical Programing

    9/399

    Product Mix Problem

    A company produces six different types of products. They want to schedule their

    production to determine how much of each product type should be produced inorder to maximize their profits. This is known as the Product Mix problem.

    Production of each product type requires labor and raw materials; but thecompany is limited by the amount of resources available. (Labor hours available4500 and Raw Material available 1600 boards)

    There is also a limited demand for each product, and no more than this demandper product type can be produced. Input tables for the necessary resources andthe demand are given.

    Product

    Type 1

    Product

    Type 2

    Product

    Type 3

    Product

    Type 4

    Product

    Type 5

    Product

    Type 6

    Labor 6 5 4 3 2.5 1.5

    Raw Material 3.2 2.6 1.5 0.8 0.7 0.3

    Unit price $12.50 $11.00 $9.00 $7.00 $6.00 $3.00

    Variable cost $6.50 $5.70 $3.60 $2.80 $2.20 $1.20

    Demand 960 928 1041 977 1084 1055

  • 8/14/2019 The Solver and Mathematical Programing

    10/3910

    Step 1

    Decision Variables: The amount produced of each product type

    x1, x2, x3, x4, x5, x6

    Objective Function: Maximize Profitz = p1*x1 + p2*x2 + p3*x3 + p4*x4 + p5*x5 + p6*x6

    Constraints:Labor Constraint:

    l1*x1 + l2*x2 + l3*x3 + l4*x4 + l5*x5 + l6*x6

  • 8/14/2019 The Solver and Mathematical Programing

    11/3911

    Step 2

    The spreadsheet should have each part of the model clearly entered

  • 8/14/2019 The Solver and Mathematical Programing

    12/3912

    Step 3

    The Solverparameters can now be set according to the cell references

    with the appropriate model parts

  • 8/14/2019 The Solver and Mathematical Programing

    13/3913

    Step 3 (contd)

    SolverOptionsshould also now be set

  • 8/14/2019 The Solver and Mathematical Programing

    14/3914

    Figure 8.11

    The results of the Solver are shown

    All constraints are met

  • 8/14/2019 The Solver and Mathematical Programing

    15/3915

    Applications of the Solver

    Transportation Problem (Linear Programming)

    Workforce Scheduling (Integer Programming)

    Capital Budgeting (Integer Binary Programming)

    Warehouse Location (Non-Linear Programming)

  • 8/14/2019 The Solver and Mathematical Programing

    16/3916

    Transportation Problem

    A company ships their products from three different plants (one in LA, one inAtlanta, and one in New York City) to four regions of the United States (East,Midwest, South, West).

    Each plant has a capacity on how many products can be sent out, and eachregion has a demand of products they must receive.

    There is a different transportation cost between each plant, or each city, andeach region.

    The company wants to determine how many products each plant should ship toeach region in order to minimize the total transportation cost.

    EAST MIDWEST SOUTH WEST CAPACITYLA $5.00 $3.50 $4.20 $2.20 10000

    ATLANTA $3.20 $2.60 $1.80 $4.80 12000

    NEW YORK CITY $2.50 $3.10 $3.30 $5.40 14000

    DEMAND 9000 6000 6000 13000

  • 8/14/2019 The Solver and Mathematical Programing

    17/3917

    Transportation Problem (contd)

    Decision variables:

    The amount to ship from each plant to each region

    Constraints :

    Demand: the total number of products received by a region (from each plant)is greater than or equal to its demand

    Capacity: the total number of products shipped from a plant (to each region)is less than or equal to its capacity

    Objective function:

    Minimize the total transportation costs

  • 8/14/2019 The Solver and Mathematical Programing

    18/3918

    Prepare the spreadsheet

  • 8/14/2019 The Solver and Mathematical Programing

    19/3919

    The Solver window

  • 8/14/2019 The Solver and Mathematical Programing

    20/3920

    The solution

  • 8/14/2019 The Solver and Mathematical Programing

    21/3921

    Workforce Scheduling

    A company wants to schedule its employees for every day of the week.

    Employees work 5 days consecutively, so the company wants toschedule on which day each employee starts working; that is how manyemployees start working each day.

    There is a certain number of employees needed each day of the week.

    The objective function is to find the schedule which minimizes the totalnumber of employees working for the week.

    Monday Tuesday Wednesday Thursday Friday Saturday Sunday

    Number needed 17 13 15 17 9 9 12

  • 8/14/2019 The Solver and Mathematical Programing

    22/3922

    Workforce Scheduling (contd)

    Decision variables:

    The number of employees that will begin working (for 5 consecutive days) oneach day of the week

    Constraints:

    The total number of employees working on a given day (regardless of which

    day they started working) is greater than or equal to the number ofemployees needed on that particular day

    objective function

    Minimize the total number of employees needed

  • 8/14/2019 The Solver and Mathematical Programing

    23/3923

    Figure 8.23

    Prepare the spreadsheet

  • 8/14/2019 The Solver and Mathematical Programing

    24/3924

    Figure 8.24

    The Solver window

  • 8/14/2019 The Solver and Mathematical Programing

    25/3925

    Figure 8.25

    The solution

  • 8/14/2019 The Solver and Mathematical Programing

    26/3926

    Integer constraint must be added

  • 8/14/2019 The Solver and Mathematical Programing

    27/39

    27

    Updated solution

  • 8/14/2019 The Solver and Mathematical Programing

    28/39

    28

    Capital Budgeting

    There are 20 projects that a company, or individual, can invest in.

    Each project has a net present value (NPV) and cost per year given.

    The company, or investor, wants to determine how much to invest ineach project, given a limited amount of yearly funds available, in order tomaximize the total NPV of the investment.

  • 8/14/2019 The Solver and Mathematical Programing

    29/39

    29

    Capital Budgeting (contd)

    Decision variables:

    Which projects we do and do not invest in

    Constraints:

    No more than the yearly available funds can be spent each year

    Objective Function:

    Maximize the total NPV

  • 8/14/2019 The Solver and Mathematical Programing

    30/39

    Inputs

    30

    NPV Cost Year 1 Cost Year 2 Cost Year 3 Cost Year 4 Cost Year 5 Cost Year 6

    Project 1 $928 $398 $180 $368 $111 $108 $123

    Project 2 $908 $151 $269 $248 $139 $86 $83

    Project 3 $801 $129 $189 $308 $56 $61 $23

    Project 4 $543 $275 $218 $220 $54 $70 $59

    Project 5 $944 $291 $252 $228 $123 $141 $70

    Project 6 $848 $80 $283 $285 $119 $84 $37

    Project 7 $545 $203 $220 $77 $54 $44 $42Project 8 $808 $150 $113 $143 $67 $101 $43

    Project 9 $638 $282 $141 $160 $37 $55 $64

    Project 10 $841 $214 $254 $355 $130 $72 $62

    Project 11 $664 $224 $271 $130 $51 $79 $58

    Project 12 $546 $225 $150 $33 $35 $107 $63

    Project 13 $699 $101 $218 $272 $43 $90 $71Project 14 $599 $255 $202 $70 $3 $75 $83

    Project 15 $903 $228 $351 $240 $60 $93 $80

    Project 16 $859 $303 $173 $431 $60 $90 $41

    Project 17 $748 $133 $427 $220 $59 $40 $39

    Project 18 $668 $197 $98 $214 $95 $96 $74

    Project 19 $888 $313 $278 $291 $66 $75 $74

    Project 20 $655 $152 $211 $134 $85 $59 $70Available $2,500 $2,800 $2,900 $900 $900 $900

  • 8/14/2019 The Solver and Mathematical Programing

    31/39

    31

    Prepare the spreadsheet

  • 8/14/2019 The Solver and Mathematical Programing

    32/39

    32

    A binary constraint

    The Solver window

  • 8/14/2019 The Solver and Mathematical Programing

    33/39

    33

    The solution

  • 8/14/2019 The Solver and Mathematical Programing

    34/39

    34

    Warehouse Location

    A company stores all of its products in one warehouse.

    It has customers in cities around the United States and is trying todetermine the best location of their warehouse in order to minimize thetotal transportations costs.

    Each citys location is given by its latitude and longitude. The number of

    shipments made to each city is also given. We are to determine thewarehouse location based on its latitude and longitude values.

  • 8/14/2019 The Solver and Mathematical Programing

    35/39

    35

    Warehouse Location (contd)

    Decision variable:

    The latitude and longitude values of the location of the warehouse

    Constraints:

    The latitude and longitude for the warehouse location must be between thevalues of 0 and 120

    Objective function:

    Minimize the total distance traveled from the warehouse to each city

    Distance=69*SQRT((WHLat-state_lat)^2+(WHLong-state_long)^2)

  • 8/14/2019 The Solver and Mathematical Programing

    36/39

    36

    Prepare the spreadsheet

  • 8/14/2019 The Solver and Mathematical Programing

    37/39

    37

    The Solver window

  • 8/14/2019 The Solver and Mathematical Programing

    38/39

    38

    The solution

    S

  • 8/14/2019 The Solver and Mathematical Programing

    39/39

    Summary

    The three parts of a mathematical model, decision variables, objective

    function, and constraints.

    The three primary types of mathematical models are linear, integer, andnonlinear programming problems.

    Using Solver involves three main steps: reading and interpreting theproblem to determine the three parts of the model; preparing thespreadsheet so that Solver can read the data; and running the Solver.

    LP examples are Transportation and Workforce Scheduling. An IPexample is Capital Budgeting, and an NLP example is the WarehouseLocation problem.