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:
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-28 09:53:58 +0000
Seen: 10 times
Last updated: May 28 '23
How to calibrate two correlated functions simultaneously using Python's scipy.optimize?
Can you explain the functioning of the {m,n}? regex in the Python re module?
Is it possible to open a video file in Python with OpenCV without any delay?
How can I create a Python quiz using Json with only one question and the quiz stops after it?
How can one ensure that sub-classes have uniform method parameters in TypeScript?
How can the calculation of matrix determinant be performed using CUDA?