Introduction to Linear Programming

Download Report

Transcript Introduction to Linear Programming

Introduction to Linear Programming
Chapter 3 from L. Winston
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc.
1
Example 1: Giapetto’s Woodcarving
 Giapetto’s, Inc., manufactures wooden soldiers and trains.
 Each soldier built:
•
•
•
•
Sell for $27 and uses $10 worth of raw materials.
Increase Giapetto’s variable labor/overhead costs by $14.
Requires 2 hours of finishing labor.
Requires 1 hour of carpentry labor.
 Each train built:
•
•
•
•
Sell for $21 and used $9 worth of raw materials.
Increases Giapetto’s variable labor/overhead costs by $10.
Requires 1 hour of finishing labor.
Requires 1 hour of carpentry labor.
2
Ex. 1 - continued
 Each week Giapetto can obtain:
 All needed raw material.
 Only 100 finishing hours.
 Only 80 carpentry hours.
 Demand for the trains is unlimited.
 At most 40 soldiers are bought each week.
 Giapetto wants to maximize weekly profit (revenues – costs).
 Formulate a mathematical model of Giapetto’s situation that can be
used maximize weekly profit.
3
Example 1: Solution
 The Giapetto solution model incorporates the characteristics shared
by all linear programming problems.
 Decision variables should completely describe the decisions to
be made.
• x1 = number of soldiers produced each week.
• x2 = number of trains produced each week.
 The decision maker wants to maximize (usually revenue or profit)
or minimize (usually costs) some function of the decision
variables. This function to maximized or minimized is called the
objective function.
• For the Giapetto problem, fixed costs do not depend upon the the
values of x1 or x2.
4
Ex. 1 - Solution continued
 Giapetto’s weekly profit can be expressed in terms of the decision
variables x1 and x2:
 Weekly profit =
weekly revenue – weekly raw material costs – weekly variable
costs = 3x1 + 2x2
 Thus, Giapetto’s objective is to choose x1 and x2 to maximize weekly
profit. The variable z denotes the objective function value of any LP.
 Giapetto’s objective function is:
Maximize z = 3x1 + 2x2
 The coefficient of an objective function variable is called an objective
function coefficient.
5
Ex. 1 - Solution continued
 As x1 and x2 increase, Giapetto’s objective function grows larger.
 For Giapetto, the values of x1 and x2 are limited by the following
three restrictions (often called constraints):
 Each week, no more than 100 hours of finishing time may be
used. (2 x1 + x2 ≤ 100).
 Each week, no more than 80 hours of carpentry time may be
used. (x1 + x2 ≤ 80).
 Because of limited demand, at most 40 soldiers should be
produced. (x1 ≤ 40).
6
Ex. 1 - Solution continued
 The coefficients of the decision variables in the constraints are
called the technological coefficients. The number on the righthand side of each constraint is called the constraint’s right-hand side
(or rhs).
 To complete the formulation of a linear programming problem, the
following question must be answered for each decision variable.
 Can the decision variable only assume nonnegative values, or is
the decision variable allowed to assume both positive and
negative values?
• If the decision variable can assume only nonnegative values, the
sign restriction xi ≥ 0 is added.
• If the variable can assume both positive and negative values, the
decision variable xi is unrestricted in sign (often abbreviated urs).
7
Ex. 1 - Solution continued
 For the Giapetto problem model, combining the sign restrictions
x1≥0 and x2≥0 with the objective function and constraints yields the
following optimization model:
Max z = 3x1 + 2x2
(objective function)
Subject to (s.t.)
2 x1 + x2 ≤ 100
(finishing constraint)
x1 + x2 ≤ 80
(carpentry constraint)
x1
≤ 40
(constraint on demand for soldiers)
x1
≥0
(sign restriction)
x2 ≥ 0
(sign restriction)
8
Linearity
 A function f(x1, x2, …, xn) of x1, x2, …, xn is a linear function if and
only if for some set of constants, c1, c2, …, cn, f(x1, x2, …, xn) = c1x1
+ c 2x 2 + … + c nx n.
 For any linear function f(x1, x2, …, xn) and any number b, the
