Lecture 6 Linear Programming Part 1
LO6-1. General Linear Programming (LP) Models for Decision Making Problems
Defination: Linear Programming deals with the problem of optimizing a linear objective
function subject to linear equality and inequality constraints on the decision variables.
What is “linear” in Linear programming?
Linear means that something forms a straight line when you graph it.
In math, a linear equation has the form
𝑦 = 𝑚𝑥 + 𝑏
where:
𝑦 and 𝑥 are variables.
𝑚 is the slope (how steep the line is).
𝑏 is the y-intercept (where the line crosses the y-axis).
Remark: If we have 3 variables 𝑥, 𝑦, 𝑧, 𝑎𝑛𝑑 𝑦 = 𝑚1 𝑥 + 𝑚2 𝑧 + 𝑏 is also linear because it
forms a straight line in 3D graph. Similarly, it can generalize to more than 3 variables as long
as each variable 𝑥, 𝑦, 𝑧 … appears only to the first power and the equation involves only
linear operations (addition and multiplication by constants)
LO6-2. Features of an LP Model
1. Objective Function:
- Definition: The function that needs to be maximized or minimized.
- Form: A linear equation in terms of decision variables.
- Example: 𝑍 = 𝑐1 𝑥1 + 𝑐2 𝑥2 + . . . + 𝑐𝑛 𝑥𝑛 , where 𝑍 is the objective, 𝑐𝑖 are coefficients,
and 𝑥𝑖 are decision variables.
2. Decision Variables:
- Definition: Variables that represent choices available to the decision-maker.
- Characteristics: Continuous or discrete, non-negative.
- Example: 𝑥1 , 𝑥2 , . . . , 𝑥𝑛 .
3. Constraints:
- Definition: Linear inequalities or equations that restrict the values of the decision
variables.
- Types:
- Inequalities: 3𝑥1 + 4𝑥2 + . . . + 7𝑥𝑛 ≤ 10
- Equations: 3𝑥1 + 4𝑥2+ . . . + 7𝑥𝑛 = 10
- Role: Ensure that the solution meets certain requirements or limitations.
4. Non-Negativity Restrictions:
- Definition: Constraints that ensure decision variables are non-negative.
- Form: 𝑥𝑖 ≥ 0 for all 𝑖 .
5. A feasible solution satisfies all the constraints
[Link] infeasible solution violates at least one constraint
7. Optimal solution is the best feasible solution
LO6-3. Examples and Applications of LP in Operations
Problem Statement:
A company produces two products, A and B. The profit per unit of product A is $40, and the
profit per unit of product B is $30. The company has 100 hours of labor and 180 units of raw
material available. Each unit of product A requires 1 hour of labor and 2 units of raw
material, while each unit of product B requires 2 hours of labor and 1 unit of raw material.
Determine the number of units of each product to produce in order to maximize profit.
Formulation:
1. Objective Function:
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒 𝑍 = 40𝑥𝐴 + 30𝑥𝐵
2. Decision Variables:
𝑥𝐴 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑢𝑛𝑖𝑡𝑠 𝑜𝑓 𝑝𝑟𝑜𝑑𝑢𝑐𝑡 𝐴
𝑥𝐵 = 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑢𝑛𝑖𝑡𝑠 𝑜𝑓 𝑝𝑟𝑜𝑑𝑢𝑐𝑡 𝐵
3. Constraints:
- Labor constraint:
1𝑥𝐴 + 2𝑥𝐵 ≤ 100
- Material constraint:
2𝑥𝐴 + 1𝑥𝐵 ≤ 180
4. Non-Negativity Restrictions:
𝑥𝐴 ≥ 0, 𝑥𝐵 ≥ 0
LO6-4. Using the Excel Solver
1. Install Solver Add-in (if not already installed):
Go to File > Options > Add-ins.
At the bottom, select Excel Add-ins and click Go.
Check Solver Add-in and click OK.
2. Open Solver:
Go to the Data tab and click on Solver in the Analysis group.
3. Set Up Solver Parameters:
Set Objective: Select the cell where the objective function is calculated (e.g., D2).
To: Choose Max or Min depending on your goal.
By Changing Variable Cells: Select the range of cells representing your decision variables
(e.g., B2:C2).
Add Constraints:
Click Add and enter each constraint:
For example, B5 <= E5 if you are ensuring Resource 1 usage does not exceed availability.
Repeat for all constraints.
4. Choose the Solving Method:
Under Select a Solving Method, choose Simplex LP (appropriate for linear problems).
5. Solve the Problem:
Click Solve. Solver will find the optimal solution based on your objective and constraints.
After Solver finds a solution, it will display a dialogue box indicating the results.
6. Analyze the Solution:
If Solver found an optimal solution, it will adjust your decision variables and show the
objective value.
Review the results, especially checking whether constraints were satisfied.
7. Save the Solution:
Click Keep Solver Solution to retain the solution values in your spreadsheet, or you can
restore the original values if needed.
Side notes:
Add $$ to freeze cell:
• Windows: Use F4 after selecting the cell reference in the formula.
• Mac: Use Command (⌘) + T or F4 (depending on your keyboard settings).