Introduction-to-Linear-Programming-with-exercises
Introduction-to-Linear-Programming-with-exercises
Objective Function – A mathematical expression that represents the goal of the problem (e.g.,
maximizing profit, minimizing cost).
Constraints – A set of linear inequalities or equations that limit the possible solutions.
Decision Variables – The unknowns we are solving for, which impact the objective function.
Feasible Region – The set of all possible solutions that satisfy the constraints.
Example: A company produces two products (A and B) and wants to maximize profit. The
company has limited resources in terms of labor and raw materials.
Decision Variables:
Maximize Z=5x1+3x2
(Where $5$ and $3$ are the profit per unit for products A and B, respectively.)
🔹 Constraints (Resource Limitations):
Labor Constraint: 2x1+x2≤100
Material Constraint: x1+2x2≤80
Non-negativity Constraint: x1,x2≥0
(Since we cannot produce negative quantities.)
4. Methods to Solve Linear Programming Problems
Graphical Method – Used when there are only two decision variables. The solution is
found by plotting constraints on a graph and identifying the feasible region.
Simplex Method – Used when there are more than two decision variables. It involves
iterative calculations using a tableau.
Real-World Uses:
Conclusion
Linear Programming is a powerful tool for optimizing resources and making efficient decisions
under constraints. It provides practical solutions to real-world problems in various industries.
Basics of the Simplex Method
The Simplex Method is an iterative algorithm used to solve Linear Programming (LP)
problems that involve more than two variables. It systematically finds the optimal solution by
moving along the edges of the feasible region.
Ensure all constraints are in the form of equations by introducing slack variables.
Choose the column with the most negative value in the objective row (if maximizing).
This column indicates which variable should enter the solution.
Compute the minimum ratio test to determine which variable exits the solution.
The smallest positive ratio determines the pivot row.
Check if all values in the objective row (except for the right-hand side) are non-negative.
If any values are still negative, repeat steps 3-5.
When all values in the objective row are non-negative, the optimal solution is reached.
Z=3x1+2x2
Subject to:
x1+x2≤4
2x1+x2≤5
x1,x2≥0
x1+x2+s1=4
2x1+x2+s2=5
Objective Function:
Z−3x1−2x2=0
Basis x1 x2 s1 s2 RHS
s1 1 1 1 0 4
s2 2 1 0 1 5
Z -3 -2 0 0 0
(Continue with pivoting steps until all negative values in the Z-row are removed.)
The Simplex Algorithm Process
The Simplex Algorithm is an iterative method used to solve Linear Programming (LP) problems. It
efficiently finds the optimal solution by systematically improving the objective function value through
tableau operations.
To apply the Simplex Method, the LP problem must be in standard form, meaning:
Given Problem:
Maximize:
Z=3x1+2x2
Subject to:
x1+x2≤4
2x1+x2≤5
x1,x2≥0
Introduce slack variables s1s_1s1 and s2s_2s2 to convert inequalities into equations:
x1+x2+s1=4
2x1+x2+s2=5
Z−3x1−2x2=0
Basis x1 x2 s1 s2 RHS
s1 1 1 1 0 4
Basis x1 x2 s1 s2 RHS
s2 2 1 0 1 5
Z -3 -2 0 0 0
Basic Variables (Basis): Initially, slack variables s1and s2 form the basis.
Right-Hand Side (RHS): Represents the available resources.
Objective Row (Z-row): Contains coefficients from the objective function.
The pivot column is the one with the most negative value in the Z-row (objective function
row).
In our case, the most negative coefficient is -3 (under x1), so x1 enters the basis.
Ratio=RHS/Pivot Column
Use row operations to make other elements in the x1x_1x1 column zero.
Basis X1 X2 S1 S2 RHS
S1 0 0.5 1 -0.5 1
X1 1 0.5 0 0.5 2.5
Z 0 -0.5 0 1.5 7.5
The new Z-row still has a negative value (-0.5 in x2x_2x2), so we repeat steps 3-5.
We select x2x_2x2 as the entering variable and perform another round of pivoting.
Once all values in the Z-row (except RHS) are non-negative, we have reached the optimal
solution.
Once all values in the Z-row are non-negative, the optimal solution is found.
Optimal Values: x1=2.5x_1 = 2.5x1=2.5, x2=3x_2 = 3x2=3, and Maximum ZZZ = 7.5.
Non-basic variables (slack variables) indicate unused resources.
Final Notes:
Below are a few exercises that require solving Linear Programming (LP) problems using the
Graphical Method. Each exercise includes constraints, an objective function, and step-by-step
instructions.
Problem Statement:
Maximize:
Z=3x1+5x2
Subject to:
2x1+x2≤8
x1+2x2≤6
x1,x2≥0
Instructions:
1. Plot Constraints:
o Convert inequalities into equations.
o Find intercepts by setting x1=0 and solving for x2, and vice versa.
o Draw lines for constraints on a graph.
o Identify the feasible region where all constraints are satisfied.
Maximize:
Z=4x1+6x2
Subject to:
x1+x2≤5
x1+3x2≤9
x1,x2≥0
Minimize:
Z=2x1+3x2
Subject to:
3x1+x2≥6
x1+2x2≥4
x1,x2≥0
Instructions:
Maximize:
Z=5x1+2x2
Subject to:
x1−x2≤4
x1+x2≥3
x1,x2≥0
Instructions:
Task Points
Total 15 points