inequalities f(x1, x2, …, xn) ≤ b and f(x1, x2, …, xn) ≥ b are linear
inequalities.
9
A linear program
 A linear programming problem (LP) is an optimization problem for
which we do the following:
 Attempt to maximize (or minimize) a linear function (called the
objective function) of the decision variables.
 The values of the decision variables must satisfy a set of
constraints. Each constraint must be a linear equation or
inequality.
 A sign restriction is associated with each variable. For any
variable xi, the sign restriction specifies either that xi must be
nonnegative (xi ≥ 0) or that xi may be unrestricted in sign.
10
Linear objective functions
 The fact that the objective function for an LP must be a linear
function of the decision variables has two implications:
1. The contribution of the objective function from each decision
variable is proportional to the value of the decision variable. For
example, the contribution to the objective function for 4 soldiers
is exactly four times the contribution of 1 soldier.
2. The contribution to the objective function for any variable is
independent of the other decision variables. For example, no
matter what the value of x2, the manufacture of x1 soldiers will
always contribute 3x1 dollars to the objective function.
11
Linear constraints
 Analogously, the fact that each LP constraint must be a linear
inequality or linear equation has two implications:
1. The contribution of each variable to the left-hand side of each
constraint is proportional to the value of the variable. For
example, it takes exactly 3 times as many finishing hours to
manufacture 3 soldiers as it does 1 soldier.
2. The contribution of a variable to the left-hand side of each
constraint is independent of the values of the variable. For
example, no matter what the value of x1, the manufacture of x2
trains uses x2 finishing hours and x2 carpentry hours.
12
Other features of LP
 The first item in each list is called the proportionality assumption
of linear programming.
 The second item in each list is called the additivity assumption of
linear programming.
 The divisibility assumption requires that each decision variable be
permitted to assume fractional values.
 The certainty assumption is that each parameter (objective
function coefficients, right-hand side, and technological coefficients)
are known with certainty.
 The feasible region of an LP is the set of all points satisfying all the
LP’s constraints and sign restrictions.
 For a maximization problem, an optimal solution to an LP is a point
in the feasible region with the largest objective function value.
13
Graphical solution to a two-variable LP problem
 Any LP with only two variables can be solved graphically.
 The variables are always labeled x1 and x2 and the coordinate
axes the x1 and x2 axes.
X2
4
Satisfies 2x1 + 3x2 ≥ 6
3
2x1 + 3x2 = 6
2
Satisfies 2x1 + 3x2 ≤ 6
1
X1
-1
1
2
3
4
-1
14
Example 1 cont’d
 Since the Giapetto LP has two variables, it may be solved
graphically.
 The feasible region is the set of all points satisfying the constraints:
2 x1 + x2 ≤100
x1 + x2 ≤ 80
x1 ≤ 40
x1 ≥ 0
x2 ≥ 0
(finishing constraint)
(carpentry constraint)
(demand constraint)
(sign restriction)
(sign restriction)
15
B
finishing constraint
80
Feasible Region
D
demand constraint
60
G
z = 100
40
 The set of points
satisfying the Giapetto
LP is bounded by the
five sided polygon
DGFEH. Any point on
or in the interior of this
polygon (the shade
area) is in the feasible
region.
100
Example 1 cont’d
X2
carpentry constraint
20
F
z = 180
z = 60
E
H
10
20
40
A
50
60
C
16
80 X1
Example 1 cont’d
 Having identified the feasible region for the Giapetto LP, a search
can begin for the optimal solution which will be the point in the
feasible region with the largest z-value.
 To find the optimal solution, graph a line on which the points have
the same z-value. In a max problem, such a line is called an
isoprofit line while in a min problem, this is called the isocost line.
The figure shows the isoprofit lines for z = 60, z = 100, and z = 180.
17
Binding constraints
 A constraint is binding if the left-hand and right-hand side of the
constraint are equal when the optimal values of the decision
variables are substituted into the constraint.
 In the Giapetto LP, the finishing and carpentry constraints are
binding.
 A constraint is nonbinding if the left-hand side and the right-hand
side of the constraint are unequal when the optimal values of the
decision variables are substituted into the constraint.
 In the Giapetto LP, the demand constraint for wooden soldiers is
