Chapter 4
Linear Programming Models
Goals of This Chapter:
Illustrate Various Applications
– Staff Scheduling / planning
– Aggregate Planning
– Financial Planning
Increasing Your Facility in Modeling LP Problem
More skills in using Excel
Some nonsmooth functions with Solver
2
This Class:
Identify Appropriate Decision
Variables
3
Ex 4.2 Static Work Force Scheduling
A post office requires different numbers of full-
time employees on different days of the week. Monday 17
Tuesday 13
Union rules state that each full-time employee
Wednesday 15
must work 5 consecutive days and then
receive 2 days off. Thursday 19
The post office wants to meet its daily Friday 14
requirements using only full-time employees. Saturday 16
Its objective is to minimize the number of full- Sunday 11
time employees that must be hired.
Information needed:
-Total number of employees?
-Number available each day?
-Following the rule? 4
Modeling
Objective
Decision variables?
– Should allow you to compute the objective value, and determine whether the requirements are satisfied.
xi: # of staffs start their shift on day-i
1 2 3 4 5 6 7
x1 x1 x1 x1 x1
x2 x2 x2 x2 x2
x3 x3 x3 x3 x3
x4 x4 x4 x4 x4
x5 x5 x5 x5 x5
x6 x6 x6 x6 x6
x7 x7 x7 x7 x7
5
Modeling
Target cell (objective):
Total # of full time Employees
Changing cells (decision variables):
# of Employees start their 5-day shift on each day
6
Solution
Non- integer vs. Integer solution
No solution can exactly match available workers to daily requirements.
All solutions have surplus workers some days. Sometimes the optimal
solution to a modeling problem is not the “perfect” solution you were hoping
for.
You may get a different schedule that is still optimal. This is a case of
multiple optimal solutions and is not uncommon.
7
Modeling Issues
1. This is a static model: we assume that the post office faces the
same situation each week.
2. Our model can be easily expanded to handle part-time
employees, use of overtime, and alternative objectives such as
maximizing the number of weekend days off received by
employees.
8
Ex 4.4 Blending Problem
Decision variables?
Linear Programming Model when ever possible!
9
Ex 4.4 Blending Problem
Chandler Oil has available 5000 barrels of crude oil 1 and 10000
barrels of crude oil 2.
Each barrel of crude oil 1 has a quality level of 10. Each barrel of
crude oil 2 has a quality level of 5.
Chandler sells gasoline and heating oil. These products are
produced by blending together the two crude oils.
Gasoline needs an average quality level of at least 8, while
heating oil must have an average quality level of at least 6.
Note: If x1 barrels of oil 1 and x2 barrels of oil 2 are blended, the
quality level of the product is (10x1+5x2)/(x1+x2).
10
Background Information
Gasoline sells for $25 per barrel and heating oil for $20.
The advertising cost to sell one barrel of gasoline is $0.20 and
the advertising cost to sell one barrel of heating oil is $0.10.
We assume that demand for heating oil and gasoline is unlimited,
so that all of Chandler’s production can be sold.
Chandler wants to maximize profits.
11
Modeling
Objective?
Decision variables?
– Should allow you to determine
• How much gasoline and heating oil are produced
• How much Oil 1 and Oil 2 are used
• Whether the quality requirements are satisfied.
12
Decision variables:
x1 and y1: amount of oil 1 used to produce gasoline and
heating oil respective;
x2 and y2: amount of oil 2 used to produce gasoline and
heating oil respective.
Then,
Gasoline produced: x1+x2;
Heating oil produced: y1+y2;
Quality levels:
(10x1+5x2)/(x1+x2)
(10y1+5y2)/(y1+y2)
13
Constraints:
Quality levels requirements:
(10x1+5x2)/(x1+x2) ≥ 8
(10y1+5y2)/(y1+y2) ≥ 6
(10x1+5x2) ≥ 8 (x1+x2)
(10y1+5y2) ≥ 6 (y1+y2)
14
Formulation
To model Chandler’s problem, we must keep track of:
– The number of barrels of gasoline and heating oil produced (the
outputs)
– Output quality level
– The total profit earned
15
Developing the Model
Quality achieved. Begin by calculating for each output the
number of quality points (QP) in the inputs used to produce this
output:
QP in gasoline = 10 * (Oil 1 in gasoline) + 5 * (Oil 2 in gasoline)
QP in heating oil = 10 * (Oil 1 in heating oil) + 5 * (Oil 2 in heating oil)
For the gasoline produced to have a quality level of at least 8, we
must have
QP in gasoline 8 * Gasoline sold
For the heating oil produced to have a quality level of at least 6,
we must have
QP in heating oil 6 * Heating Oil sold
16
Modeling Issues
1. It might appear more natural to write the quality constraint as:
(QP in gasoline)/(Gasoline sold) 8
While this is logically correct, it has two problems.
– It is conceivable that no gasoline should be sold.
– We have to maintain linear formulation.
What we did is to “clear denominators” in blending problem
constraints.
17
Modeling Issues
2. We have assumed that the quality level is a linear combination.
E.g., if gasoline is made with a fraction 3/5 of crude oil 1 and 2/5
of crude oil 2, then
Quality Level of Gasoline = 3/5 * Quality Level of Oil 1
+ 2/5 * Quality Level of Oil 2
If the quality level of the output is not a linear function, then we
no longer have a linear model; we have a nonlinear model.
18
Optimal Solution
Chandler should make 5000 barrels of gasoline with 3000 barrels
of crude oil 1 and 2000 barrels of crude oil 2.
It should also make 10,000 barrels of heating oil with 2000 barrels
of crude oil 1 and 8000 barrels of crude oil 2.
Clearly, gasoline is more profitable per barrel than heating oil, but
given the crude availability and the quality constraints, it turns out
that Chandler should sell twice as much heating oil as gasoline.
This would have been difficult to guess ahead of time.
19
Example 4.3
Aggregate Planning Models
Workforce planning and production
scheduling for multiple periods
Non-smooth function such as IF()
Background Information
During the next four months the SureStep Company must
meet (on time) the demands for pairs of shoes: 3000 in
month 1; 5000 in month 2; 2000 in month 3; and 1000 in
month 4.
At the beginning of month 1, 500 pairs of shoes are on
hand, and SureStep has 100 workers.
A worker is paid $1500 per month. Each worker can work
up to 160 hours a month in regular time.
A worker can be forced to work 20 hours of overtime per
month and is paid $13 per hour for overtime labor.
21
Background Information
It takes 4 hours of labor and $15 of raw material to
produce a pair of shoes.
At the beginning of each month workers can be hired or
fired. Each hired worker costs $1600, and each fired
worker cost $2000.
At the end of each month, a holding cost of $3 per pair of
shoes left in inventory is incurred. Production in a given
month can be used to meet that month’s demand.
SureStep wants to us LP to determine its optimal
production schedule and labor policy.
22
Formulation
Production quantity
Production capacity
(Labour hours available)
Workers previously had, # hired, # fired,
overtime hours used
23
Formulation
To model SureStep’s problem with a spreadsheet, we
must keep track of the following:
– Number of workers hired, fired, and available
during each month.
– Number of overtime hours used each month
– Number of pairs of shoes produced each month
with regular time and overtime labor
– Beginning and ending inventory of shoes each
month
– Monthly costs and the total costs
24
Developing the Model
Integer constraints. Although this is optional, we decided
to constrain the number hired and fired to be integers.
We could have also constrained the Production range to
be integers.
25
Optimal Solution
Observe that SureStep should never hire any workers, and it
should fire 6 workers in month 1, 1 worker in month 2, and
43 workers in month 3.
80 hours of overtime are used, but only in month 2.
The company produces slightly over 3700 pairs of shoes
during each of the first 2 months, 2000 pairs in month 3, and
1000 in month 4. A total cost of $692,820 is incurred.
26
Use Integer Constraints / Optimality
We would not force the number of pair of shoes produced
each month to be an integer. It makes little difference
whether the company produces 3760 or 3761 pairs of
shoes during a month.
It is more important to ensure that the number of workers
hired and fired each month is an integer.
If you want to ensure that Solver finds the optimal
solution, we could go into Options and set the tolerance to
0. (But the Solver may take a long time or forever.)
Otherwise, Solver might stop when it finds a solution that
is close to optimal.
27
Model with Backlogging
In many situations, backlogging is allowed, i.e., customer
demand can be met later than it occurs.
We assume that at the end of each month a cost of $20 is
incurred for each unit of demand that remains unsatisfied
at the end of the month.
This is modeled by allowing a month’s ending inventory to
be negative. The ending inventory of the last month,
month 4, should be nonnegative. This ensures that all
demand will eventually be met by the end of the four-
month horizon.
We need to modify the monthly cost computations to
incorporate the costs due to shortages. 28
Some non-linear / non-smooth functions
If(): y = if(x≥0,x,-x)
Min(): y= min(a,x)
Max(): y=max(a,x)
Abs(): y=abs(x-a)
29
Model with Backlogging
Use IF function to calculate the holding and shortage cost
– Non-linear
– May not be able to find the optimal solutions.
30
Model with Backlogging
To handle shortages while maintaining a linear formulation, the
key observations are the followings:
– Let Lt be the amount leftover in inventory at the end of month t, St be the
amount short at the end of month t and It be the ending inventory of
month t. Then
• If It ≥ 0, then St =0, It = Lt ; If It < 0, then Lt =0, It = -St;
• Either Lt or St should be 0, and It = Lt – St.
– If X and Y are minimum non-negative numbers such that It = X – Y, then
X = Lt and Y = St
Make Lt and St to be changing cells, with It = Lt – St
31
If X and Y are minimum non-negative numbers such that
It = X – Y, then X = Lt and Y = St :
1. For X and Y above, either X or Y should be 0;
2. If It >0, then Y=0 and It = X ;
if It < 0, then X=0 and It = – Y;
if It = 0, then X=Y=0 and It = X= – Y
32
Optimal Solution
This solution is quite similar to the solution with no
backlogging allowed, but now SureStep fires more
workers in month 3 than before, and it purposely incurs
shortages in months 2 and 3.
With more options – it can now backlog demand if it
desires – the company’s total cost cannot be any more
than when backlogging was not allowed.
However, the decrease is a rather minor one from
$692,820 to $690,180.
33
Ex 4.6 Financial Problem: Investment Strategy
Barney-Jones Investment Co has $100,000 to invest for the
next 4 years.
There are 5 possible investments:
– A: Invest at the beginning of year 1, and for every dollar invested, there
are returns of $0.50 and $1.00 at the beginning of years 2 and 3;
– B: Invest at the beginning of year 2, receive returns of $0.50 and $1.00 at
the beginning of years 3 and 4;
– C: Invest at the beginning of year 1, receive return of $1.20 at the
beginning of year 2;
– D: Invest at the beginning of year 4, receive return of $1.90 at the
beginning of year 5;
– E: Invest at the beginning of year 3, receive return of $1.50 at the
beginning of year 4.
34
Ex 4.6 (cont’d)
To create a diversified portfolio, the company decides to limit
the amount for any investment to $75,000.
Any cash not invested in any year can be put in a short-term
money market account that earns 3% annually.
The company wants to maximize the cash on hand at the
beginning of year 5.
35
Formulation
Changing cells: amount put in each investment;
Keep track of the following information in each year:
– Cash amount available before investment
• Beginning cash
• Return from previous investment
– Cash amount available after investment
Key: Arrange the data so that you can easily compute the total
cash outlays (to investment) and cash returns (from investment)
each year for given values of changing cells.
36
Formulation
How to revise the model if Barney-Jones can get 1 year loans for
an interest rate of 7%?
37
Assignments for Chapter 4
Exercises:
#10, 11, 23, 58, 18, 47, 63, 119.
Homework:
- Case 4.1
- Due date: Nov. 2
38