Chapter 2
Chapter 2
LINEAR PROGRAMMING
Linear Programming:
Objective Function:
The objective function defines the goal of the optimization problem, either to
maximize or minimize a certain quantity.
Decision Variables:
Constraints:
Feasible Solution:
A feasible solution is a set of values for the decision variables that satisfies all the
constraints. It lies within the feasible region.
Feasible Region:
The feasible region is the set of all feasible solutions that satisfy all the constraints.
It is the intersection of all constraint boundaries.
Optimal Solution:
The optimal solution is the solution that maximizes or minimizes the objective
function while satisfying all constraints. It is the best possible outcome of the
optimization problem.
Assumptions of Linear programming:
2. Additivity: The total contribution of each decision variable is the sum of its
individual contributions, allowing for the additive combination of variables in the
objective function and constraints. For example, the total profit earned by the sale
of three products A, B and C must be equal to the profits earned separately from A,
B and C and similarly, the amount of resources consumed by A, B, and C
individually.
Flexibility: LP models can be adapted to different scenarios and constraints for the
optimization of complex systems with multiple variables.
Mathematical Precision: LP solutions are based on mathematical algorithms to
provide precise and quantifiable results that can guide decision-making processes.
Decision Support: LP models offer decision support by providing insights into the
best course of action under given constraints. It helps in strategic planning and
problem-solving
Construct the objective function that needs to be optimized. The objective function
typically a linear combination of the decision variables with coefficients
representing the contribution of each variable to the objective.
Define the constraints that restrict the feasible solutions of the problem. These
constraint are derived from the problem requirements and are expressed as linear
inequalities involving the decision variables.
Include non-negativity constraints for each decision variable to ensure that the
variables cannot take negative values. This is a common practice in linear
programming to align with real-world scenarios.
Mathematical Formulation of a Linear Programming Problem
A Linear Programming (LP) problem can be mathematically formulated as
follows:
1. Objective Function: The objective function in an LP problem represents the
quantity to be maximized or minimized. It is typically a linear combination of
decision variables. The general form of the objective function is
(Maximize or Minimize) Z= c1x1+c2x2+c3x3+……………cnxn
Where
Z is the objective function to be optimized.
am1x1+am2x2+am3x3+amnxn(≤,≥,=)bm
Where:
aij are the coefficients of the decision variables in the ith constraint.
Each constraint may be either ≤ (less than or equal to), ≥ (greater than or equal
to),= (equal to)
am1x1+am2x2+am3x3+amnxn(≤,≥,=)bm
and x1≥0, x2≥0, xn≥0
A manufacturer produces two types of models M1 and M2. Each model of the
type M1 requires 4 hours of grinding and 2 hours of polishing: whereas each model
of the type M2 requires 2 hours of grinding and 5 hours of polishing. The
manufacturers have 2 grinders and 3 polishers. Each grinder works 40 hours a
week and each polisher works for 60 hours a week. The profit on M1 model is 3.00
and on model M2 is 4.00Whatever is produced in a week is sold in the market.
How should the manufacturer allocate his production capacity to the two types of
models, so that he may take the maximum profit in a week?
Solution:
i. Identify and define the decision variable of the problem.
Let x1 _and X2 the number of units of M1 and M2 model.
Since the profits on both the models are given, the objective function is to
maximize the profit Max Z = 3X 1+ 4X2
iii. State the constraints to which the objective function should be optimized (i.e.
Maximization or Minimization).
There are two constraints one for grinding and the other for polishing.
Grinding Constraint: The total hours of grinding required for M1 and M2 should
not exceed the available grinding hours: No. of hours available on grinding
machine per week is 40 hours. There are two grinders. Hence the total grinding
hours available are 40 * 2 = 80 hours.
Polishing Constraint: The total hours of polishing required for M1 and M2 should
not exceed the available polishing hours. No. of hours available on polishing
machine per week is 60 hrs There are three grinders. Hence the total grinding hours
available are 60 * 3 = 180 hours.
Max Z = 3X 1+ 4X2
Subject to constraints,
4X1 + 2X2 ≤ 80
2X1+ 5X2 ≤ 180
X1, , X2 ≥ 0
Methods for the Solutions of a Linear Programming:
1. Graphical Solution:
Suitability: The graphical method is suitable for problems with two decision
variables
Visualization: It involves graphically representing the constraints as lines
on a coordinate plane to determine the feasible region where all constraints
are satisfied.
Optimal Solution: The optimal solution is found at the corner point of the
feasible region that maximizes or minimizes the objective function
Limitation: Dealing with more than two variables using the graphical
method becomes complex as it involves dealing with planes instead of
straight lines
2. Simplex Method:
Suitability: The simplex method is the most powerful method for solving
problems with more than two decision variables.
Algorithm: It is an iterative algorithm that systematically moves from one basic
feasible solution to another along the edges of the feasible region until the optimal
solution is reached
Efficiency: The simplex method is efficient for solving large-scale linear
programming problems with multiple variables.
Optimality: It guarantees finding the optimal solution in a finite number of steps
for bounded problems
Complexity: While more complex than the graphical method, the simplex method
is widely used due to its effectiveness in handling higher-dimensional problems.
Graphical Solution:
The Graphical Method is a technique used to solve linear programming problems
with two decision variables. It involves graphically representing the constraints and
objective function on a coordinate plane to determine the feasible region and find
the optimal solution.
Plot the constraints: Draw the coordinate axes (x and y axes) on a graph. Plot
each equation as a straight line by finding two points that satisfy the equation and
connecting them
Intersection of Constraints: The feasible region is the area where all constraints
overlap.
Feasible Region: Shade the region below the line for constraints with ≤ sign and
above the line for constraints with ≥ sign in the first quadrant. The overlapping
shaded region is the feasible region where all constraints are satisfied
simultaneously.
Corner Points: Identify the corner points of the feasible region where the
constraints intersect.
Evaluate the objective function at each corner point to determine the optimal
solution.
Substitute the coordinates of the corner points into the objective function to
calculate the objective function value at each point.
Compare the objective function values at the corner points to identify the
optimal solution that maximizes or minimizes the objective function.
PROBLEMS
Minimize, Z=20x1+10x2
Subject to x1+2x2 ≤ 40
3x1+x2 ≥ 30
4x1+3x2 ≥ 60
x1,x2 ≥ 0
Solution:
1.x1+2x2 = 40
If x1=0 →x2=20
If x2=0 →x1=40
2. 3x1+x2 = 30
If x1=0 →x2=30
If x2=0 →x1=10
3. 4x1+3x2 = 60
If x1=0 →x2=20
If x2=0 →x1=15
x1+2x2 = 40
3x1+x2 = 30 and
4x1+3x2 = 60
Value of Z=20x1+10x2
A(15,0) Z=20*15+10*0=300
B(40,0) Z=20*40+10*0=800
C(4,18) Z=20*4+10*18=260
D(6,12) Z=20*6+10*12=240(Minimum value)
Therefore the minimum value of Z occurs at D(6,12) and the optimal solution is
x1=6,x2=12
2.Find the maximum value of Z = 5x1+7x2
x1+x2 ≤ 4
3x1+8x2 ≤ 24
10x1+7x2 ≤ 35
x1, x2 ≥ 0
Solution:
1.x1+x2 = 4
If x1=0 →x2=4
If x2=0 →x1=4
2. 3x1+8x2 = 24
If x1=0 →x2=3
If x2=0 →x1=8
3. 10x1+7x2 = 35
If x1=0 →x2=5
If x2=0 →x1=8
Plot these lines in the graph and mark the region below the line as the inequality of
the constraint is ≤ and is also lying in the first quadrant.
The feasible region is OABCD
Therefore the maximum value of Z occurs at c(1.6,2.4) and the optimal solution is
x1=1.6,x2=2.4
Simplex Method
There are many methods to solve the Linear Programming Problem, such as
Graphical Method, Trial and Error method, Vector method and Simplex
Method. We use graphical method for solution when we have two
problem variables, the other method can be used when there are more than
two decision variables in the problem.
Among all the methods, SIMPLEX METHOD is most powerful method. It
deals with iterative process, which consists of first designing a Basic
Feasible Solution or a Programme and proceed towards the OPTIMAL
SOLUTION and testing each feasible solution for Optimality to know
whether the solution on hand is optimal or not If not an optimal solution,
redesign the programme, and test for optimality until the test confirms
OPTIMALITY
1. The graphical method is used when we have two decision variables in the
problem. Whereas in Simplex method, the problem may have any number of
decision variables.
3. In graphical solution the Isoprofit line moves away from the origin to towards
the far off point in maximization problem and in minimization problem, the Isocost
line moves from far off distance towards origin to reach the nearest point to origin.
4. In graphical method, the areas outside the feasible area (area covered by all the
lines of constraints in the problem) indicates idle capacity of resource where as in
Simplex method, the presence of slack variable indicates the idle capacity of the
resources.
5. In graphical solution, if the isoprofit line coincides with more than one point of
the feasible polygon, then the problem has second alternate solution. In case of
Simplex method the net evaluation row has zero for non-basis variable the problem
has alternate solution. (If two alternative optimum solutions can be obtained, the
infinite number of optimum, solutions can be obtained).
Slack Variables:
Surplus variable:
Maximize P= 30x+40y
Subject to 2x+y ≤ 10
x+y ≤ 7
x+2y ≤ 12
x,y ≥ 0
Solution:
The standard form of an LP is where all the constraints are equations and all
variables are non- negative.
The following transformation steps can be followed to convert all the inequalities
into equality constraints.
Using this transformation method on our example we get the following system of
equations.
P-30x-40y = 0
2x+y+s1=10
x+y+s2=7
x+2y+s3=12
x,y ≥ 0
We need to create a tableau from the system of equations we just obtained. It looks
something like this.
x y s1 s2 s3 P C
2 1 1 0 0 0 10
1 1 0 1 0 0 7
1 2 0 0 1 0 12
-30 -40 0 0 0 1 0
In the simplex tableau, the pivot is identified using the below two conditions
1. The pivot column is chosen by identifying the most negative entry in the bottom
row of the tableau
2. The pivot row is identified by dividing the constants (C column in the tableau)
by the coefficients of the pivot column. The row containing the smallest quotient
would be the pivot row.
In our example, the ‘y’ column is the pivot column since it contains - 40 and the
pivot row is R3 (row 3), since 12/2 = 6 is the smallest coefficient in the pivot
column. Hence, our pivot element is 2.
x y s1 s2 s3 P C
2 1 1 0 0 0 10
1 1 0 1 0 0 7
1 2 0 0 1 0 12 12/2=6
-30 -40 0 0 0 1 0
R3→R3/2
R1→R1-R3
R2→R2-R3
R4→R4+40R3
R3→R3/2
Old R3
1 2 0 0 1 0 12
2 2 2 2 2 2 2
R1→R1-R3
Old R1 New R3
R2→R2-R3
Old R2 New R3
[1 1 0 1 0 0 7] - [1/2 1 0 0 1/2 0 6]
R4→R4+40R3
R4 40R3
x y s1 s2 s3 P C
3/2 0 1 0 -1/2 0 4
1/2 0 0 1 -1/2 0 1
1/2 1 0 0 1/2 0 6
-10 0 0 0 20 1 240
Iteration 2
x y s1 s2 s3 P C
3/2 0 1 0 -1/2 0 4
1/2 0 0 1 -1/2 0 1
1/2 1 0 0 1/2 0 6
-10 0 0 0 20 1 240
We will use the row transformations to make all entries 0 in the pivot 1
R2→2 R2
R1→ R1 -3/2 R2
R3→ R3-1/2 R2
R4→R4+10R2
x y s1 s2 s3 P C
0 0 1 -3 1 0 1
1 0 0 2 -1 0 2
0 1 0 -1 1 0 5
0 0 0 20 10 1 260
Setting the non- basic variables to 0, we get x=2, y=5, s1=1 and P=260
Step-1:
b. All the XBi > 0. So if any XBi < 0 then multiply the corresponding constraint by
-1 to make XBi> 0. So sign ≤ changed to ≥ and vice varsa.
c. Convert LP problem into standard form by adding slack, surplus and artificial
variables for each constraint.
PROBLEMS
Solution
Min z = 2000x1+ 1500 x2
Subject to
6x1+ 2x2 ≥ 8
2x1+4 x2 ≥ 12
4x1 +12 x2 ≥ 24
and x1, x2 ≥ 0
The problem is converted into canonical form by adding slack, surplus and
artificial variables as appropriate
1.As the constraint -1 is of type ≥ we should subtract surplus variable S1 and add
artificial variable A1
2. As the constraint -1 is of type ≥ we should subtract surplus variable S1 and add
artificial variable A2
3. As the constraint -1 is of type ≥ we should subtract surplus variable S1 and add
artificial variable A3
After introducing surplus, artificial variables
Min Z=2000 x1 +1500 x2+0s1+0s2+0s3+MA1+MA2+MA3
Subject to
6x1+ 2x2 -S1 +A1 =8
2x1+4 x2 -S2 +A2 =12
4x1 +12 x2 –S3 + A3 = 24
and x1, x2, S1, S2, S3, A1, A2, A3 ≥ 0
Iteration-1 Cj 2000 1500 0 0 0 M M M
B C XB x1 x2 S1 S2 S3 A1 A2 A3 Min Ratio
B XB/X2
A1 M 8 6 2 -1 0 0 1 0 0 8/2=4
A2 M 12 2 4 0 -1 0 0 1 0 12/4=3
A3 M 24 4 (12) 0 0 -1 0 0 1 24/12=2
Z = 44M Zj 12M 18M -M -M -M M M M
Zj-Cj 12M-2000 18M-1500 -M -M -M 0 0 0
Positive maximum Zj-Cj is 18M-1500 and its column index is 2.So,the entering
variable is x2
Minimum ratio is 2 and its row index is 3.So,the leaving variable is A3
⸫ The pivot element is 12.
Entering = x2, Departing = A3, Key element = 12
R3(new) = R3(old) ÷12
R3(old) 24 4 12 0 0 -1 0 0
R3(new) = R3(old) ÷ 12 2 0.3333 1 0 0 -0.0833 0 0
Positive maximum Zj-Cj is 6M-1500 and its column index is 1.So,the entering
variable is x1
Minimum ratio is 0.75 and its row index is 1.So,the leaving variable is A1
⸫ The pivot element is 5.3333
Entering = x1, Departing = A1, Key element = 5.3333
Positive maximum Zj-Cj is 5M16-6258 and its column index is 5.So,the entering
variable is S3
Minimum ratio is 11.2 and its row index is 2.So,the leaving variable is A2
⸫ The pivot element is 0.3125
Entering = S3, Departing = A2, Key element = 0.3125
x1 =0.4 , x2 = 2.8
Min z=5000
Degeneracy:
During solving LP problem , a solution may arise in which there is a tie between 2
or more basic variables for leaving the basis.(minimum ratios are same).It is called
degeneracy
To resolve this we can select any of them arbitrarily. but if artificial variable is
present then it must be removed first.
PROBLEM
1.Find the solution using Simplex (Big M) method
Max Z=3x1+9x2
Subject to
x1+4 x2 ≤ 8
x1+2 x2 ≤ 4
and x1, x2 ≥ 0
Solution:
Max Z=3x1+9x2
Subject to
x1+4 x2 ≤ 8
x1+2 x2 ≤ 4
and x1, x2 ≥ 0
The problem is converted into canonical form by adding slack, surplus and
artificial variables as appropriate
1.As the constraint -1 is of type ≤ we should add slack variable S1
2. As the constraint -1 is of type ≤ we should add slack variable S2
Iteration 1 Cj 3 9 0 0
B CB xB x1 x2 S1 S2 Min ratio
xB/ x2
S1 0 8 1 4 1 0 8/4=2
S2 0 4 1 2 0 1 4/2=2
Z=0 Zj 0 0 0 0
Cj-zj 3 9 0 0
Positive maximum Zj-Cj is 9 and its column index is 2.So,the entering variable is
x2
Minimum ratio is 2 and its row index is 2.So,the leaving variable is S2
⸫ The pivot element is 2
Entering = x2, Departing = S2, Key element = 2
R2(new) = R2(old) ÷2
R2(old) 4 1 2 0 1
R2(new) = R2(old) ÷2 2 1/2 1 0 1/2
R1(old) 8 1 4 1 0
R1(new) = R1(old)-4R2(new) 0 -1 0 1 -2
Iteration 2 Cj 3 9 0 0
B CB xB x1 x2 S1 S2 Min ratio
xB/ x2
S1 0 0 -1 0 1 -2
x2 9 2 ½ 1 0 ½
Z=18 Zj 9/2 9 0 9/2
Cj-zj -3/2 0 0 -9/2
x1 = 0, x2 = 2
Max z =18
Two-Phase Method
MIN Z=5x1+2x2+10x3
Subject to x1 – x3 < = 10
x2 + x3 > =10
Solution:
MIN Z=5x1+2x2+10x3
Subject to x1 – x3 < = 10
x2 + x3 > =10
Phase – 1
The problem is converted into canonical form by adding slack, surplus and
artificial variables as appropriate
1.As the constraint -1 is of type ≤ we should add slack variable S1
2. As the constraint -2 is of type ≥ we should subtract surplus variable S2 and add
artificial variable A1
x2 + x3 – S2 + A1=10
and x1,x2,x3
Iteration-1 Cj 0 0 0 0 0 1
B CB XB x1 x2 x3 S1 S2 A1 Min Ratio
XB/ x2
S1 0 10 1 0 -1 1 0 0 -----------
A1 1 10 0 (1) 1 0 -1 1 10/1=10
Z=10 Zj 0 1 1 0 -1 1
Cj-zj 0 1 1 0 -1 0
Positive maximum Zj-Cj is 1 and its column index is 2.So,the entering variable is x2
Minimum ratio is 10 and its row index is 2.So,the leaving variable is A1
⸫ The pivot element is 1
Entering = x2, Departing = A1, Key element = 1
R2(new) = R2(old)
R2(old) 10 0 1 1 0 -1
R2(new) =R2(old) 10 0 1 1 0 -1
R1(new) = R1(old)
R1(old) 10 1 0 -1 1 0
R1(new) =R1(old) 10 1 0 -1 1 0
Iteration-2 Cj 0 0 0 0 0
B CB XB x1 x2 x3 S1 S2 Min Ratio
XB/ x2
S1 0 10 1 0 -1 1 0
x2 0 10 0 1 1 0 -1
Z=0 Zj 0 0 0 0 0
Cj-zj 0 0 0 0 0
x1 = 0, x2 = 10, x3=0
Max Z =0
Phase-2
We eliminate the artificial variables and change the objective function for the
original,
Min Z = 5x1+2x2+10x3+0S1+0S2
Iteration-1 Cj 5 2 10 0 0
B CB XB x1 x2 x3 S1 S2 Min Ratio
XB/ x2
S1 0 10 1 0 -1 1 0
x2 2 10 0 1 1 0 -1
Z=20 Zj 0 2 2 0 -2
Cj-zj -5 0 -8 0 -2
x1 = 0, x2 = 10, x3=0
Min Z =20
Chapter-3
Transportation Problem
Definition:
The transportation problem is a classic optimization problem in
operations research and logistics.
It deals with determining the most cost-effective way to transport
goods from multiple suppliers to multiple destination satisfying
supply and demand constraints while minimizing total
transportation costs.
Rim Condition:
The total supply available from all suppliers must equal the total demand
at all destinations. In other words, the total quantity of goods shipped
from all suppliers must equal the total quantity demanded by all
destinations. This is called the rim condition.
The goal of the transportation problem is to determine how much
to ship from each supplier to each destination in order to minimize
total transportation costs while satisfying supply and demand
constraints.
Balanced Transportation Problem:
* The problem is considered to be a balanced transportation problem
when both supplies and demands are equal.
Unbalanced Transportation Problem:
Unbalanced transportation problem is defined as a situation in which
supply and demand are not equal. A dummy row or a dummy column is
added to this type of problem, depending o the necessity, to make it a
balanced problem. The problem can then be addressed in the same way
as the balanced problem.
Feasible Solution:
Optimal Solution
There are several methods available to obtain an initial basic feasible solution.
However, we shall discuss here the following three methods:
sep
Seled this valuer cell of the transportation matrix and allocate min(sd) a.
Subtract this value from supply and demand of respective row and column.
Step-2:
b. If the supply is 0, then cross (strike) that row and move down to the next
cell.
c. If the demand is 0, then cross (strike) that column and move right to the
next cell.
d. If supply and demand both are 0, then cross (strike) both row & column
and move diagonally to the next cell.
step-3:
Repeat this steps until all supply and demand values are 0.
Illustration 1
D D D D D. Supply
2 11 10 37
721
3948 12
9
Demand
33
456
Solution
Problem Table is
Supply
2 11 10 3
14
72
39
812
Demand 3
3456
Table-1:
DDDD D_{2}
Supply
2(3)
11
10 3
4
72
8 12
Demand
3456