nonbinding since at the optimal solution (x1 = 20), x1 < 40.
18
Convex sets of points
 A set of points S is a convex set if the line segment joining any two
pairs of points in S is wholly contained in S.
 For any convex set S, a point p in S is an extreme point if each line
segment that lies completely in S and contains the point P has P as
an endpoint of the line segment.
 Extreme points are sometimes called corner points, because if the
set S is a polygon, the extreme points will be the vertices, or corners,
of the polygon.
 The feasible region for the Giapetto LP will be a convex set.
19
Linear programming solver
 By our own hand (e.g. using Simplex method)
 Using commercial solvers
 CPLEX, LINDO, …
 Using MS Excel
20
Using Excel solver to obtain LP solution
 Setting & data input
2
3
1
Max z = 3x1 + 2x2
s.t.
2 x1 + x2 ≤ 100
x1 + x2 ≤ 80
x1
≤ 40
x1, x2
≥0
21
Using Excel solver – continued
 Input formula 
 B3 =C3*C2+D3*D2
 B4 =C4*C2+D4*D2
 B5 =C5*C2+D5*D2
 B6 =C6*C2+D6*D2
4
5
6
B3 =SUMPRODUCT(C$2:D$2,C3:D3)
B3 =SUMPRODUCT(C$2:D$2,C4:D4)
B3 =SUMPRODUCT(C$2:D$2,C5:D5)
B3 =SUMPRODUCT(C$2:D$2,C6:D6)
22
Using Excel solver – continued
 Setting linear and nonnegative options 
9
7
8
23
Using Excel solver – continued
 Obtain solution
24
Example 2 : Dorian Auto
 Dorian Auto manufactures luxury cars and trucks.
 The company believes that its most likely customers are highincome women and men.
 To reach these groups, Dorian Auto has embarked on an ambitious
TV advertising campaign and will purchase 1-mimute commercial
spots on two type of programs: comedy shows and football games.
25
Ex. 2: continued
 Each comedy commercial is seen by 7 million high income women
and 2 million high-income men and costs $50,000.
 Each football game is seen by 2 million high-income women and 12
million high-income men and costs $100,000.
 Dorian Auto would like for commercials to be seen by at least 28
million high-income women and 24 million high-income men.
 Use LP to determine how Dorian Auto can meet its advertising
requirements at minimum cost.
26
Example 2: Solution
 Dorian must decide how many comedy and football ads should be
purchased, so the decision variables are:
 x1 = number of 1-minute comedy ads.
 x2 = number of 1-minute football ads.
 Dorian wants to minimize total advertising cost.
 Dorian’s objective functions is:
min z = 50x1 + 100x2
 Dorian faces the following constraints:
 Commercials must reach at least 28 million high-income women.
(7x1 + 2x2 ≥ 28).
 Commercials must reach at least 24 million high-income men.
(2x1 + 12x2 ≥ 24).
 The sign restrictions are necessary, so x1, x2 ≥ 0.
27
Ex. 2 – Solution continued
 Like the Giapetto LP, The Dorian LP has a convex feasible region.
 The feasible region for the Dorian problem, however, contains points
for which the value of at least one variable can assume arbitrarily
large values.
 Such a feasible region is called an unbounded feasible region.
28
Ex. 2 – Solution continued
 To solve this LP graphically begin by graphing the feasible region.
X2
14 B
High-income women constraint
12
10
Feasible
Region
(unbounded)
8
6
z = 600
4
z = 320
High-income men constraint
2
E
D
C
A
2
4
6
8
10
12
14
X1
29
Ex. 2 – Solution continued
 Since Dorian wants to minimize total advertising costs, the optimal
solution to the problem is the point in the feasible region with the
smallest z value.
 An isocost line with the smallest z value passes through point E and
is the optimal solution at x1 = 3.4 and x2 = 1.4.
 Both the high-income women and high-income men constraints are
satisfied, both constraints are binding.
30
Some problems
 Does the Dorian model meet the four assumptions of linear
programming?
 The proportionality assumption is violated because at a certain
