Valor esperado del tiempo de espera para el primero de los dos autobuses que se ejecutan cada 10 y 15 minutos.


19

Encontré una pregunta de entrevista:

Hay un tren rojo que viene cada 10 minutos. Hay un tren azul que viene cada 15 minutos. Ambos comienzan desde un momento aleatorio, por lo que no tiene ningún horario. Si llega a la estación a una hora aleatoria y toma un tren que viene primero, ¿cuál es el tiempo de espera esperado?


3
¿Los trenes llegan a tiempo pero con fases desconocidas igualmente distribuidas, o siguen un proceso de Poisson con un promedio de 10 minutos y 15 minutos?
Tilefish Poele

1
El primero, no poisson.
Shengjie Zhang

77
@Tilefish hace un comentario importante al que todos deberían prestar atención. No hay una respuesta definitiva. Debe suponer lo que podría significar "comenzar desde un momento aleatorio". (¿Significa que comienzan simultáneamente o que comienzan en diferentes momentos desconocidos? ¿Qué justificaría tratar "desconocido" como una variable aleatoria con una distribución conocida definida?) En función de su diferencia de fase (que solo importa un módulo de 5 minutos), la respuesta puede variar de 15/4 a 25/6 . Una distribución uniforme de la diferencia de fase cedería 35/9 .
whuber

@whuber todos parecían interpretar el comentario de OP como si dos autobuses partieran en dos momentos aleatorios diferentes. Que comenzarían al mismo tiempo al azar parece una toma inusual
Aksakal

1
@Aksakal. No todos: no lo hago, y al menos una respuesta en este hilo no, por eso estamos viendo diferentes respuestas numéricas. Además, casi nadie reconoce el hecho de que tuvieron que hacer una interpretación de la pregunta para obtener una respuesta.
whuber

Respuestas:


15

Una forma de abordar el problema es comenzar con la función de supervivencia. Para tener que esperar al menos t minutos, debe esperar al menos t minutos tanto para el tren rojo como para el azul. Por lo tanto, la función de supervivencia general es solo el producto de las funciones de supervivencia individuales:

S(t)=(1t10)(1t15)

que, para 0t10 , es la probabilidad de que tenga que esperar al menos t minutos para el próximo tren. Esto tiene en cuenta la aclaración de la OP en un comentario de que los supuestos correctos a tomar son que cada tren tiene un horario fijo, independiente del otro y de la hora de llegada del viajero, y que las fases de los dos trenes están distribuidas uniformemente ,

Entonces el pdf se obtiene como

p(t)=(1S(t))=110(1t15)+115(1t10)

Y el valor esperado se obtiene de la manera habitual:

,E[t]=010tp(t)dt=010t10(1t15)+t15(1t10)dt=010(t6t275)dt

que funciona a minutos359


Dave, ¿puedes explicar cómo p (t) = (1- s (t)) '?
Chef1075

Puedo explicar que para usted S (t) = 1-F (t), p (t) es solo f (t) = F (t) '.
Deep North

44
La idea de la función de supervivencia es genial. Pero, ¿por qué derivar el PDF cuando puede integrar directamente la función de supervivencia para obtener la expectativa? En efecto, dos tercios de esta respuesta simplemente demuestran el teorema fundamental del cálculo con un ejemplo particular. ¿Y qué justifica usar el producto para obtener ? Hay una suposición oculta detrás de eso. S
whuber

2
@whuber Prefiero este enfoque, derivando el PDF de la función de supervivencia, porque maneja correctamente los casos en los que el dominio de la variable aleatoria no comienza en 0.
Dave

2
(1) Su dominio es positivo. (2) La fórmula se generaliza fácilmente. .
whuber

9

La respuesta es

E[t]=xymin(x,y)110115dxdy=x(y<xydy+y>xxdy)110115dx
Get the parts inside the parantheses:
y<xydy=y2/2|0x=x2/2
y>xxdy=xy|x15=15xx2
So, the part is:
(.)=(y<xydy+y>xxdy)=15xx2/2
Finally,
E[t]=x(15xx2/2)110115dx=(15x2/2x3/6)|010110115=(1500/21000/6)110115=510/93.89

Here's the MATLAB code to simulate:

nsim = 10000000;
red= rand(nsim,1)*10;
blue= rand(nsim,1)*15;
nextbus = min([red,blue],[],2);
mean(nextbus)

1
You're making incorrect assumptions about the initial starting point of trains. i.e. Using your logic, how many red and blue trains come every 2 hours? How many trains in total over the 2 hours? etc.
Tilefish Poele

1
Can trains not arrive at minute 0 and at minute 60?
Tilefish Poele

1
what about if they start at the same time is what I'm trying to say. What if they both start at minute 0. How many instances of trains arriving do you have?
Tilefish Poele

