Problem Statement
A retail store stocks two products: Product A (tablets) and Product B (smartwatches). The objective is to maximize profit by determining the optimal number of units to stock, subject to storage and budget constraints.Decision Variables
Maximize Z = 300x + 300yConstraintsStorage Constraint: The warehouse has 600 square feet. Product A requires 4 square feet per unit, and Product B requires 6 square feet per unit.
- ( x ): Number of units of Product A.
- ( y ): Number of units of Product B.
Maximize Z = 300x + 300yConstraintsStorage Constraint: The warehouse has 600 square feet. Product A requires 4 square feet per unit, and Product B requires 6 square feet per unit.
Budget Constraint: The budget is $30,000. Product A costs $300 per unit, and Product B costs $200 per unit.
x+ 200 y ≤ 30 , 000
Step-by-Step SolutionWe’ll solve this using the graphical method by identifying the feasible region, finding its vertices, and evaluating the objective function at each vertex to determine the maximum profit.Step 1: Graph the ConstraintsConvert the inequalities to equalities to find the boundary lines:2 x + 3 y = 300 3 x + 2 y = 300
Solve simultaneously:
Find vertices of the feasible region: at each vertex: occurs at ( (60, 60) ).Final AnswerThe store should stock 60 units of Product A and 60 units of Product B to maximize profit, yielding a profit of $36,000. This solution is at the intersection of the storage and budget constraints, ensuring the optimal point is in the "middle" and both constraints actively shape the feasible region without the budget constraint being stricter.

Python Code from Grok
- Storage Constraint:
2x + 3y = 300
- When :
x = 0
. Point: ( (0, 100) ).3y = 300 \implies y = 100
- When :
y = 0
. Point: ( (150, 0) ).2x = 300 \implies x = 150
- When
- Budget Constraint:
3x + 2y = 300
- When :
x = 0
. Point: ( (0, 150) ).2y = 300 \implies y = 150
- When :
y = 0
. Point: ( (100, 0) ).3x = 300 \implies x = 100
- When
Solve simultaneously:
- Multiply (1) by 2:
4x + 6y = 600
- Multiply (2) by 3:
9x + 6y = 900
- Subtract:
(9x + 6y) - (4x + 6y) = 900 - 600
5x = 300 \implies x = 60
- Substitute into (2):
x = 60
.3(60) + 2y = 300 \implies 180 + 2y = 300 \implies 2y = 120 \implies y = 60
2x + 3y ≤ 300
3x + 2y ≤ 300
x ≥ 0 , y ≥ 0
Find vertices of the feasible region:
- Origin: ( (0, 0) ).
- Storage intercept (x = 0): ( (0, 100) ) from .
2(0) + 3y = 300
- Budget intercept (y = 0): ( (100, 0) ) from .
3x + 2(0) = 300
- Intersection: ( (60, 60) ).
Z = 300x + 300y
- (0, 0):
Z = 300(0) + 300(0) = 0
- (0, 100):
Z = 300(0) + 300(100) = 30,000
- (100, 0):
Z = 300(100) + 300(0) = 30,000
- (60, 60):
Z = 300(60) + 300(60) = 18,000 + 18,000 = 36,000
Z = 36,000
Python Code from Grok
import numpy as np
import matplotlib.pyplot as plt
# Define the range for x (Product A)
x = np.linspace(0, 200, 400)
# Constraint 1: Storage (2x + 3y <= 300)
y1 = (300 - 2 * x) / 3
# Constraint 2: Budget (3x + 2y <= 300)
y2 = (300 - 3 * x) / 2
# Objective function at optimal point Z = 36,000 (at x=60, y=60)
# Z = 300x + 300y => y = -x + Z/300
y_opt = -x + 36000 / 300 # Z = 36,000
# Plotting
plt.figure(figsize=(10, 8))
# Plot constraints
plt.plot(x, y1, label='2x + 3y = 300 (Storage)', color='blue')
plt.plot(x, y2, label='3x + 2y = 300 (Budget)', color='green')
# Fill feasible region (y <= min(y1, y2) and y >= 0)
y_feasible = np.minimum(y1, y2)
plt.fill_between(x, 0, y_feasible, where=(y_feasible >= 0), color='gray', alpha=0.3, label='Feasible Region')
# Plot objective function at optimal point
plt.plot(x, y_opt, '--', label='Z = 300x + 300y = 36,000 (Optimal)', color='red')
# Plot vertices
vertices = [(0, 0), (0, 100), (60, 60), (100, 0)]
for vertex in vertices:
plt.plot(vertex[0], vertex[1], 'ro') # Red dots for vertices
plt.text(vertex[0] + 2, vertex[1] + 2, f'({vertex[0]}, {vertex[1]})', fontsize=10)
# Highlight optimal point
optimal = (60, 60)
plt.plot(optimal[0], optimal[1], 'y*', markersize=15, label='Optimal Point (60, 60)')
# Set labels and limits
plt.xlabel('Units of Product A (x)')
plt.ylabel('Units of Product B (y)')
plt.title('Linear Programming: Inventory Management')
plt.xlim(-10, 160)
plt.ylim(-10, 160)
plt.grid(True)
plt.legend()
# Show plot
plt.show()
No comments:
Post a Comment