point advertising yields diminishing returns.
 Even though the additivity assumption was used in writing: (Total
viewers) = (Comedy viewer ads) + (Football ad viewers) many of
the same people might view both ads, double-counting of such
people would occur thereby violating the assumption.
 The divisibility assumption is violated if only 1-minute
commercials are available. Dorian is unable to purchase 3.6
comedy and 1.4 football commercials.
 The certainty assumption is also violated because there is no
way to know with certainty how many viewers are added by each
type of commercial.
31
3.3 Special Cases
 The Giapetto and Dorian LPs each had a unique optimal solution.
 Some types of LPs do not have unique solutions.
 Some LPs have an infinite number of solutions (alternative or
multiple optimal solutions).
 Some LPs have no feasible solutions (infeasible LPs).
 Some LPs are unbounded: There are points in the feasible
region with arbitrarily large (in a maximization problem) z-values.
 The technique of goal programming is often used to choose
among alternative optimal solutions.
32
No optimal solutions
 It is possible for an LP’s feasible region to be empty, resulting in an
infeasible LP.
 Because the optimal solution to an LP is the best point in the
feasible region, an infeasible LP has no optimal solution.
 For a maximization problem, an unbounded LP occurs if it is
possible to find points in the feasible region with arbitrarily large zvalues, which corresponds to a decision maker earning arbitrarily
large revenues or profits.
 For a minimization problem, an LP is unbounded if there are points
in the feasible region with arbitrarily small z-values.
33
Example 6: Diet Problem
 My diet requires that all the food I get come from one of the four
“basic food groups”.
 At present, the following four foods are available for consumption:
brownies, chocolate ice cream, cola and pineapple cheesecake.
 Each brownie costs 50¢, each scoop of ice cream costs 20¢, each
bottle of cola costs 30¢, and each piece of pineapple cheesecake
costs 80¢.
 Each day, I must ingest at least 500 calories, 6 oz of chocolate, 10
oz of sugar, and 8 oz of fat.
34
Ex. 6 - continued
 The nutritional content per unit of each food is given in the following
table.
Type of food
Brownie
Chocolate ice
cream
Cola
Pineapple
cheesecake
Calories
400
200
Chocolate
3
2
Sugar
2
2
Fat
2
4
150
500
0
0
4
4
1
5
 Formulate a linear programming model that can be used to satisfy
my daily nutritional requirements at minimum cost.
35
Example 6: Solution
 As always, begin by determining the decisions that must be made by
the decision maker: how much of each type of food should be eaten
daily.
 Thus we define the decision variables:
 x1 = number of brownies eaten daily.
 x2 = number of scoops of chocolate ice cream eaten daily.
 x3 = bottles of cola drunk daily.
 x4 = pieces of pineapple cheesecake eaten daily.
36
Ex. 6 – Solution continued
 My objective is to minimize the cost of my diet.
 The total cost of any diet may be determined from the following
relation:
(total cost of diet) = (cost of brownies) + (cost of ice cream) +(cost of cola) +
(cost of cheesecake).
 The decision variables must satisfy the following four constraints:
 Daily calorie intake must be at least 500 calories.
 Daily chocolate intake must be at least 6 oz.
 Daily sugar intake must be at least 10 oz.
 Daily fat intake must be at least 8 oz.
37
Ex. 6 – Solution continued
 Express each constraint in terms of the decision variables.
 The optimal solution to this LP is found by combining the objective
function, constraints, and the sign restrictions.
 The chocolate and sugar constraints are binding, but the calories
and fat constraints are nonbinding.
 A version of the diet problem with a more realistic list of foods and
nutritional requirements was one of the first LPs to be solved by
computer.
38
3.5 A Work-Scheduling Problem
 Many applications of linear programming involve determining the
minimum-cost method for satisfying workforce requirements.
 The results may be different solved manually vs using CPLEX,
LINGO or Excel Solver.
 One type of work scheduling problem is a static scheduling
problem.
 In reality, demands change over time, workers take vacations in the
summer, and so on, so the post office does not face the same
situation each week. This is a dynamic scheduling problem.
39
Scheduling postal workers
 Each postal worker works for 5 consecutive days, followed by 2
