Professional Documents
Culture Documents
Linear Programming 1
Linear Programming 1
Linear programming
1
Introduction
Many management decisions involve trying to make the most
effective use of an organizations resources.
Resources typically include machinery, labor, money, time,
warehouse space, or raw materials.
Resources may be used to produce products (such as
machinery, furniture, food, or clothing) or services (such as
schedules for shipping and production, advertising policies,
or investment decisions).
Linear programming (LP) is a widely used mathematical
technique designed to help managers in planning and
decision making relative to resource allocation.
Despite the name, linear programming, and the more general
category of techniques called mathematical programming,
have very little to do with computer programming.
In the world of Operations Research, programming refers to
modeling and solving a problem mathematically.
Computer programming has, however, played an important
role in the advancement and use of LP to solve real-life LP
problems
2
Linear Programming Model
Most of the deterministic OR models can be formulated as
mathematical programs.
xj 0, j = 1,,n
3
Model Components
{}
values
gi(x1, x2 ,, xn) bi are called structural
=
(or functional or technological) constraints
4
Example: Giapetto woodcarving Inc.,
Giapetto Woodcarving, Inc., manufactures two types of
wooden toys: soldiers and trains. A soldier sells for
$27 and uses $10 worth of raw materials. Each soldier
that is manufactured increases Giapettos variable
labor and overhead cost by $14. A train sells for $21
and uses $9 worth of raw materials. Each train built
increases Giapettos variable labor and overhead cost
by $10. The manufacture of wooden soldiers and
trains requires two types of skilled labor: carpentry
and finishing. A soldier requires 2 hours of finishing
labor and 1 hour of carpentry labor. A train requires 1
hour of finishing and 1 hour of carpentry labor. Each
week, Giapetto can obtain all the needed raw material
but only 100 finishing hours and 80 carpentry hours.
Demand for trains is unlimited, but at most 40
soldiers are bought each week. Giapetto wants to
maximize weekly profit. Formulate a linear
programming model of Giapettos situation that can be
used to maximize Giapettos weekly profit 5
Solution: Giapetto woodcarving Inc.,
Step 1: Model formulation
1. Decision variables: we begin by finding the
decision variables. In any LP, the decision
variables should completely describe the
decisions to be made. Clearly, Giapetto must
decide how many soldiers and trains should
be manufactured each week. With this in
mind, we define:
X1 = number of soldiers produced each
week
X2 = number of trains produced each
week
6
Solution: Giapetto woodcarving Inc.,
2. Objective function: in any LP, the decision
maker wants to maximize (usually revenue or
profit) or minimize (usually costs) some
function of the decision variables. The
function to be maximized or minimized is
called the objective function. For the Giapetto
problem, we will maximize the net profit
(weekly revenues raw materials cost labor
and overhead costs).
Weekly revenues and costs can be expressed in
terms of the decision variables, X1 and X2 as
following:
7
Solution: Giapetto woodcarving Inc.,
Weekly revenues = weekly revenues from
soldiers + weekly revenues from trains
= 27 X1 + 21 X2
Also,
Weekly raw materials costs = 10 X1 + 9 X2
Other weekly variable costs = 14 X1 + 10 X2
Therefore, the Giapetto wants to maximize:
(27 X1 + 21 X2) (10 X1 + 9 X2) (14 X1 + 10 X2) =
3 X1 + 2 X2
Hence, the objective function is:
Maximize Z = 3 X1 + 2 X2 8
Solution: Giapetto woodcarving Inc.,
3. Constraints: as X1 and X2 increase,
Giapettos objective function grows larger.
This means that if Giapetto were free to
choose any values of X1 and X2, the company
could make an arbitrarily large profit by
choosing X1 and X2 to be very large.
Unfortunately, the values of X1 and X2 are
limited by the following three restrictions
(often called constraints):
Constraint 1: each week, no more than 100
hours of finishing time may be used.
Constraint 2: each week, no more than 80
hours of carpentry time may be used.
Constraint 3: because of limited demand, at
most 40 soldiers should be produced. 9
Solution: Giapetto woodcarving Inc.,
The three constraints can be expressed in
terms of the decision variables X1 and X2 as
follows:
Constraint 1: 2 X1 + X2 100
Constraint 2: X1 + X2 80
Constraint 3: X1 40
Note:
The coefficients of the decision variables in the
constraints are called technological
coefficients. This is because its often reflect
the technology used to produce different
products. The number on the right-hand side
of each constraint is called Right-Hand Side
(RHS). The RHS often represents the quantity
of a resource that is available. 10
Solution: Giapetto woodcarving Inc.,
Sign restrictions: to complete the formulation
of the LP problem, the following question must
be answered for each decision variable: can
the decision variable only assume nonnegative
values, or it is allowed to assume both
negative and positive values?
If a decision variable Xi can only assume a
nonnegative values, we add the sign
restriction (called nonnegativity constraints)
Xi 0.
If a variable Xi can assume both positive and
negative values (or zero), we say that Xi is
unrestricted in sign (urs).
In our example the two variables are restricted
in sign, i.e., X1 0 and X2 0 11
Solution: Giapetto woodcarving Inc.,
Combining the nonnegativity
constraints with the objective function
and the structural constraints yield the
following optimization model (usually
called LP model):
Max Z = 3 X1 + 2 X2 (objective function)
subject to (st)
2 X1 + X2 100 (finishing constraint)
X1 + X2 80 (carpentry constraint)
X1 40 (soldier demand constraint)
X1 0 and X2 0 (nonnegativity constraint)
The optimal solution to this problem is :
X1 = 20, and X2 = 60, Z = 180 12
What is Linear programming
problem (LP)?
LP is an optimization problem for which we do the
following:
1. We attempt to maximize (or minimize) a linear
function of the decision variables. The function that is
to be maximized or minimized is called objective
function.
2. The values of decision variables must satisfy a set of
constraints. Each constraint must be a linear
equation or linear inequality.
3. 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. 13
Linear Programming Assumptions
(i) proportionality
linearity
(ii) additivity
(iii) divisibility
(iv) certainty
14
Explanation of LP Assumptions
(i) activity js contribution to objective function is cjxj
15
Explanation of LP Assumptions
(iii) Fractional values for decision variables are permitted
16
Applications Of LP
1. Product mix problem
2. Diet problem
3. Blending problem
4. Media selection problem
5. Assignment problem
6. Transportation problem
7. Portfolio selection problem
8. Work-scheduling problem
9. Production scheduling problem
10. Inventory Problem
11. Multi period financial problem
12. Capital budgeting problem 17
1. Product Mix Problem
Example
Formulate a linear programming model for this
problem, to determine how many containers of
each product to produce tomorrow in order to
maximize the profits. The company makes four
types of juice using orange, grapefruit, and
pineapple. The following table shows the price and
cost per quart of juice (one container of juice) as
well as the number of kilograms of fruits required
to produce one quart of juice.
19
Product Mix Problem
Solution
Decision variables
X1 = # of containers of orange juice
X2 = # of containers of grapefruit juice
X3 = # of containers of pineapple juice
X4 = # of containers of All-in-one juice
Objective function
Max Z = 2 X1 + 1.5 X2 + 1 X3 + 2 X3
Constraints
X 1 0.25 X 4 400 Orange constraints
2 X 2 0.25 X 4 300 Grapefruit constraint
1.25 X 3 0.25 X 4 200 Pineapple constraints
X 2 0.3( X 1 X 2 X 3 X 4) Max. of grapefruit
X1 7
X3 5 Ratio of orange to pineapple
1 Max. of pineapple
X 2 ( X 1 X 2 X 3 X 4)
3
X 1, X 2, X 3, X 4 0 20
Non-negativity constraints
2. Diet problem
Example
My diet requires that all the food I eat come from one of
the four basic food groups (chocolate cake, ice
cream, soda, and cheesecake). At present, the
following four foods are available for consumption:
brownies, chocolate ice cream, cola, and pineapple
cheesecake. Each brownie costs 50 cents, each scoop
of chocolate ice cream costs 20 cents, each bottle of
cola costs 30 cents, and each piece of pineapple
cheesecake costs 80 cents. Each day, I must ingest at
least 500 calories, 6 oz of chocolate, 10 oz of sugar,
and 8 oz of fat. The nutritional content per unit of
each food is shown in the following table. Formulate a
linear programming model that can be used to satisfy
my daily nutritional requirements at minimum costs.
21
Diet problem
Calories Chocolate Sugar Fat
22
Diet problem
Solution
Decision variables: as always, we begin by
determining the decisions that must be made
by the decision maker: how much of each food
type 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 = number of bottles of cola drunk daily
X4 = number of pieces of pineapple cheesecake
eaten daily 23
Diet problem
Objective function: my objective
function is to minimize the cost of my
diet. The total cost of my diet may be
the determined from the following
relation:
Total cost of diet = (cost of brownies) +
(cost of ice cream) + (cost of cola) + (cost
of cheesecake)
Thus, the objective function is:
Min Z = 50 X1 + 20 X2 + 30 X3 + 80 X4
24
Diet problem
Constraints: the decision variables must satisfy the
following four constraints:
Constraint 1: daily calorie intake must be at least 500
calories.
Constraint 2: daily chocolate intake must be at least 6
oz.
Constraint 3: daily sugar intake must be at least 10 oz.
Constraint 4: daily fat intake must be at least 8 oz.
To express constraint 1 in terms of the decision
variables, note that (daily calorie intake) = (calorie in
brownies) + (calories in chocolate ice cream) + (calories
in cola) + (calories in pineapple cheesecake)
Therefore,
the daily calorie intake = 400 X1 + 200 X2 + 150 X3 + 500
X4 must be greater than 500 ounces
By the same way the other three constraints can be
formulated. 25
Diet problem
The four constraints are:
400 X1 + 200 X2 + 150 X3 + 500 X4 500
3 X1 + 2 X2 6
2 X1 + 2 X2 + 4 X3 + 4 X4 10
2 X1 + 4 X2 + X3 + 5 X4 8
Nonnegativity constraints: it is clear that
all decision variables are restricted in
sign, i.e., Xi 0, for all i = 1, 2, 3, and 4
26
Diet problem
Combining the objective function, constraints,
and nonnegativity constraints, the LP model is
as follows:
Min Z = 50 X1 + 20 X2 + 30 X3 + 80 X4
st.
400 X1 + 200 X2 + 150 X3 + 500 X4 500
3 X1 + 2 X2 6
2 X1 + 2 X2 + 4 X3 + 4 X4 10
2 X1 + 4 X2 + X3 + 5 X4 8
Xi 0, for all i = 1, 2, 3, and 4
The optimal solution to this LP is X1 = X4 = 0,
X2 = 1, and Z = 90 cents
27
3. Blending problem
Example
The Low Knock Oil company produces two grades of cut rate
gasoline for industrial distribution. The grades, regular and
economy, are produced by refining a blend of two types of crude
oil, type X100 and type X220. each crude oil differs not only in
cost per barrel, but in composition as well. The accompanying
table indicates the percentage of crucial ingredients found in each
of the crude oils and the cost per barrel for each. Weekly demand
for regular grade of Low Knock gasoline is at least 25000 barrels,
while demand for the economy is at least 32000 barrels per week.
At least 45% of each barrel of regular must be ingredient A. At
most 50% of each barrel of economy should contain ingredient B.
the Low Knock management must decide how many barrels of
each type of crude oil to buy each week for blending to satisfy
demand at minimum cost .
Crude oil Ingredient Ingredient Cost/barrel
type A% B% ($)
X100 35 55 30
X220 60 25 34.8 28
Blending problem
Solution
Let
X1 = # of barrels of crude X100 blend to produce the refined regular
X2 = # of barrels of crude X100 blended to produce the refined
economy
X3 = # of barrels of crude X220 blend to produce the refined regular
X4 = # of barrels of crude X220 blended to produce the refined
economy
Adam 6 2 8 5
Brook 9 3 5 8
Carter 4 8 3 4
Darwin 6 7 6 4
34
Assignment problem
Solution
Decision variables:
1 if attorney i is assigned to case j
Let Xij =
0 otherwise
Where : i = 1, 2, 3, 4 stands for Adam, Brook,
Carter, and Darwin respectively
j = 1, 2, 3, 4 stands for divorce,
merger, embezzlement, and exhibitionism
respectively.
The LP formulation will be as follows:
35
Assignment problem
Max Z = 6 X11 + 2 X12 + 8 X13 + 5 X14 + 9 X21 + 3 X22 +
5 X23 + 8 X24 + 4 X31 + 8 X32 + 3 X33 + 4 X34 +
6 X41 +7 X42 + 6 X43 + 4 X44
St.
X11 + X21 + X31 + X41 = 1 (divorce case)
X12 + X22 + X32 + X42 = 1 (merger)
X13 + X23 + X33 + X43 = 1 (embezzlement)
X14 + X24 + X34 + X44 = 1 (exhibitionism)
Omaha 3 1 4
St
X11 + X21 = 10000 (New York demand)
X12 + X22 = 8000 (Chicago demand)
X13 + X23 = 15000 (Los Angeles demand)
X11 + X12 + X13 20000 (New Orleans Supply
X21 + X22 + X23 15000 (Omaha Supply)
Xij 0 for i = 1, 2 and j = 1, 2, 3
The optimal solution is: X11 = 10000, X12 = 0, X13 = 8000, X21 =
0, X22 = 8000, X23 = 7000, and Z = $96000 40
7. Portfolio selection
Example
The International City Trust (ICT) invests in
short-term trade credits, corporate bonds, gold
stocks, and construction loans. To encourage
a diversified portfolio, the board of directors
has placed limits on the amount that can be
committed to any one type of investment. The
ICT has $5 million available for immediate
investment and wishes to do two things: (1)
maximize the interest earned on the
investments made over the next six months,
and (2) satisfy the diversification requirements
as set by the board of directors. The specifics
of the investment possibilities are: 41
Portfolio selection
Investment Interest Maximum
earned investment
% ($ Million)
Trade credit 7 1
Corporate bonds 11 2.5
Gold stocks 19 1.5
Construction loans 15 1.8
(8 15.20) (4 12.95)
Min 121.6 (x1 + + x6) + 51.8 (y1 + + y 6)
5
s.t. x6 + x1 + 6
y1 15
5
x1 + x2 + 6
y2 10
5
All shifts
x2 + x3 + 6
y3 40 must be
5
x3 + x4 + 6
y4 70 covered
5
x4 + x5 + 6
y5 40
5
x5 + x6 + 6
y6 35
xt, yt 0
PT employee is 5/6 FT employee
47
Terminology for solution of LP
A feasible solution is a solution for which all
the constraints are satisfied.
A corner point feasible solution (CPF) is a
feasible solution that lies at a corner point.
An infeasible solution is a solution for which
at least one constraint is violated.
The feasible region is the collection of all
feasible solution.
An Optimal solution is a feasible solution that
has the most favorable value of the objective
function. (it is always one of the CPF solution
The most favorable value is the largest
(smallest) value if the objective function is to
be maximized (minimized).
48
Graphical solution
49
Example 1: A Minimization Problem
LP Formulation
Min z = 5x1 + 2x2
s.t. 2x1 + 5x2 > 1
4x1 - x2 > 12
x1 + x2 > 4
x1, x2 > 0
50
Example 1: Graphical Solution
Graph the Constraints
Constraint 1: When x1 = 0, then x2 = 2; when x2 =
0, then x1 = 5. Connect (5,0) and (0,2). The ">" side
is above this line.
Constraint 2: When x2 = 0, then x1 = 3. But
setting x1 to 0 will yield x2 = -12, which is not on
the graph. Thus, to get a second point on this
line, set x1 to any number larger than 3 and solve
for x2: when x1 = 5, then x2 = 8. Connect (3,0) and
(5,8). The ">" side is to the right.
Constraint 3: When x1 = 0, then x2 = 4; when x2 =
0, then x1 = 4. Connect (4,0) and (0,4). The ">" side
is above this line.
51
Example 1: Graphical Solution
Constraints Graphed
x2 Feasible Region
4x1 - x2 > 12
5
4 x1 + x2 > 4
3
2x1 + 5x2 > 10
2
(16/5,4/5)
1 (10/3, 2/3)
x1
1 2 3 4 5 6
(5,0) 52
Example 1: Graphical Solution
Solve for the Extreme Point at the Intersection of the second and third
Constraints
4x1 - x2 = 12
x1+ x2 = 4
Adding these two equations gives:
5x1 = 16 or x1 = 16/5.
Substituting this into x1 + x2 = 4 gives: x2 = 4/5
Solve for the extreme point at the intersection of the first and third constraints
2x1 + 5x2 =10
x1 + x2= 4
Multiply the second equation by -2 and add to the first equation, gives
3x2 = 2 or x2 = 2/3
Substituting this in the second equation gives x1 = 10/3
Point Z
(16/5, 4/5) 88/5
(10/3, 2/3) 18
(5, 0) 25 53
Example 2: A Maximization Problem
s.t. x1 < 6
2x1 + 3x2 < 19
x1 + x2 < 8
x1, x2 > 0
54
Example 2: A Maximization Problem
Constraint #1 Graphed
x2
8
6
x1 < 6
5
1 (6, 0)
1 2 3 4 5 6 7 8 9 10 x1
55
Example 2: A Maximization Problem
Constraint #2 Graphed
x2
8 (0, 6 1/3)
7
6
2x1 + 3x2 < 19
5
4
3
2
(9 1/2, 0)
1
1 2 3 4 5 6 7 8 9 10
x1
56
Example 2: A Maximization Problem
Constraint #3 Graphed
x2
(0, 8)
8
6
x1 + x2 < 8
5
1 (8, 0)
1 2 3 4 5 6 7 8 9 10
x1
57
Example 2: A Maximization Problem
Combined-Constraint Graph
x2
8
x1 + x2 < 8
7
6
x1 < 6
5
2
2x1 + 3x2 < 19
1
1 2 3 4 5 6 7 8 9 10
x1
58
Example 2: A Maximization Problem
Feasible Solution Region
x2
8
2 Feasible
1
Region
1 2 3 4 5 6 7 8 9 10 x1
59
Example 2: A Maximization Problem
The Five Extreme Points
7
5
(0, 19/3) 6
4 (5, 3)
3
4
2 Feasible 3 (6, 2)
1
Region
1 2
(0, 0) x1
1 2 3 4 5 6 7 8 9 10
(6, 0) 60
Example 2: A Maximization Problem
Having identified the feasible region for the
problem, we now search for the optimal
solution, which will be the point in the
feasible region with the largest (in case of
maximization or the smallest (in case of
minimization) of the objective function.
To find this optimal solution, we need to
evaluate the objective function at each one of
the corner points of the feasible region.
61
Example 2: A Maximization Problem
Optimal Solution
Point Z
x2
(0,0) 0
8
(6,0) 30
7
(6,2) 44
6
Optimal Solution (5,3) 46
5
(0,19/3) 44.33
4
1 2 3 4 5 6 7 8 9 10
x1
62
Extreme Points and the Optimal Solution
The corners or vertices of the feasible region
are referred to as the extreme points.
An optimal solution to an LP problem can be
found at an extreme point of the feasible
region.
When looking for the optimal solution, you do
not have to evaluate all feasible solution
points.
You have to consider only the extreme points
of the feasible region.
63
Feasible Region
The feasible region for a two-variable linear
programming problem can be nonexistent, a single
point, a line, a polygon, or an unbounded area.
Any linear program falls in one of three categories:
is infeasible
has a unique optimal solution or alternate optimal
solutions
has an objective function that can be increased
without bound
A feasible region may be unbounded and yet there
may be optimal solutions. This is common in
minimization problems and is possible in
maximization problems. 64
Special Cases
Alternative Optimal Solutions
In the graphical method, if the objective function
line is parallel to a boundary constraint in the
direction of optimization, there are alternate
optimal solutions, with all points on this line
segment being optimal.
Infeasibility
A linear program which is overconstrained so that
no point satisfies all the constraints is said to be
infeasible.
Unbounded
For a max (min) problem, an unbounded LP occurs
in it is possible to find points in the feasible region
with arbitrarily large (small) Z
65
Example with Multiple Optimal
Solutions
x2
z1 z2 z3
Maximize z = 3x1 x2
4
66
Example: Infeasible Problem
Solve graphically for the optimal solution:
67
Example: Infeasible Problem
There are no points that satisfy both
constraints, hence this problem has no
feasible region, and no optimal solution.
x2
8 2x1 + x2 > 8
x1
3 4 68
Example: Unbounded Problem
Solve graphically for the optimal solution:
s.t. x1 + x2 > 5
3x1 + x2 > 8
x1 , x2 > 0
69
Example: Unbounded Problem
The feasible region is unbounded and the objective
function line can be moved parallel to itself without
bound so that z can be increased infinitely.
x2
3x1 + x2 > 8
8
5
x1 + x2 > 5
x1
2.67 5 70
Solve the following LP graphically
max 45 x1 + 60 x2 Objective Function
s.t. 10 x1 + 20 x2 1800 A Structural
28 x1 + 12 x2 1440 B constraints
6 x1 + 15 x2 2040 C
15 x1 + 10
0 x2 2400 D
x1 40 E
x2 100 F
x1 0, x2 0 nonnegativity
71
The graphical solution
P
Assignment:
240 Max Q Complete the
E problem to find the
200
D optimal solution
160
120 Max P
F
80 A
(
40 1
B C
)
0
0 40 80 120 160 200 240 280 320 360 Q
72
Possible Outcomes of an LP