Exercise Session 1
Exercise Session 1
Contents
Formulating linear programming problems (LPs), Chapter 3 1
Winston (2004), Section 3.2, Problem A3† . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Winston (2004), Section 3.2, Problem A5† . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Winston (2004), Section 3.5, Problem B6† . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Winston (2004), Section 3-9, Problem B6† . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Winston (2004), Section 3.9, Problem B7† . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Winston (2004), Section 3.10, Problem B4† . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Winston (2004), Section 3.10, Problem B6† . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Winston (2004), Section 3.10, Problem B9† . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Acronyms 13
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Formulating linear programming problems (LPs), Chapter 3
Winston (2004), Section 3.2, Problem A3†
Leary Chemicals manufactures three chemicals: A, B, and C. These chemicals are produced via
two production processes: 1 and 2. Running process 1 for an hour costs $4 and yields 3 units of
A, 1 of B, and 1 of C. Running process 2 for an hour costs $1 and produces 1 unit of A and 1 of
B. To meet customer demands, at least 10 units of A, 5 of B, and 3 of C must be produced daily.
Graphically determine a daily production plan that minimises the cost of meeting Leary Chemical’s
daily demands.
subject to
3x1 + x2 ≥ 10 (Chemical A)
x1 + x2 ≥ 5 (Chemical B)
x1 ≥ 3 (Chemical C)
xi ≤ 24 ∀i ∈ {1, 2} (Limited hours per process)
xi ≥ 0 ∀i ∈ {1, 2} (Sign restrictions)
The graphical solution is given in Figure 1. The optimal solution is to run process A for 3 hours,
x2
24
22
20
18
16
14
12
10
0 x1
0 2 4 6 8 10 12 14 16 18 20 22 24
x1 = 3, and process B for 2 hours, x2 = 2, which will result in a minimum cost of z = $14.
1
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3.2, Problem A5†
Furnco manufactures desks and chairs. Each desk uses 4 units of wood, and each chair uses 3. A
desk contributes $40 to profit, and a chair contributes $25. Marketing restrictions require that the
number of chairs produced be at least twice the number of desks produced. If 20 units of wood are
available, formulate an LP to maximize Furnco’s profit. then graphically solve the LP.
subject to
The graphical solution is given in Figure 2. The optimal solution is to produce 2 desks, xd = 2 and
xc
7
0 xd
0 1 2 3 4 5
2
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3.5, Problem B6†
During each 6-hour period of the day, the Bloomington Police Department needs at least the number
of policemen shown in Table 1. Policemen can be hired to work either 12 consecutive hours or 18
Table 1
consecutive hours. Policemen are paid $4 per hour for each of the first 12 hours a day they work
and are paid $6 per hour for each of the next 6 hours they work in a day. Formulate an LP that can
be used to minimize the cost of meeting Bloomington’s daily police requirements.
We first define the set of shifts as S = {1, . . . , 4} where shift 1 start 12 a.m., shift 2 starts 6 a.m.,
etc. The decision variables are then defined as
xi ≜ the number of policemen starting their 12-hour shift in shift i ∈ S .
yi ≜ the number of policemen starting their 18-hour shift in shift i ∈ S .
The LP is then formulated as follows.
X
min z = (48xi + 84yi )
S
i∈S
subject to
x1 + x4 + y1 + y3 + y4 ≥ 12 (Shift 1)
x1 + x2 + y1 + y2 + y4 ≥ 8 (Shift 2)
x2 + x3 + y1 + y2 + y3 ≥ 6 (Shift 3)
x3 + x4 + y2 + y3 + y4 ≥ 15 (Shift 4)
xi , yi ≥ 0 ∀i ∈ S (Sign restrictions)
3
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3-9, Problem B6†
Daisy Drugs manufactures two drugs: 1 and 2. The drugs are produced by blending two chemicals:
1 and 2. By weight, drug 1 must contain at least 65% chemical 1, and drug 2 must contain at
least 55% chemical 1. Drug 1 sells for $6/oz, and drug 2 sells for $4/oz. Chemicals 1 and 2 can be
produced by one of two production processes. Running process 1 for an hour requires 3oz of raw
material and 2 hours of skilled labor and yields 3oz of each chemical. Running process 2 for an hour
requires 2oz of raw material and 3 hours of skilled labor and yields 3oz of chemical 1 and 1oz of
chemical 2. A total of 120 hours of skilled labor and 100oz of raw material are available. Formulate
an LP that can be used to maximize Daizy’s sales revenue.
We let
pi ≜ the number of hours to run process i ∈ {1, 2}.
xij ≜ the amount (in oz) of chemical i ∈ {1, 2} used in drug j ∈ {1, 2}.
The formulation is then the following.
subject to
x11
≥ 0.65 (Chemical 1 in drug 1)
x11 + x21
x12
≥ 0.55 (Chemical 1 in drug 2)
x12 + x22
3p1 + 3p2 = x11 + x12 (Chemical 1)
3p1 + p2 = x21 + xP 22 (Chemical 2)
3p1 + 2p2 ≤ 100 (Raw material)
2p1 + 3p3 ≤ 120 (Skilled labor)
xij , pi ≥ 0 ∀i, j ∈ {1, 2} (Non-negativity)
The constraints dealing with the percentage of chemical 1 can be linearised as follows.
4
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3.9, Problem B7†
Lizzie’s Dairy produces cream cheese and cottage cheese. Milk and cream are blended to produce
these two products. Both high-fat and low-fat milk can be used to produce cream cheese and cottage
cheese. High-fat milk is 60% fat; low-fat milk is 30% fat. The milk used to produce cream cheese
must average at least 50% fat and that for cottage cheese, at least 35% fat. At least 40% (by weight)
of the inputs to cream cheese and at least 20% (by weight) of the inputs to cottage cheese must be
cream. Both cottage cheese and cream cheese are produced by putting milk and cream through the
cheese machine. It costs 40c to process 1 lb of inputs into a pound of of cream cheese. It costs 40c to
produce 1 lb of cottage cheese, but every pound of input for cottage cheese yields 0.9 lb of cottage
cheese and 0.1 lb of waste. Cream can be produced by evaporating high-fat and low-fat milk. It
costs 40c to evaporate 1 lb of high-fat milk. Each pound of high-fat milk that is evaporated yields
0.6 lb of ream. It costs 40c to evaporate 1 lb of low-fat milk. Each pound of low-fat milk that is
evaporated yields 0.3 lb of cream.
Each day, up to 3,000 lb of input may be sent to the cheese machine. Each day, at least 1,000 lb
of cottage cheese must be produced. Up to 1,500 lb of cream cheese and 2,000 lb of cottage cheese
can be sold each day. Cottage cheese is sold for $1.20/lb and cream cheese for $1.50/lb. High-fat
milk is purchased for 80c/lb and low-fat milk for 40c/lb. The evaporator can process at most 2,000 lb
of milk daily. Formulate an LP that can be used to maximize Lizzie’s daily profit.
From a conceptual point of view, Figure 3 illustrates the logic in the production process of Lizzy’sDairy.
Unlimited supply
@ $0.80/lb
High-fat Cream
100% yield
h1
y1 x1
milk cheese
e1 Min demand: 1000 lb/day
Max demand: 1500 lb/day
$0.40/lb of Selling price: $1.50/lb
input material h2 c1
60% yield
Capacity: 3000 lb/day
Cheese machine
30% yield
$0.40/lb of
l1 c2
input material
e2
90% yield
y2
Low-fat Cottage x2
milk l2 cheese
Unlimited supply Min demand: 1000 lb/day
@ $0.40/lb Max demand: 2000 lb/day
Selling price: $1.20/lb
5
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
e2 ≜ be the amount of low-fat milk sent through the evaporator
h1 ≜ be the amount of high-fat milk used in cream cheese
h2 ≜ be the amount of high-fat milk used in cottage cheese
l1 ≜ be the amount of low-fat milk used in cream cheese
l2 ≜ be the amount of low-fat milk used in cottage cheese
c1 ≜ be the amount of cream used in cream cheese
c2 ≜ be the amount of cream used in cottage cheese
Then we could model the problem as
subject to
In the model, (1) represents the maximum profit, and could be taken a further step by simplifying x1
and x2 . Constraints (3) and (4) addresses the evaporator and the cheese machines’ capacities. The
demand for cream cheese, both minimum and maximum, is addressed by (7) and (8), respectively.
Similarly, cottage cheese’s demands are addressed by (9) and (10), respectively. The cream used
must be greater than or equal to the cream produced, according to (11). The amount of high-fat and
low-fat milk purchased is determined in (12) and (13), respectively. The fat content requirement is
enforced by (14) for cream cheese, and by (15) for cottage cheese. Similarly, (16) and (17) enforces
the cream content constraint.
6
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Lingo code for the Lizzy’s Dairy problem (Winston, 2004, Section 3.9, Problem 7)
Model: Title Lizzie’s Dairy;
[Cream_cheese] x1 = h1 + c1 + l1;
[HighFat_milk] y1 = h1 + h2 + e1;
[LowFat_milk] y2 = l1 + l2 + e2;
End
7
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Lingo solution for the Lizzy’s Dairy problem (Winston, 2004, Section 3.9, Problem 7).
Local optimal solution found at step: 20
Objective value: -159.2593
8
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3.10, Problem B4†
A manufacturing company produces two types of products: A and B. The company has agreed
to deliver the products on the schedule shown in Table 2. The company has two assembly lines, 1
Table 2
Date A B
March 31 5,000 2,000
April 30 8,000 4,000
and 2, with the available production hours shown in Table 3. The production rates for each assembly
Table 3
Production hours
available
Month Line 1 Line 2
March 800 2,000
April 400 1,200
line and product combination, in terms of hours per product, are shown in Table 4. It takes 0.15
Table 4
Production rate
Product Line 1 Line 2
A 0.15 0.16
B 0.12 0.14
hour to manufacture 1 unit of product A on line 1, and so on. It costs $5 per hour of line time
to produce any product. The inventory carrying cost per month for each product is 20c per unit
(charged on each month’s ending inventory). Currently, there are 500 units of A and 750 units of B
in inventory. Management would like at least 1,000 units of each product in inventory at the end of
April. Formulate an LP to determine the production schedule that minimizes the total cost incurred
in meeting demands on time.
9
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
We can then proceed and formulate the problem.
2 X
X 2 X 2
X X
min z = 5 rjk xkij + 0.2 ikt (Cost)
t=1 j=1 k∈{A,B} t=1 k∈{A,B}
xA + xA A
+ xA B B B B
= 0.75 11 21 + 0.8 x12 22 + 0.6 x11 + x21 + 0.7 x12 + x22
iA + iB A B
+ 0.2 1 1 + i2 + i2
subject to
rjA xA B B
tj + rj xtj ≤ ctj ∀t, j ∈ {1, 2} (Capacity)
iA1 = 500 + xA A
11 + x12 − 5000 (Inventory product A)
iA2 = iA A A
1 + x21 + x22 − 8000
B
i1 = 500 + xB B
11 + x12 − 2000 (Inventory product B)
iB
2 = iB B B
1 + x21 + x22 − 4000
iA2 ≥ 1000 (Minimum stock)
B
i2 ≥ 1000
k k
xtj , it ≥0 ∀t, j ∈ {1, 2}, k ∈ {A, B} (Non-negativity)
If you are not comfortable with the more generic expressions, the capacity constraints could be
expanded as follows.
0.15xA B
11 + 0.12x11 ≤ 800
0.15xA B
21 + 0.12x21 ≤ 400
0.16xA B
12 + 0.14x12 ≤ 2000
0.16xA B
22 + 0.14x22 ≤ 1200
10
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3.10, Problem B6†
Gandhi Clothing Company produces shirts and pants. Each shirt requires 2sq yd of cloth, each pair
of pants, 3. During the next two months, the following demands for shirts and pants must be met
(on time): month 1—10 shirts, 15 pairs of pants; month 2—12 shirts, 14 pairs of pants. During each
month, the following resources are available: month 1—90 sq yd of cloth; month 2—60 sq yd. Cloth
that is available during month 1 may, if unused during month 1, be used during month 2.
During each month, it costs 4$ to make an article of clothing with regular-time labor and $8 with
overtime labor. During each month, a total of at most 25 articles of clothing may be produced with
regular-time labor, and an unlimited number of articles of clothing may be produced with overtime
labor. At the end of each month, a holding cost of $3 per article of clothing is assessed. Formulate
an LP that can be used to meet demands for the enxt two months (on time) at minimum cost.
Assume that at the beginning of month 1, 1 shirt and 2 pairs of pants are available.
subject to
11
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Winston (2004), Section 3.10, Problem B9†
Donovan Enterprises produces electric mixers. During the next four quarters, the following demands
for mixers must be met on time: quarter 1—4,000; quarter 2—2,000; quarter 3—3,000 quarter 4—
10,000. Each of Donovan’s workers works three quarters of the year and gets one quarter off. Thus,
a worker may work during quarters 1, 2, and 4 and get quarter 3 off. Each worker is paid $30,000
per year and (if working) can produce up to 500 mixers during a quarter. At the end of each quarter,
Donovan incurs a holding cost of $30 per mixer on each mixer in inventory. Formulate an LP to help
Donovan minimize the cost (labor and inventory) of meeting the next year’s demand (on time). at
the beginning of quarter 1, 600 mixers are available.
subject to
xt , it ≥ 0 (Non-negativity)
If you do not want to write the more generic form of the production constraints, they can be expanded
as follows.
12
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •
Acronyms
LP linear programming problem
References
Winston, W. L. (2004). Operations Research: Applications and Algorithms. Brooks/Cole, Cengage
Learning, 4th edition.
13
[git] • Branch: main @ 0695bcc; Author: Johan W. Joubert; Date: 2024-10-02 09:44:02 +0200 •