days off, repeated weekly.
Day
Demand
Mon Tues Wed Thurs Fri
17
13
15
19
14
Sat
Sun
16
11
 Minimize the number of postal workers (for the time being, we will
permit fractional workers on each day.)
40
Formulating as an LP
 Select the decision variables
 Let x1 be the number of workers who start working on Monday,
and work till Friday.
 Let x2 be the number of workers who start on Tuesday …
 Let x3, x4, …, x7 be defined similarly.
41
The linear program
Day
Mon Tues Wed Thurs Fri
Demand 17
13
15
19
14
Minimize
subject
to
Sat
16
Sun
11
z = x1 + x2 + x3 + x4 + x5 + x6 + x7
x1 +
x1 + x2 +
x4 + x5 + x6 + x7  17
x5 + x6 + x7  13
x1 + x2 + x3 +
x1 + x2 + x3 + x4 +
x1 + x2 + x3 + x4 + x5
x6 + x7  15
x7  19
 14
x2 + x3 + x4 + x5 + x6
 16
x3 + x4 + x5 + x6 + x7  11
xj  0 for j = 1 to 7
42
On the selection of decision variables
 Optimal solution
 x1,…,x7 = 4/3, 10/3, 2, 22/3, 0, 10/3, 5.
 Obviously this solution doesn’t work!
 We will see that the optimal integer programming solution is
actually x1,…,x7 = 4, 4, 2, 6, 0, 4, and 3.
• Compare two optimal solutions!
43
Modeling issues
 In reality this problem actually requires a dynamic analysis rather
than the current static one.
 When the scale of problems like this one gets very large, LP ideas
become rather inefficient. Heuristic solutions may therefore be a
suitable solution technique
 The model does not allow for part-time workers or overtime hours,
and alternative objective functions may include maximizing the
number of weekend days off.
 We may need to obtain the target workloads using ideas from other
subjects like queueing theory to be able to estimate the number of
workers required each day.
44
A ratio constraint:
 Suppose that we need to ensure that at least 30% of the workers
have Sunday off.
 How do we model this?
(x1 + x2)/(x1 + x2 + x3 + x4 + x5 + x6 + x7)  .3
(x1 + x2 )  .3 x1 + .3 x2 + .3 x3 + .3 x4 + .3 x5 + .3 x6 + .3 x7
-.7 x1 - .7 x2 + .3 x3 + .3 x4 + .3 x5 + .3 x6 + .3 x7  0
45
3.8 Blending Problems
 Situations in which various inputs must be blended in some desired
proportion to produce goods for sale are often amenable to linear
programming analysis.
 Such problems are called blending problems.
 Some examples of how linear programming has been used to solve
blending problems.
 Blending various types of crude oils to produce different types of
gasoline and other outputs.
 Blending various chemicals to produce other chemicals.
 Blending various types of metal alloys to produce various types
of steels.
46
Example 12 Oil Blending
 Sunco Oil manufactures three types of gasoline.
 Each type is produced by blending three types of crude oil.
 The price of gasoline and the cost of crude oil is given in the followin
g table
Gas
1
2
3
Sale price
70
60
50
Crude
1
2
3
Cost price
45
35
25
47
Ex 12 cont’d
 It costs $4 to transfer each barrel of crude into gasoline.
 At most 5,000 barrels of each type of crude can be purchased each
day.
 At most 14,000 barrels of gas can be made each day.
 Sunco must produce at least 3000, 2000, and 1000 barrels of types
1, 2, and 3 gas to satisfy customer demand.
 This demand will increase if money is spent on advertising. Each $1
of advertising increases demand by 10 barrels of any type of gas.
48
Ex 12 cont’d
 The three types of gas and three types of crude all differ in octane
and sulfur content.
 The tables below show how much sulfur and octane the crude oil
has, and the amounts that the gasoline must have after production.
Crude
Octane rating
Sulfur content
1
12
0.5%
2
6
2.0%
3
8
3.0%
Gasoline
Minimum octane
Maximum Sulfur
1
10
1%
2
8
2%
3
6
1%
49
Ex 12 Solution
 Sunco Oil must decide how much to spend on advertising each type
