[R-es] consulta

Joshua Kunst jbkunst en gmail.com
Vie Dic 10 16:10:16 CET 2010


Estimados,

Hace un tiempo hice el caso mm1 por si te sirve Diego. La diferencia
es que acá se entrega el tiempo a simular y no la cantidad de saltos.

# Modelo M/M/1

mm1 <- function( timesim, lambda, mu )
{

	time		<- 0
	state		<- matrix(	c(0,0), ncol = 2,
				dimnames = list(c(),c("status","time")) )
	status	<- c(0,0)
	time		<- time + rexp(1,lambda)
	status	<- c(1,time)
	state		<- rbind( state, status )

	while( time < timesim)
	{
		
		if( status[1] == 0 )
		{
			time	<- time + rexp(1,lambda)
			status <- c(1, time)
			state	 <- rbind( state, status )
			state
		}
		else
		{
			tserver	<- rexp(1,mu)
			tclient	<- rexp(1,lambda)

			if( tclient < tserver )
			{
				time   <- time + tclient
				status <- c( status[1] + 1, time)
				state	 <- rbind( state, status )
			}
			else
			{
				time	 <- time + tserver
				status <- c( status[1] - 1, time)
				state	 <- rbind( state, status )
			}
		}
	}
	plot(state[,2], state[,1], type = "l",
	ylab = "Estado del sistema", xlab = "Tiempo" )
	return (state)
}

sim	<- mm1(100, 2,3)



(Extra, hace un tiempo realicé el programa genérico (n servidores)
pero en python, lo puedes buscar acá
http://joshuakunst.net/document/queue-model-simulation-python/ pero
puedes obtener la idea (cualquier cosa me puedes preguntar) y si lo
quieres ver funcionando puedes verlo en
http://statistics-online.info/simulations/ en la parte de mmk models y
simular on-line)




On 12/10/10, Olivier Nuñez <onunez en iberstat.es> wrote:
> El pasado mes de abril, hubo un hilo sobre este tema :
>
> https://stat.ethz.ch/pipermail/r-help-es/2010-April/000884.html
>
> Un saludo. Olivier
>
> --
> ____________________________________
>
> Olivier G. Nuñez
> Email: onunez en iberstat.es
> Tel : +34 663 03 69 09
> Web: http://www.iberstat.es
>
> ____________________________________
>
>
>
>
> El 10/12/2010, a las 14:51, Diego Alonso Montoya Goicochea escribió:
>
>>
>> Buenas tardes mi nombre es Diego Montoya y estoy interesado en
>> saber si ustedes cuentan con la programación de un sistema de linea
>> de espera con 1 servidor (simulación) , parece que mi programa
>> tiene una falla y  quisiera ver cual es el error:Yo estoy
>> realizando el sistema pero para 2 servidores.
>> Muchas gracias saludos 		 	   		
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-help-es mailing list
>> R-help-es en r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>


-- 
Joshua Benjamín Kunst Fuentes
http://joshuakunst.net



Más información sobre la lista de distribución R-help-es