1
The simulation does not exactly emulate the problem statement. In particular, it doesn't model the "random time" at which you appear at the bus station. As such it embodies several unstated assumptions about the problem.
whuber

2
@whuber it emulates the phase of buses relative to my arrival at the station
Aksakal

4

Assuming each train is on a fixed timetable independent of the other and of the traveller's arrival time, the probability neither train arrives in the first x minutes is 10x10×15x15 for 0x10, which when integrated gives 3593.889 minutes

Alternatively, assuming each train is part of a Poisson process, the joint rate is 115+110=16 trains a minute, making the expected waiting time 6 minutes


3
@Dave it's fine if the support is nonnegative real numbers.
Neil G

3
@dave He's missing some justifications, but it's the right solution as long as you assume that the trains arrive is uniformly distributed (i.e., a fixed schedule with known constant inter-train times, but unknown offset). It works with any number of trains. This is the because the expected value of a nonnegative random variable is the integral of its survival function.
Neil G

1
@Dave with one train on a fixed 10 minute timetable independent of the traveller's arrival, you integrate 10x10 over 0x10 to get an expected wait of 5 minutes, while with a Poisson process with rate λ=110 you integrate eλx over 0x< to get an expected wait of 1λ=10 minutes
Henry

1
@NeilG TIL that "the expected value of a non-negative random variable is the integral of the survival function", sort of -- there is some trickiness in that the domain of the random variable needs to start at 0, and if it doesn't intrinsically start at zero(e.g. for a different problem where the inter-arrival times were, say, uniformly distributed between 5 and 10 minutes) you actually have to use a lower bound of 0 when integrating the survival function. (starting at 0 is required in order to get the boundary term to cancel after doing integration by parts)
Dave

3
+1 At this moment, this is the unique answer that is explicit about its assumptions. All the others make some critical assumptions without acknowledging them.
whuber

2

I am probably wrong but assuming that each train's starting-time follows a uniform distribution, I would say that when arriving at the station at a random time the expected waiting time for:

  1. the Red train is E[R]=5 mins
  2. the Blue train is E[B]=7.5 mins
  3. the train that comes the first is E[min(R,B)]=1510(E[B]E[R])=154=3.75 mins


As pointed out in comments, I understood "Both of them start from a random time" as "the two trains start at the same random time". Which is a very limiting assumption.


1
Thanks! Your got the correct answer. But 3. is still not obvious for me. Could you explain a bit more?
Shengjie Zhang

1
This is not the right answer
Aksakal

1
I think the approach is fine, but your third step doesn't make sense.
Neil G

2
This answer assumes that at some point, the red and blue trains arrive simultaneously: that is, they are in phase. Other answers make a different assumption about the phase.
whuber

2

Suppose that red and blue trains arrive on time according to schedule, with the red schedule beginning Δ minutes after the blue schedule, for some 0Δ<10. For definiteness suppose the first blue train arrives at time t=0.

Assume for now that Δ lies between 0 and 5 minutes. Between t=0 and t=30 minutes we'll see the following trains and interarrival times: blue train, Δ, red train, 10, red train, 5Δ, blue train, Δ+5, red train, 10Δ, blue train. Then the schedule repeats, starting with that last blue train.

If WΔ(t) denotes the waiting time for a passenger arriving at the station at time t, then the plot of WΔ(t) versus t is piecewise linear, with each line segment decaying to zero with slope 1. So the average wait time is the area from 0 to 30 of an array of triangles, divided by 30. This gives

W¯Δ:=130(12[Δ2+102+(5Δ)2+(Δ+5)2+(10Δ)2])=130(2Δ210Δ+125).
Notice that in the above development there is a red train arriving Δ+5 minutes after a blue train. Since the schedule repeats every 30 minutes, conclude W¯Δ=W¯Δ+5, and it suffices to consider 0Δ<5.

If Δ is not constant, but instead a uniformly distributed random variable, we obtain an average average waiting time of

15Δ=05130(2Δ210Δ+125)dΔ=359.

2

This is a Poisson process. The red train arrives according to a Poisson distribution wIth rate parameter 6/hour.
The blue train also arrives according to a Poisson distribution with rate 4/hour. Red train arrivals and blue train arrivals are independent. Total number of train arrivals Is also Poisson with rate 10/hour. Since the sum of The time between train arrivals is exponential with mean 6 minutes. Since the exponential mean is the reciprocal of the Poisson rate parameter. Since the exponential distribution is memoryless, your expected wait time is 6 minutes.


The Poisson is an assumption that was not specified by the OP. But some assumption like this is necessary. The logic is impeccable. +1 I like this solution.
Michael R. Chernick

1
OP said specifically in comments that the process is not Poisson
Aksakal
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.