of gas and how it will produce each type of gas from the three types
of crude oil.
 Let’s use ai to mean the advertising budget for each gas, and xij to
represent the number of barrels of crude i used to produce gas j.
i,j=1,2,3.
 Summing xij over i or j, gives the total amount of crude purchased or
gas sold.
 We also need to assume the production outputs cannot be stored
for later sale. That is, everything produced must be sold.
50
Ex 12 Solution cont’d
 Sunco Oil’s objective is to maximize profits using the function:
 Max z = (70-45-4)x11 + (60-45-4)x12 + (50-45-4)x13 +(70-35-4)x21
+ (60-35-4)x22 + (50-35-4)x23 + (70-25-4)x31 + (60-25-4)x32 + (5025-4)x33 – a1 – a2 – a3
 Reduction of the coefficients can be done now to simplify the
expression.
51
Ex 12 Solution cont’d
 Demand constraints come from the information given previously.
Note the increased possible demand from advertising, and that the
constraints are equalities.
 x11 + x21 + x31 – 10a1 = 3000
 x12 + x22 + x32 – 10a2 = 2000
 x13 + x23 + x33 – 10a3 = 1000
 Supply constraints:
 x11 + x12 + x13  5000
 x21 + x22 + x23  5000
 x31 + x32 + x33  5000
 Production constraint:
 i j xij  14000
52
Ex 12 Solution cont’d
 Average octane constraints:
 (12x11 + 6x21 + 8x31)/ixi1  10
 (12x12 + 6x22 + 8x32)/ixi2  8
 (12x13 + 6x23 + 8x33)/ixi3  6
 Note that these constraints have greater than or equal to limitations.
 Rearranging gives:
 2x11 – 4x21 – 2x31  0
 4x12 – 2x22  0
 6x13 + 2x33  0 (Redundant)
53
Ex 12 Solution cont’d
 Sulfur content constraints:
 (0.005x11 + 0.02x21 + 0.03x31) /ixi1  0.01
 (0.005x12 + 0.02x22 + 0.03x32) /ixi2  0.02
 (0.005x13 + 0.02x23 + 0.03x33) /ixi3  0.01
 Note that sulfur is a poison to the environment.
 Rearranging gives:
 -0.005x11 + 0.01x21 + 0.02x31  0
 -0.015x12 + 0.01x32  0
 -0.005x13 + 0.01x23 + 0.02x33  0
54
Modeling issues
 In reality we would want to run this model daily to account for
changes in the cost of crude oil and the market price obtainable for
the finished product.
 We may also want to allow for some diminishing return for the
advertising budgets.
55
3.9 Production Process Models
 An LP model can be formulated to represent a simple production
process.
 The key step is to determine how the outputs from a later stage of
the process are related to the outputs from an earlier stage.
 A common mistake in these type of LP models is with different units
of measurement in constraints.
 If there are doubts about a constraint, then make sure that all terms
in the constraint have the same units.
56
Ex 13 Brute production process
 Rylon Corp manufactures Brute and Chanelle perfumes.
 Raw material costs $3 per pound (lb).
 Processing each lb of raw material takes 1 hour of laboratory time
and yields 3oz of regular Brute and 4oz of regular Chanelle.
 Regular Brute sells for $7/oz and regular Chanelle for $6/oz.
 Regular Brute and Chanelle can be processed more to obtain luxury
Brute and Chanelle products which sells for $18/oz and $14/oz
respectively.
 1oz of luxury Brute can be made from 1oz of regular Brute with 3
hours of lab time and costs $4 for processing.
 1oz of regular Chanelle can be converted into 1oz of luxury
Chanelle using 2 hours of lab time and costs $4 for processing.
57
Ex 13 cont’d
 Rylon has 6000 hours of lab time available each year.
 A maximum of 4000 pounds of raw material is purchasable.
 Assume all other costs for the lab are fixed, and can be ignored.
 Also assume no stockpiling.
 Formulate this scenario as a LP to maximize profit.
58
Ex 13 Solution
 Decision variables need to be chosen carefully.
 x1 for annual regular Brute sales (oz)
 x2 for luxury Brute,
 x3 for regular Chanelle,
 x4 for luxury Chanelle, and
 x5 for the number of pounds of raw material to be purchased
