Question: Method 1: a = 1/3; d2d = 2; stock = 1; deliv = -1; totalsold = 0; totallost = 0; totalcust = 0; numweeks =

Method 1:

a = 1/3; d2d = 2; stock = 1; deliv = -1; totalsold = 0; totallost = 0; totalcust = 0;

numweeks = 10;

For[i = 1, i <= numweeks, i++, ( For[j = 1, j <= 7, j++, ( sold = 0; lost = 0; If[deliv == 0, stock++;]; If[deliv >= 0, deliv--;]; randomnum = Random[Real, {0, 1}, 5]; If[randomnum < a, customers = 1;, customers = 0]; If[customers == 1, ( If[stock > 0, ( sold++; stock--; If[deliv < 0, deliv = d2d;]; ), lost++]; )]; totalsold = totalsold + sold; totallost = totallost + lost; totalcust = totalcust + customers; )]; )];

Print["total sold = ", totalsold]; Print["total customers = ", totalcust]; Print["total customers lost = ", totallost];

Method 2:

a = 1/3; d2d = 2; stock = 1; deliv = -1; totalsold = 0; totallost = 0; totalcust = 0;

numweeks = 10; daynum = 0;

For[i = 1, i <= numweeks, i++, ( For[j = 1, j <= 7, j++, ( daynum++; sold = 0; lost = 0; If[Mod[daynum, 3] == 0, stock++;]; randomnum = Random[Real, {0, 1}, 5]; If[randomnum < a, customers = 1;, customers = 0]; If[customers == 1, ( If[stock > 0, ( sold++; stock--; If[deliv < 0, deliv = d2d;]; ), lost++]; )]; totalsold = totalsold + sold; totallost = totallost + lost; totalcust = totalcust + customers; )]; )];

Print["total sold = ", totalsold]; Print["total customers = ", totalcust]; Print["total customers lost = ", totallost]; Print["final stock = ", stock];

1. Modify the existing methods so that the each simulation can be run many times (call this number of times numSim) and have the program report the average results taken over all simulations.

2. Assuming a profit of $10 is made for each item sold, a loss of $2 is incurred for every lost sale, and a loss of $0.50 per day per number of items in stock greater than 2, modify the existing code for both methods to report the net profit (or loss) at the end of the simulation.

3. Create a hybrid of the two ordering strategies in which in which an item is ordered when the stock is depleted and there is a standing order for a stock item to arrive once a week. Compare this model to the previous two models and comment on which strategy seems best in terms of net profit.

4. One problem with a standing order is that it may allow too much stock to build up. Implement a mechanism in the code the prevents the stock from growing greater than some fixed value named maxStock by not placing an order (either the standing order or the order that comes after a sale) when the stock level is already at maxStock

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!