Challenge Micromass' big simulation challenge

Click For Summary
The discussion focuses on a series of simulation challenges involving various statistical problems that participants are tasked with solving using programming. Key problems include simulating patient arrivals at a clinic based on a Poisson process, generating data from a standard normal distribution using a biased coin flip, and modeling the spread of rumors in a population. Participants are encouraged to share their solutions, including code and graphical representations of their findings. The thread emphasizes collaboration and feedback among users to enhance the learning experience.
  • #31
mfb said:
I would maximize the expectation value. Risk averages out over multiple days.

Ibix said:
That's how I did it, and I came to the same answer as
@Jimster41.

Dollars at risk (maybe not the best term) are all the dollars for each combination of buying level and demand outcome I either lost because I bought but could sell and had to recycle instead, or failed to make because there was demand for more papers than I bought.
 
Last edited:
Physics news on Phys.org
  • #32
For Challenge 5, I found 60 papers to be optimal as well.
Code:
%matlab script
%given probability data
%column 1 is demand
P1 = [ 40, .03, .1, .44; 
50, .05, .18, .22; 
60, .15, .4, .16; 
70, .2, .2, .12; 
80, .35, .08, .06; 
90, .15, .04, 0; 
100, .07, 0, 0];

%probability of type of day relating to columns 2-4 of P1
P2 = [.35, .45, .2];

%combined probability for demand - column 1 is demand column 2 is prob.    
P = [P1(:,1),P1(:,2)*P2(1)+P1(:,3)*P2(2)+P1(:,4)*P2(3)];

%fixed parameters    
cost = -33; 
sell = 50; 
scrap = 5;

%purchase options     
Purchase = [0:10:100]';

%initial cost
Profit = Purchase*cost;

%7 cases for demand: 40:10:100
for k = 1:7
sold = min(P(k,1),Purchase);
Profit=Profit+P(k,2)*(sold*sell +(Purchase-sold)*scrap);
end

index = find(Profit == max(Profit)); 
Optimal = Purchase(index);

%output results     
fprintf('Optimal number is %g', Optimal) 
fprintf('. Expected profit is $%g', round(Profit(index),2))

%plot results    
plot(Purchase,Profit)
title('Expected Profit from Newspaper Sales')
xlabel('Papers Purchased')
ylabel('Profit')
 
  • #33
Ibix said:
Problem 5 can be done with pen and paper (unless I'm missing something) - old school computing. Is that cheating, or shall I post a photo?

I make it 60
Here are (slightly enhanced) photos of my "program":

Part 1 - calculate expected sales:
Copy of 20160602_211406.jpg


Part 2 - calculate profit from various purchases given expected sales:
Copy of 20160602_211416.jpg


I did more work than I needed - I could have just done the 60 and 70, as it was obvious from the functional form of the profit that the answer had to be one of the two.
 
  • #34
The expectation value of sold newspapers alone doesn't work. It happens to give the right answer here, but there are other cases where it fails. Imagine selling 100 newspapers 50% of the time and 20 newspapers 50% of the time. The expectation value is 60, but every newspaper beyond 20 gives $17 profit or $28 loss with equal probability, so you should buy 20. Your calculation would assume that you always sell 60 newspapers if you buy 60, which is clearly not true.

This question doesn't need any fancy calculations, just go through all the options and calculate the expected profit for each one, use the one where the expected profit is maximal, done.
 
  • #35
The fraction of the time that the demand is 40 newspapers is:

f(40)=(0.03)(0.35)+(0.1)(0.45)+(0.44)(0.2)=0.1435

Similarly,

f(50)=0.1425
f(60)=0.2645
f(70)=0.1840
f(80)=0.1705
f(90)=0.0757
f(100)=0.0245

Let g(D,N) represent the profit on a given day if the number of papers ordered is N and the demand is D. So, the average profit per day is

$$P(N)=\sum_{D=40}^{100}{f(D)g(D,N)}$$

This needs to be maximized with respect to N.
 
  • Like
Likes mfb
  • #36
mfb said:
Your calculation would assume that you always sell 60 newspapers if you buy 60, which is clearly not true.
Ack! Indeed. @micromass - I got the right answer by the wrong method...
 
  • #37
Newspapers... using numbers from Chestermiller and the described approach, here is the expected profit for each case:
40: 689.36
50: 797.125
60: 840.765 <- best
70: 765.38
80: 607.195
90: 372.285
100: 103.31
 
  • Like
Likes Chestermiller
  • #38
mfb said:
Newspapers... using numbers from Chestermiller and the described approach, here is the expected profit for each case:
40: 689.36
50: 797.125
60: 840.765 <- best
70: 765.38
80: 607.195
90: 372.285
100: 103.31
Wow. You're fast!
 
  • #39
News.png


Gotta sell it to the news stand guy...
:cool:
 
Last edited:

Similar threads

  • · Replies 116 ·
4
Replies
116
Views
17K
  • · Replies 42 ·
2
Replies
42
Views
7K
  • · Replies 101 ·
4
Replies
101
Views
13K
  • · Replies 105 ·
4
Replies
105
Views
14K
  • · Replies 74 ·
3
Replies
74
Views
10K
  • · Replies 77 ·
3
Replies
77
Views
12K
  • · Replies 83 ·
3
Replies
83
Views
12K
  • · Replies 57 ·
2
Replies
57
Views
12K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 62 ·
3
Replies
62
Views
11K