annually.
 The objective function is therefore:
 max z = 7x1 + 14x2 + 6x3 + 10x4 – 3x5.
59
Ex 13 Solution cont’d
 Raw material constraint:
 x5  4000
 Laboratory constraint:
 3x2 + 2x4 + x5  6000
 We need to add constraints for the fact that raw material purchased
is converted into the four perfumes.
 x1 + x2 = 3x5 and
 x3 + x4 = 4x5
 Rearranging gives:
 x1 + x2 – 3x5 = 0 and
 x3 + x4 – 4x5 = 0.
60
Multiperiod Decision Problems: Inventory Model
 Up until now all the LP examples have been static, or one-period,
models.
 Linear programming can also be used to determine optimal
decisions in multiperiod, or dynamic, models.
 Dynamic models arise when the decision maker makes decisions at
more than one point in time.
 In a dynamic model, decisions made during the current period
influence decisions made during future periods.
61
Example 14: Sailco Inventory
 Sailco Corporation must determine how many sailboats should be
produced during each of the next four quarters.
 Demand is known for the next four quarters. Sailco must meet
demands on time.
 At the beginning of the first quarter Sailco has an inventory of 10
boats.
 Sailco must decide at the beginning of each quarter how many boats
should be produced during each quarter.
 Sailco can produce 40 boats (cost=$400) per quarter with regular
labor hours.
62
Ex. 14 - continued
 They can produce more if their workers work overtime. These boats
cost $450 to produce.
 At the end of each quarter a carrying or holding cost of $20 per boat
is incurred.
 Use linear programming to determine a production schedule to
minimize the sum of production and inventory costs during the next
four quarters.
63
Example 14: Solution
 For each quarter Sailco must determine the number of sailboats that
should be produced by regular-time and by overtime labor.
 The decision variables are:
 xt = number of sailboats produced by regular time labor during
quarter t
 yt = number of boats produced by overtime labor during quarter t
 it = number of sailboats on hand at the end of quarter t
 Sailco’s objective function is:
 min z = 400x1 + 400x2 + 400x3 + 400x4 + 450y1 + 450y2
+ 450y3 + 450y4 + 20i1 +20i2 +20i3+20i4
64
Ex. 14 – Solution continued
 Sailco’s constraints:
 The four constraints xt  40 ensure that each periods regular
time production does not exceed 40.
 Inventory constraints for each time period can now be added.
Let dt be the demand during quarter t,
• it = it-1 + (xt + yt) – dt
(t = 1,2,3,4)
 Note that quarter t’s demand will be met on time if and only if (iff)
it ≥ 0
 The sign restriction ensures that each quarter’s demand will be met
on time.
 All it, xt, and yt  0
 Note that any production plan that had yt  0 and xt  40 could not
be optimal.
65
3.11 Multiperiod Financial Models
 Linear programming can be used to model multiperiod cash
management problems.
 The key is to determine the relations of cash on hand during
different periods.
 One real world example is to use LP to determine a bond model that
maximizes profit from bond purchases and sales subject to
constraints that minimize the firm’s risk exposure.
66
Ex 15 Finco investment problem
 Finco must determine the investment strategy for the next three
years.
 At time 0, $100,000 is available for investment.
 There are five investments – A to E.
 The table shows the cash flows for each investment.
Investment
Time 0
Time 1
Time 2
Time 3
A
-1
0.5
1
0
B
0
-1
0.5
1
C
-1
1.2
0
0
D
-1
0
0
1.9
E
0
0
-1
1.5
67
Ex 15 cont’d
 To ensure that Finco has a diversified portfolio, at most $75,000 can
be placed in any investment.
 In addition to the five investments, Finco can earn 8% on any cash
not placed in these investments using the money markets.
 Assume that any cash inflow can be re-invested in another
investment immediately.
 No borrowing is allowed.
 Formulate the LP that will maximize the cash on hand at the end of
time 3.
68
Ex 15 Solution
 As well as the five investment decision variables, Finco must decide
