This document contains code snippets for solving several queueing problems:
1) A ball urn problem that models balls being randomly selected from an urn based on their assigned probabilities
2) A traffic light problem that models the time spent at a traffic light
3) A deposit problem that models deposits and withdrawals from an account over time
4) A parking lot problem that models the arrival of cars to empty parking spaces over time
5) A bus stop problem that models the arrival and waiting times of buses
6) A cash machine problem that models customer arrivals and service times at an ATM
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
29 views3 pages
Form1 Eventargs: "Ingrese L" "Ingrese P"
This document contains code snippets for solving several queueing problems:
1) A ball urn problem that models balls being randomly selected from an urn based on their assigned probabilities
2) A traffic light problem that models the time spent at a traffic light
3) A deposit problem that models deposits and withdrawals from an account over time
4) A parking lot problem that models the arrival of cars to empty parking spaces over time
5) A bus stop problem that models the arrival and waiting times of buses
6) A cash machine problem that models customer arrivals and service times at an ATM
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3
PROBLEMA DE URNA DE BOLAS
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim p(5), l(5), f(5) Dim r, k, i, j f(0) = 0 For k = 1 To 5 l(k) = InputBox("ingrese l") p(k) = InputBox("ingrese p") f(k) = f(k - 1) + p(k) Next For i = 1 To 10 r = Rnd() j=1 Do While r > f(j) j=j+1 Loop ListBox1.Items.Add(r) ListBox2.Items.Add(l(j)) Next End Sub End Class PROBLEMA DEL SEMAFORO PROBLEMA DEL DEPOSITO Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim w, i, l, q, t w = 600 l = Int(3 + 10 * Rnd()) t=t+l For i = 1 To 90 w = w - 10 If t = i Then q = 30 + 13 * Rnd() w=w+q If w > 1000 Then w = 1000 End If l = Int(3 + 10 * Rnd()) t=t+l End If Next TextBox1.Text = w End Sub End Class PROBLEMA DE PLAYA DE ESTACIONAMIENTO Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim k, j, h, s, t, a, l Dim d(50) l = -3 * Math.Log(1 - Rnd()) t=t+l
Do While t < 720
h=0 For k = 1 To 50 If t >= d(k) Then s = 80 + 50 * Rnd() d(k) = t + s k = 50 h=1 End If Next If h = 0 Then a=a+1 End If l = -3 * Math.Log(1 - Rnd()) t=t+l Loop TextBox1.Text = a End Sub End Class PROBLEMA DE PARADA DE AUTOBUSES
PROBLEMA DEL CAJERO
Public Class Form1 'Problema del cajero Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim t, d, s, c, te, toc, tp 'Se genera un valor de t antes de empezar el bucle t = t - 3 * Math.Log(1 - Rnd()) 'El valor de l es exponencial, se genera de una distribucion exponencial Do While t <= 480 c=c+1 s = 8 + 5 * Rnd() 'el valor de s es uniforme, se genera de una distribucion lineal If t >= d Then toc = toc + t - d d=t+s Else te = te + d - t d=d+s End If 'El valor de t se debe repetir antes del final del bucle t = t - 3 * Math.Log(1 - Rnd()) Loop tp = te / c TextBox1.Text = tp TextBox2.Text = toc End Sub End Class