Production Planning Example with PuLP
Let’s consider a simple Production Planning problem for a factory that produces two products: Product A
and Product B
.
The factory has limited resources: labor hours and raw material.
The goal is to maximize the profit while respecting the constraints of available resources.
Problem Statement:
- Product A requires:
- $2$ labor hours per unit
- $3$ kg of raw material per unit
- Yields a profit of $30 per unit
- Product B requires:
- $3$ labor hours per unit
- $1$ kg of raw material per unit
- Yields a profit of $20 per unit
The factory has:
- $100$ labor hours available per week
- $90$ kg of raw material available per week
The factory needs to decide how many units of each product to produce to maximize profit, given the constraints.
Mathematical Model:
Let:
- $(x_1)$ = number of units of Product A produced
- $(x_2)$ = number of units of Product B produced
Objective:
$$
\text{Maximize } 30x_1 + 20x_2
$$
Subject to:
$$
2x_1 + 3x_2 \leq 100 \quad \text{(labor hours constraint)}
$$
$$
3x_1 + 1x_2 \leq 90 \quad \text{(raw material constraint)}
$$
$$
x_1 \geq 0, \quad x_2 \geq 0 \quad \text{(non-negativity constraint)}
$$
Solution using PuLP:
1 | import pulp |
Explanation:
- Decision variables represent the number of units of each product to be produced.
- Objective function aims to maximize the total profit from producing both products.
- Constraints ensure that the production doesn’t exceed the available labor hours and raw material.
Results:
1 | Status: Optimal |
Explanation of the Results:
The problem has been solved, and the solution status is “$Optimal$”, meaning the solution found satisfies all the constraints and maximizes the profit under the given conditions.
- Optimal number of Product A to produce: $24.29$ units (rounded to two decimal places)
- Optimal number of Product B to produce: $17.14$ units (rounded to two decimal places)
Since the solution involves fractional units (which might represent part of a batch or a continuous process in certain industries), the optimal production mix is not whole numbers.
- Maximum Profit: $1071.43
This means that producing approximately $24.29$ units of Product A and $17.14$ units of Product B will yield the highest possible profit of $1071.43, while respecting the constraints on labor hours and raw materials.
If the production process must involve whole units, you might consider rounding these values or solving the problem using integer programming, depending on the context.