MIT15 053S13 Tut02
MIT15 053S13 Tut02
Algebraic Formulations
Usually in class, we describe linear programs by writing them out fully. This is
fine for small linear programs, but it does not work when the linear programs
are very large. In that case, it helps to use algebraic formulations.
2
On Creating Algebraic Formulations
When we create algebraic formulations, we rely on substituting notations for
some of the coefficients. Let’s start with an example of a linear program.
0 ≤ x2 ≤ 15
0 ≤ x3 ≤ 10
0 ≤ x4 ≤ 15
3
MSR Marketing Inc.
adapted from Frontline Systems
Max # of ads 20 15 10 15
Decision variables:
• x1 is the number of TV ads.
• x2 is the number of radio ads.
• x3 is the number of mail ads.
• x4 is the number of newspaper ads.
4
The LP Formulation again
0 ≤ x1 ≤ 20
0 ≤ x2 ≤ 15
0 ≤ x3 ≤ 10
0 ≤ x4 ≤ 15
So, let’s start with the four upper bound constraints. Suppose that
we let d = (d1, d2, d3, d4) = (20, 15, 10, 15). We can then write
the linear program as follows:
min 500 x1 + 200 x2 + 250 x3 + 125 x4
Is dj decision variable?
7
More on the algebraic formulation
0 ≤ xj ≤ dj for j = 1 to 4.
8
Making the remaining constraint more algebraic
Let aj be the audience size of the j-th ad type, which is the coefficient of
xj in the constraint. And let b denote the required number of people
reached by the ads. We then can rewrite the constraint.
s.t. 50,000
a1 xx
1 1++ 25,000
a2 x2x+
2 + 20,000 a4 x4x4≥ ≥ 1,500,000
a3 x3x+3 + 15,000 b
0 ≤ xj ≤ dj for j = 1 to 4.
min 500
c1 x11 + 200
c2 x22 ++ 250
c3 xx33++ 125
c4 xx44
s.t. a1 x1 + a2 x2 + a3 x3 + a4 x4 ≥ b
0 ≤ xj ≤ dj for j = 1 to 4.
10
Using Summation Notation
min c1 x1 + c2 x2 + c3 x3 + c4 x4
s.t. a1 x1 + a2 x2 + a3 x3 + a4 x4 ≥ b
0 ≤ xj ≤ dj for j = 1 to 4.
11
Replacing the number of variables.
Minimize
subject to
12
Summary of the transformation
• Let xj be the number of ads purchased of type j for j = 1 to n.
• Let aj be the number of persons who view one ad of type j
• Let b be the required number of viewers to see the ads. (That is, the total number of
viewers must be at least b)
• Let dj be an upper bound on the number of ads purchased of type j.
Minimize
subject to
• Remember that the advantage of algebraic formulations is in their ability to describe very
large problems in a very compact manner. This is critical if one is to model large
problems, involving thousands or perhaps millions of variables.
14
Formulation of the DTC Problem
(David’s Tool Company)
We will write the linear program as if up the constraints are broken into two
parts, the demand constraints and the resource constraints.
Maximize z = 3 K + 5 S
K δ 40 Slingshot demand:
Bounds on
S δ 30 Shield demand: variables.
K,S ≥ 0 Non-negativity:
Decision Variables:
• K is number of kits made
• S is number of shields made
15
Before checking out
the next page, try it
for yourself. There
are several correct
Don’t ask me. I have answers. We will
no clue what is going show one soon.
on. But I like
watching others
explain math.
16
The algebraic formulation
Maximize z = 3 x
K1 ++ 55 Sx2
K δ 40 Slingshot demand:
Bounds on
S δ 30 Shield demand: variables.
K,S ≥ 0 Non-negativity:
Let xj be the number of items of type i that are produced. In the above
formulation we have replaced K by x1 and S by x2. This will make it more easily
described using algebraic notation.
17
Some hints
For now, we will keep the number of variables as 2. Later on, we will write the
formulation so that the number of variables is n. This will be more general.
Also, the variables are often represented by letters near the end of
the alphabet such as w, x, y, and z. This convention is not always
followed, but it is used a lot.
18
Resource Constraints
There are three resources: gathering time, smoothing time, and delivery time. We will let
the limits (upper bounds) on these three resources be denoted as b1, b2, and b3.
We let ai1 be the amount of resource i used in the making of one Kit. We let ai2 be the
amount of resource i used in making one shield.
subject to a
211K x1+ + a312Sx2 δ≤ b100
1 Gathering time:
Resource
a21K x+
1 + 2
a22S x2 δ≤ b260 Smoothing time: Constraints
a31K x+
1 + a32
S x2 δ≤ b50
3 Delivery time:
19
Resource Constraints
My personal preference is
My head
to write them using
hurts.
summation notation. It
gets even more concise,
and is easy once you get
used to it.
20
The complete algebraic formulation
Maximize z = 3 x 1 + 5 x2
x1 ≤ 40 Slingshot demand:
0 ≤ xxj2≤≤ dj 30 Bounds on
Shield demand: variables.
for j = 1 to n.
x1, x2 ≥ 0 Non-negativity:
In this formulation:
dj : an upper bound on the demand for item j.
n : the number of items.
aij : the amount of resource i used up by one unit of item j.
m: the number of different resources.
pj : the profit from making one unit of item j
21
Another Practice Example
The following example called “Charging a Blast Furnace” is from Section 1.3 of Applied
Mathematical Programming.
An iron foundry has a firm order to produce 1000 pounds of castings containing at least
0.45 percent manganese and between 3.25 percent and 5.50 percent silicon. As these
particular castings are a special order, there are no suitable castings on hand. The castings
sell for $0.45 per pound. The foundry has three types of pig iron available in essentially
unlimited amounts, with the following properties:
Before going to the
next slide, try to
formulate the linear
program.
22
The LP formulation
23
An Algebraic Version
24
The LP formulation
Objective
maximize profit = Pd − Pp - ∑i ci xi - ∑j mj Mj
25
I hope that you are
getting the hang of If it helps, you can
this now. If not, all represent the
it takes is some more notation so that it is
practice. easier to remember
(but longer to write).
We’ll do this on the
next slide.
VARIABLES:
IronUsed(j): amount of iron i used, for j ∈ IRONS.
Purchased(i) : = amount of material j purchased, for i ∈ MATERIALS
PARAMETERS (Data)
CastingRevenue: The price per pound for selling castings
PigIronCost(j): Cost per pound of pig iron j for j ∈ IRONS
MaterialCost(i): Cost per pound of material i for i ∈ MATERIALS
MeltingCost = Cost per pound of melting any of the pig irons
TotalCastings = number of pounds of castings to be sold Materials_Per_Iron(i,
j) = The amount of material i in pig iron j
for i ∈ MATERIALS and j ∈ IRONS.
LowerLimit(i): The minimum fraction of Material i needed in the
mixture
UpperLimit(i): The maximum fraction of material i allowedin the
2
mixture
7
27
The LP formulation, for the last time
28
28
The huge advantage of the
previous formulation is that it is
much easier to debug and
extremely flexible. Notation is
consistently used. Sets are well
defined. Sets, Variables, and
Parameters are all defined using
easily understood terms.
2
9
29
Notation for linear programs in standard form
30
Last slide
31
31
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.