how much money will be placed on the money markets.
 Let A to E mean the amount of $ invested in these investments and
St is the $ invested in the money market at time t.
 Finco must maximize the inflows of cash at time 3, giving
max z = B + 1.9D + 1.5E +1.08S2
 Note that some investments do not finish at time 3 and are left out of
the objective function.
69
Ex 15 Solution cont’d
 We need a constraint for the cash flows at each time period (0 to 2).
 A + C + D + S0 = 100000
 0.5A – B + 1.2C + 1.08S0 – S1 = 0
 A + 0.5B – E +1.08S1 – S2 = 0
 A, B, C, D, E  75000
 A, B, C, D, E, S0, S1, S2  0
70
3.12 Multiperiod Work Scheduling
 Have seen that LP can be used to schedule employees in a static
environment.
 LP can also be used to schedule employee training when a firm
faces a demand that changes over time.
71
Example 16 Multiperiod work scheduling
 CSL is a chain of computer stores that must respond to growth in
demand for its services.
 In the next five months CSL will need 6000, 7000, 8000, 9500, and
11000 hours of skilled repair time.
 At the beginning 50 skilled technicians work for CSL, and each one
can work up to 160 hours per month.
 New technicians can be hired but need training. This takes one
month. Training requires 50 hours of supervision from skilled
technicians.
 Each skilled technician costs $2000 per month, while a trainee costs
$1000 when in training.
 At the end of each month 5% of the skilled technicians leave CSL
and go to Plum Computers.
72
Ex 16 Solution
 First define the decision variables.
 Let xt be the number of trainees and yt the number of skilled
technicians at the start of month t.
 Total labor cost is therefore:
1000txt + 2000tyt
 Obviously, we wish to minimize this quantity. We know that y1=50,
but we need to know how to find the other yt.
 This is found using a generalization of:
y2 = 0.95y1 + x1
 This can be converted to give the constraints:
xt-1 + 0.95yt-1 – yt = 0
73
Ex 16 Solution cont’d
 In each month the skilled technicians either do the regular work or
train the new staff.
 The constraint for month t will be:
 160yt – 50xt  dt
 where dt is 6000, 7000, 8000, 9500, and 1000 for the next five
months.
 Note that the values of yt actually need to be integer for this
formulation to give the optimal solution exactly, but the formulation
still works quite nicely.
74
Summary
 Remember that any formulation must have an objective function,
decision variables, and constraints.
 The most difficult part of the problem is the definition of the decision
variables. Getting these wrong will stuff it all up. Getting them right is
an art – there is not always one way to generate a set of decision
variables.
 Keep things as simple as you need to.
 Make sure all word constraints are turned into inequality or equality
constraints.
75
Homework #1
 A company supplies goods to three customers, who each require 30
units. The company has two warehouses. Warehouse 1 has 40 units
available, and warehouse 2 has 30 units available. The cost of
shipping 1 unit from warehouse to customer are shown in the table
below. There is a penalty for each unmet customer unit of demand:
With customer 1, a penalty cost of $90 incurred; with customer 2,
$80, and with customer 3, $110. Formulate an LP to minimize the
sum of shortage and shipping costs, and obtain the optimal shipping
plan.
To
From
Customer 1
Customer 2
Customer 3
Warehouse 1
$15
$35
$25
Warehouse 2
$10
$50
$40
76
Homework #2



You own a wheat warehouse with a capacity of
20,000 bushels. At the beginning of month 1, you
have 6,000 bushels of wheat. Each month, wheat
can be bought and sold at the price per 1,000
bushels given in the table on the right.
The sequence of events during each month is as
follows:
a. You observe our initial stock of wheat
b. You can sell any amount of wheat up to your
initial stock at the current month’s selling
price.
c. You can buy (at the current month’s buying
price) as much wheat as you want, subject to
the warehouse size limitation.
Your goal is to formulate an LP that can be used
to determine how to maximize the profit earned
over the next 10 months, and to get the optimal
solution.
Selling
Month Price ($)
Purchasing
Price ($)
1
3
8
2
6
8
3
7
2
4
1
3
5
4
4
6
5
3
7
5
3
8
1
2
9
3
5
10
2
5
77