OR - LPP For Class
OR - LPP For Class
FACULTY OF COMPUTING
1 CSC 4303 (O.R.) LECTURE NOTES
2.1 INTRODUCTION
Linear Programming Problems (LPPs) is a collection of problems that have certain features in
common, even though they may come from very diverse areas of business and government.
The common characteristics of LPP’s are:
Ø They involve optimizing (i.e. maximizing or minimizing) a function (called the objective
function). The objection function could be profit, cost, revenue, etc.
Ø Such problems also involve some constraints (or limitations) imposed by the operating
environment. For example, all businesses (no matter how large) have limited resources at
their disposal at any given time. These limited resources impose constraints on a business’s
quest to maximize its profit, or minimize its costs, etc. Market forces (demand and supply)
could also impose additional constraints.
Ø Linear Programming Problems have definite mathematical formulations.
Ø There are also definite methods of solving the mathematical formulations of the linear
programming problems.
We shall discuss the last point later. To illustrate the first three points, consider the following
1
Now if there is no restriction, the carpenter could get as much profit as he wishes by producing
many chairs (and/or tables). For example, by producing 1,000,000 chairs, he could make a
profit of N4,000,000,000. Unfortunately, his (limited) resources may not allow him to do as he
wishes. Let us now consider the constraints (restrictions) imposed by the resources at his
disposal.
Since each chair requires 8 hours of labour, c chairs would require 8c hours of labour. Similarly,
t tables would need 10t hours of labour. Thus, the total labour time required for the carpenter’s
production for the week is: 8c + 10t. But we are told that the carpenter has only 74 labour hours
available for the coming week. Hence, this total needed for the production (8c + 10t) should
not exceed 74. This is expressed using Mathematical shorthand as:
8c + 10t £ 74 (Labour constraint)
[This is read ‘8c + 10t is less than, or equal to 74’ and means he can use 74 or less hrs]
Arguing along the same line, we can easily see that to produce c amount of chairs and t amount
of tables, the carpenter would need a total of 2c + 6t units of wood (since each chair requires 2
units of wood and each table requires 6 units). We are also told that there are only 36 units of
wood available. Hence, the total wood he uses should be less than, or equal to 36. In
Mathematical shorthand this becomes:
2c + 6t £ 36 (Wood constraint)
In this particular problem, there is a constraint imposed by market forces: a confirmed order of
three tables. Since there is this order, the carpenter must produce, at least, enough tables to
satisfy this order. In other words, the total tables he produces must be greater than, or equal to
three. But the number of tables he is to produce is simply ‘t’. The Mathematical formulation of
this constraint is therefore:
t³3 (Market constraint)
There are also some implied constraints common to all LPP’s. These are called non-negativity
constraints and arise as follows: would it make any sense for the carpenter to produce negative
number of chairs or tables (such as t = -5)? The answer is ‘no’, of course. Thus, there are
implied constraints that none of decision variables should be negative. Put another way, all
decision variables must be greater than, or equal to zero. In our examples, these constraints are:
t ³ 0, c ³ 0 (Non-negativity constraints)
In a nutshell, the carpenter’s problem is to maximize his total profit, subject to satisfying all
the above constraints. Using the Mathematical expressions developed above, this can be
succinctly stated as:
Remarks
a. Note that even though the carpenter has 74 hours of labour available, we have not insisted
that he must use all of them. That would have been too much of a restriction. If he can
maximize his profit by using, say, only 60 hours, so be it.
2
b. We have introduced new symbols in our formulations: “£” and “³”. Do not be put off by
them - they are easy to understand, and it is easy to avoid confusing them. Both symbols
are used to compare two quantities, smaller and larger; less and greater. Each symbol has
a narrow part and a wide part. The smaller number is on the narrow side and the larger
number is on the wide side. Thus, a ³ b says ‘a is bigger/greater/larger than, or equal to,
b’, since ‘a’ is on the wide side. The same statement could be written as b £ a, which means
‘b is smaller/less than, or equal to, a’. When carefully analysed, the two expressions (in
words) carry the same meaning.
c. As we shall see very soon, the formulation of a problem as an LPP does not take this long.
We intentionally took a very long so that we can fully explain the ideas step-by-step. In the
next section, we shall discuss and apply techniques of getting a problem formulated
systematically, but quickly.
Examples
1. The Kano Nails and Bolts Company (KNBC) Plc, buys leftover steel and zinc from the
Katsina Steel Rolling Company (KTSRC), which they use in making nails, bolts and
washes. Each batch of nails requires 3 tons of steel, 3 tons of zinc, and contributes N120,000
to profit; each batch of bolts requires 4 tons of steel, 2 tons of zinc, and contributes N60,000
to profit; while each batch of washers of requires 1 ton of steel, 6 tons of zinc, and
contributes N20,000 to profit. Currently, KNBC has 24 tons of steel and 30 tons of Zinc.
They want to know how many batches of each of their products to produce in order to
maximize their profit.
2. The Maimota Transport Company has a contract to transport 2000 tons of fertilizer from
Port-Harcourt to Kaduna. They can use either or both of two types of lorries - model M or
model P. Each model M lorry can transport a load of 100 tons at a cost of N300,000 for the
trip. Each model P lorry is capable of transporting a load of 50 tons at a cost of N100,000
for the trip. Because of prior commitments, only two model P trucks can be made available
for the schedules haul. The company wants to know how many of each of trucks to use to
transport the 2000 tons at minimal cost.
3. The ABC Fertilizer Company markets two types of fertilizer that are manufactured in two
departments. Type A contributes N3,000 per ton, and type B contributes N4,000 per ton.
3
Both fertilizers are processed in two Departments: 1 and 2. The following table summarises
the processing and departments
Hours per ton
Department Type Type B Maximum hours worked per week
A
1 2 3 40
2 3 3 75
Set up a linear programming problem to determine how much of the two fertilizers to make
in order to maximize profits.
4. The Whittier Company needs to produce 40 units of Product A tomorrow. They can
produce on either machine X or on machine Y or on both. Each unit of product A when
processed on machine X takes 30 minutes of time, while a unit processes on machine Y
takes 25 minutes. It costs the company N200 per minute and N300 per minute respectively
to operate machine X and Y. Tomorrow, machine X has only 10 hours available to produce
Product A, while machine Y can be operated as long as desired. Use the graphical method
to determine how many hours to schedule on each machine to minimize production costs.
5. The Westmoreland Company produces two brands of fish feed called Diet-Sup and Gro-
More. Contribution from Diet-Sup is N150 per 7-kg bag while Gro-More yields a
contribution of N110 per 3-kg bag. Both products are blended from two basic ingredients
– a protein source and a carbohydrate source. The products require the following
ingredients:
Protein Carbohydrate
Diet-Sup (7-kg bag) 4 kg 3 kg
Gro-More (3 kg bag) 2 kg 1 kg
During the coming week, the company wishes to produce the largest profit possible in order
to help alleviate a serious shortage of cash. For the week only 700 pounds of protein source
and 500 pounds of carbohydrate course are available. Demand records indicate that Gro-
More must account for at least half of the total production. How many bags of each of the
two brands should be produced to maximize profit?
6. Mr. Patient, who is sick, has been advised to supplement his diet with vitamins. He has
been asked to take at least 20 units of vitamin A, 25 units of vitamin B, 30 units of vitamin
K. He can get these vitamins from either Nakowa Multivite or Nagari Multivites, or both.
A tablet Nakowa multivite contains 2 units of vitamin A, 1 of vitamin B, 3 of vitamin K
and costs N50.00. The respective numbers for Nagari tablet are 2, 3, 2 and N60.00. Due to
the economic crunch, every kobo counts for Mr. Patient. He therefore wants to find the
combination of multivites that satisfies all the requirements at minimal cost.
7. Matasa Electronics produces three electrical products: clocks, radios and pressing irons.
These products have the following resource requirements:
Product Resource Requirements
Cost per Unit Labour hours per Unit
Clock N700 2
Radio 1,000 3
Iron 500 2
Matasa has a daily budget of N200,000 and a maximum of 660 hours of labour. Maximum
daily demand is for 200 clocks, 300 radios and 150 pressing irons. The selling prices are
N1,000 for a clock, N1,500 for a radio and N700 for an iron. The company desires to know
the optimal product mix that will maximize profit. Formulate a linear programming model
for this problem.
4
8. The United Aluminium Company of Onitsha produces three grades (high, medium and low)
of aluminium at two mills. Each mill has a different production capacity (in tons per day)
of each grade, as follows:
Aluminium Grade Mill
1 2
High 6 2
Medium 2 2
Low 4 10
The company has contracted with a manufacturing firm to supply at least 12 tons of
high-grade, 8 tons of medium-grade, and 5 tons of low-grade aluminium. It costs United
N60,000 per day to operate mill 1 and N70,000 per day to operate mill 2. The company
wants to know the number of days to operate each mill in order to meet the contract at the
minimum cost. Formulate a linear programming model for this problem.
9. An investor is considering investing in two stock portfolios. Each Naira invested in
Portfolio 1 yields an expected 6 kobo (N0.06) annual return, while each Naira invested in
Portfolio 2 yields 8 kobo. The total amount of funds available for investment is N2 million.
To ensure diversity, however, investment in Portfolio 2 should not exceed N1.2 million.
The investor realizes that Portfolio 2 is riskier than 1. Based on past variance of annual
returns for each portfolio, a subjective measure of riskiness, called a ‘risk unit’ has been
devised. Assigning a risk of 5 to each Naira invested in Portfolio 1 and 10 to each Naira
invested in Portfolio 2, the investor requires that the total investment should not exceed
3,000 risk units. He wants to know how much to investment in each portfolio to maximize
the returns.
Formulate as a linear programming problem
5
2.5 GRAPHICAL SOLUTIONS OF LPP’s
As the name implies, solving LPP’s graphically involves drawing graph. It has the following
steps:
1. Draw the Feasible Region. Using the constraints, we draw the graph of the feasible region
of the problem. The feasible region is simply the collection of all the feasible solutions of
the problem as discussed above.
2. Find the Corner Points. The graphical method hinges on the fact that “the optimum
solution (maximum profit, minimum cost, etc) occurs at a corner point of the feasible
region”. Thus, even though there are infinitely many feasible solutions, we only need to
concern ourselves with what happens at the corner points.
3. Evaluate Objective Function at Corner Points. The next thing then is to evaluate the
value of the objective function (profit, costs, or whatever) at each corner point identified in
2. By looking at the values, the best corner point gives the solution of the problem. In
maximizing profit, for example, the corner point with the maximum profit gives the
solution of the problem.
Example 1:
Use the graphical method to solve the above example.
Solution: In Class
Solution: In Class
The main problem with the graphical method is that it is difficult to use when there are more
than two decision variables. Even with three variables, the feasible region becomes part of the
three-dimension space and, hence, is difficult to draw/visualise. With more than three variables,
a mere description becomes impossible.
Another (minor) problem is that even with only two decision variables, the feasible region
becomes more complicated if the constraints are many.
The Simplex Method easily overcomes these shortcomings of the graphical method. This
method works for any number of decision variables or constraints. The method also has another
advantage in addition to solving the problem at hand – the solution provides us with very
helpful additional information about the problem for free, such amount of resources
remaining, marginal costs, and so on.
The Simplex Method is a computational method – computations are carried out instead of
drawing graphs.
Unfortunately, the formulation of LPP’s does not give much room for computations. This is
because they involve inequalities, rather than equation. An equation is like a balanced scale;
6
you can do the “same thing” to two sides of a balanced scale without tilting the balance – eg
adding/subtracting the same weight, and multiplying/dividing by the same factor. This cannot
be said of an inequality: even though 5 > 2, but -5 < -2 (so multiplying through by -1 does
not preserve the inequality).
Therefore, in order to make LPPs nice for computations, we have to, first of all, change the
inequalities into equations. But “2x + 3y < 50” is not the same as “2x + 3y = 50”. Thus, we
cannot simply replace the inequality sign by the equality sign. Rather, we change inequalities
to equalities by using slack and surplus variables.
Slack Variables:
Consider the above inequality: 2x + 3y £ 50
It means that the expression on the RHS is 50 or less than 50. It could be 50, 20, 10, 49, or
many other number that is not greater than 50. To make it the same as 50, we add something
to it. But since we do not know its exact value, we do not know the exact number to add. We
therefore, add a variable (symbol). For example, we could have:
2x + 3y + s = 50
where s is the difference between 50 and 2x + 3y. The variable s in this case is called a slack
variable.
Surplus Variables:
For constraints involving “³”, the LHS is more than (or same as) the RHS. To obtain an
equation therefore, we subtract from the LHS. For example, consider
3x1 + 2x2 ³ 30 (vitamin K requirement, Problem 6).
As an equation, it becomes:
3x1 + 2x2 - t = 30.
The variable t is called a surplus variable. In the above example, it measures the extra amount
of vitamin K over and above the minimum requirement of 30.
In summary, therefore:
we add slack variables to the RHS of “£” constraints.
we subtract surplus variables from the RHS of “³” constraints
Remarks: It should be noted that like the decision variables, slack and surplus variables
are also non-negative. In the above examples, s ³ 0, t ³ 0.
After introducing slack and/or surplus variables, the simplex procedure proper begins. In order
to be systematic, all the work is tabulated in tabular/matrix forms. Each completed tabular form
is called a tableau.
We saw in the graphical method that the optimal value of our objective function occurs at a
corner point. The simplex method allows us to move from one corner point to another without
actually drawing any graph. Moreover, there is a built-in simplex test to allow us check whether
the current corner point gives the optimal solution.
The simplex method involved the following steps:
1. Initial Basic Feasible Solution: We must start at some corner point. As we shall soon see,
this step is very trivial for some types of problems, but not so trivial for other types.
2. Check for Optimality: Next, we check whether the current feasible solution (initial or
otherwise) is optimal (ie the best). This is always easy to decide. If optimal, we are done.
7
3. Improve the Current Solution: If the current solution is not optimal, we improve upon it
by moving to a “better” corner point.
Steps 2 and 3 are repeated until the optimal solution is attained.
We illustrate all these by solving Problem 1 (KNBC problem) which we had earlier formulated
in class as follows:
Maximize P = 12,000x1 + 6,000x2 + 2,000x3
Subject to 3x1 + 4x2 + x3 £ 24
3x1 + 2x2 + 6x3 £ 30
x1, x2, x3 ³ 0
Initial Tableau
P x1 x2 x3 s1 s
0 3 4 1 1 0 24
0 3 2 6 0 1 30
-1 12,000 6,000 2,000 0 0 0
We shall explain all the steps and complete the solution in class. We shall also revisit an
example we had earlier solved graphically – for comparison and to illustrate some points.
Note that the non-negativity constraints are not converted to equations; nor do they appear in
the tableau. We simply keep them at the back of our minds.
The examples we considered were both ‘Maximising’ problems involving £ constraints. They
are the easiest to start with from the point of view of the Simplex method. The reason for this
is that the initial tableau gives a feasible solution. Unfortunately, this is not the case with
problems involving ³ constraints.
v Sensitivity Analysis
v Two-phase Simplex Method (‘Artificial Variables’ in some books); Big M Method
v Minimizing Problems
v Duality
v Other issues
Copyright ©
Muhammad Y. Bello
Course Lecturer