1 | initial version |
The relationship between EOQ and quantity discounts can be graphically represented using Python by creating a plot of the total inventory cost as a function of the order quantity, for different discount levels. The plot will have a U-shaped curve, where the minimum point represents the EOQ. As the discount level increases, the curve will shift down, because the cost per unit decreases.
Here's a Python code snippet that creates such a plot:
import numpy as np
import matplotlib.pyplot as plt
# Define parameters
demand = 600
ordering_cost = 30
holding_cost = 0.5
prices = [100, 95, 90, 85, 80]
quantities = [0, 200, 400, 600, 800, 1000]
# Compute total cost for each order quantity and discount level
def total_cost(quantity, price):
q = quantity
tc = (ordering_cost * demand / q) + (holding_cost * q / 2) + (demand * price)
return tc
costs = np.zeros((len(prices), len(quantities)))
for i in range(len(prices)):
for j in range(len(quantities)):
costs[i,j] = total_cost(quantities[j], prices[i])
# Plot total cost as a function of order quantity, for each discount level
plt.figure(figsize=(8,6))
for i in range(len(prices)):
plt.plot(quantities, costs[i,:], label='Price = {}'.format(prices[i]))
plt.xlabel('Order quantity')
plt.ylabel('Total inventory cost')
plt.legend()
plt.show()
The resulting plot should look like this: