Micromass' big simulation challenge

Click For Summary

Discussion Overview

The discussion revolves around a series of simulation challenges related to probability and rumor spreading. Participants are tasked with implementing simulations using various programming languages to explore concepts such as patient arrival times, rumor propagation, and optimal newspaper purchasing strategies. The scope includes theoretical modeling, programming implementation, and graphical representation of results.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • Ibix presents a simulation problem involving patient arrivals at a clinic modeled as a Poisson process, asking for statistical analysis of patient wait times and office closing times.
  • mfb proposes a challenge to simulate data from a standard normal distribution using a coin toss method, emphasizing the need for proof of the simulation's validity.
  • I_am_learning and Ygggdrasil discuss a rumor spreading model where a rumor is passed to two distinct individuals, seeking to calculate the probability that the original person remains uncontacted in subsequent generations.
  • I_am_learning later modifies the problem to allow for the possibility of a person telling the rumor to the individual who informed them, questioning the impact on results.
  • Ibix introduces a newsstand problem involving optimal purchasing strategies based on demand distributions for different types of days.
  • Participants request histograms to visualize the results of the rumor spreading simulations for different generations.
  • Rajendra Adhikari identifies and corrects a bug in the rumor simulation code that allowed for duplicate selections in the next generation, updating the code and providing new histograms.
  • Concerns are raised about the randomness of selecting unique individuals for rumor spreading, with clarifications provided regarding the use of Python's random.sample function.

Areas of Agreement / Disagreement

Participants express various viewpoints and approaches to the simulation challenges, with some agreeing on the methods used while others raise questions or propose modifications. No consensus is reached on the optimal solutions or the implications of the changes made to the simulation models.

Contextual Notes

Some participants note potential limitations in their simulations, such as the assumptions made regarding the independence of events and the impact of allowing repeated selections in rumor spreading. These aspects remain unresolved within the discussion.

  • #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   Reactions: 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   Reactions: 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
18K
  • · Replies 42 ·
2
Replies
42
Views
8K
  • · Replies 101 ·
4
Replies
101
Views
14K
  • · Replies 105 ·
4
Replies
105
Views
15K
  • · Replies 74 ·
3
Replies
74
Views
10K
  • · Replies 77 ·
3
Replies
77
Views
12K
  • · Replies 83 ·
3
Replies
83
Views
13K
  • · Replies 57 ·
2
Replies
57
Views
12K
  • · Replies 62 ·
3
Replies
62
Views
12K
  • · Replies 2 ·
Replies
2
Views
2K