HW6-Inventory-2-soln (2)

.html

School

North Carolina State University *

*We aren’t endorsed by this school

Course

453

Subject

Industrial Engineering

Date

Dec 6, 2023

Type

html

Pages

5

Uploaded by twscott816

Report
HW 6: Inventory 2 (Solution) ISE 453 - Fall 2023 Assigned: Tue, 24 Oct (Groups of 2, one submission per group) Due: 1:00p, Tue, 31 Oct Group Members: (Member 1), (Member 2) Please use the cells in this Jupyter notebook to answer each of the following questions (unless the question is labeled as "Handwritten," in which case you should solve it by hand on paper and then scan and submit it in Moodle as a separate file, preferably PDF). You can add additional cells for each question if that helps in organizing your solution. Please run all of the cells in your notebook and then submit it via Moodle. (There is a Run All Cells command under the Run menu.) (1) With reference to Ex 1 in Inv-3 : (1a) The \$1 cost to bake each loaf of bread used in the analysis only includes the cost of ingredients and the direct labor cost of the baker. It has been estimated that it cost an additional \\$500 to fuel the oven each day for baking the bread, irrespective of the number of loaves baked in the oven. Since order data is available each morning, determine the impact on total profits if no bread were baked any day that the orders were below a threshold of 100, thereby saving \$500 for that day. In [1]: import matplotlib.pyplot as plt import scipy.optimize as opt d = [237, 214, 161, 146, 331, 159, 423, 332, 139, 327, 152, 98, 116] o = [121, 143, 63, 80, 198, 52, 160, 162, 85, 106, 129, 141, 106] p = 5 # Unit price c = 1 # Unit cost fpi = lambda q,di : p*min(q,di) - c*q # Profit per day fPi = lambda q,d : sum([fpi(qi,di) for qi,di in zip(q,d)]) # Total profit fdi = lambda a,oi : a[0] + a[1]*oi fd = lambda a,o : [fdi(a,oi) for oi in o] res = opt.minimize(lambda a : -fPi(fd(a,o), d), [1, 1], method='nelder-mead') print(res.message) aPiopt = res.x TP_NoThreshold = fPi(fd(aPiopt,o),d) - 500 * len(d) print('TP_NoThreshold =', TP_NoThreshold) Optimization terminated successfully. TP_NoThreshold = 3353.6362892961643 In [2]: threshold = 100 d = [di for di,oi in zip(d,o) if oi >= threshold] o = [oi for oi in o if oi >= threshold] d,o Out[2]: ([237, 214, 331, 423, 332, 327, 152, 98, 116], [121, 143, 198, 160, 162, 106, 129, 141, 106]) In [3]:
res = opt.minimize(lambda a : -fPi(fd(a,o), d), [1, 1], method='nelder-mead') print(res.message) aPiopt = res.x TP_Threshold = fPi(fd(aPiopt,o),d) - 500 * len(d) print('TP_Threshold =', TP_Threshold) Optimization terminated successfully. TP_Threshold = 3223.2499714386895 In [4]: print('There is an $', TP_NoThreshold - TP_Threshold, 'decrease' if TP_NoThreshold > TP_Threshold else 'increase', 'in TP threshold of', threshold, 'is used.') There is an $ 130.38631785747475 decrease in TP threshold of 100 is used. (1b) Describe (in words, no code) a possible procedure to determine the optimal threshold to use. Your Procedure: Starting at zero, can try increasing threshold values and use the one that maximizes total profit. (2) A firm runs a wilderness adventure program and, at the beginning of each month, purchases a pass to a national park for each customer attending the program at any time during the month because the passes for the month sell out quickly. Unused passes cannot be returned and are illegal to resell. Each pass costs \$250, and each customer pays \\$850 to attend the program. The number of customers per month over the past year has been 143, 256, 459, 209, 247, 281, 100, 133, 270, 480, 284, 410 and the number of preorders has been 52, 128, 167, 105, 244, 193, 81, 76, 217, 468, 195, 341 Determine how many passes should be purchased for next month, given that there have already been 190 preorders received for next month's program. In [5]: import matplotlib.pyplot as plt import scipy.optimize as opt d = [143, 256, 459, 209, 247, 281, 100, 133, 270, 480, 284, 410] o = [52, 128, 167, 105, 244, 193, 81, 76, 217, 468, 195, 341] p = 850 # Unit price c = 250 # Unit cost fpi = lambda q,di : p*min(q,di) - c*q # Profit per day fPi = lambda q,d : sum([fpi(qi,di) for qi,di in zip(q,d)]) # Total profit fdi = lambda a,oi : a[0] + a[1]*oi fd = lambda a,o : [fdi(a,oi) for oi in o] res = opt.minimize(lambda a : -fPi(fd(a,o), d), [1, 1], method='nelder-mead') print(res.message) aPiopt = res.x NoPasses = fd(aPiopt,[190]) print('NoPasses =', NoPasses) Optimization terminated successfully. NoPasses = [281.3940676468386] (3) A base stock inventory policy will be used to stock widgets at a industrial supply
store that is open five days per week, fifty weeks per year. Demand for the widgets averages 12 units per day. Each widget can be sold for \$12, cost \\$9, takes exactly two working days to be received from its supplier, and loses all of its value after six months. Determine the maximum stocking level for the widgets. In [12]: import numpy as np def base_stock(qmaxI, t_stop, rd, to): nxtevt1 = lambda t : t + np.random.exponential(1/rd) # Demand nxtevt2 = lambda t : t + np.random.exponential(to) # Order #nxtevt2 = lambda t : t + to q = qmaxI T = np.array([0]) Q = np.array([q]) E = np.array([[0, 1]]) done = False while not done: idx = np.argmin(E[:, 0]) t = E[idx, 0] if t < t_stop: evt = E[idx, 1] E = np.delete(E, idx, 0) if evt == 1: # Demand E = np.append(E, [[nxtevt1(t), 1]], 0) if q > 0: q -= 1 E = np.append(E, [[nxtevt2(t), 2]], 0) elif evt == 2: # Order q += 1 else: done = True T = np.append(T, [t], 0) Q = np.append(Q, [q], 0) n = len(Q) pi0 = sum(Q == 0)/n qI = np.mean(Q) return n, pi0, qI In [13]: rd, to = 12, 2 xh, th = 1, 6/12 hobs = xh/th h_yr = 0.05 + 0.06 + hobs # 1/yr n_yr = 5 * 50 # Days per year h = h_yr/n_yr # 1/day p, c = 12, 9 TPh = lambda pi0, qI : (p - c)*(1 - pi0)*rd - c * h * qI
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help