Need Help Simulation in ruby

Hi everyone can someone help me with my simulation program:

Here is the problem:
An Ambulance are dispatched at a rate of one every 15 + 10 minutes in a
large metropolitan area. Fifteen percent of the calls are false alarm
which requires 12 + 2 minutes to complete. All other calls can be one of
two kinds. First kind are classified as serious. They constitute 15% of
the non-false alarm calls and take 25 + 5 minutes to complete. The
remaining call take 20 + 10 minutes to complete. Assume that there are
very large number of available ambulance, and that any number can be on
call at any time. Write a program that would simulate the system’s 500
call to be completed.

i think it is similar to this topic:
http://www.ruby-forum.com/topic/215134#new

Steven Boss wrote:

Hi everyone can someone help me with my simulation program:

Here is the problem:
An Ambulance are dispatched at a rate of one every 15 + 10 minutes in a
large metropolitan area. Fifteen percent of the calls are false alarm
which requires 12 + 2 minutes to complete. All other calls can be one of
two kinds. First kind are classified as serious. They constitute 15% of
the non-false alarm calls and take 25 + 5 minutes to complete. The
remaining call take 20 + 10 minutes to complete. Assume that there are
very large number of available ambulance, and that any number can be on
call at any time. Write a program that would simulate the system’s 500
call to be completed.

i think it is similar to this topic:
http://www.ruby-forum.com/topic/215134#new

i tried to start from scratch so:

Ambulance(Dispatch Rate) – 15sec ->10 Minutes
1 False alarm Calls(15%) – 12sec -> 2Minutes
1 Non-False alarm(15%) – 25sec -> 5minutes
Normal Calls – 20sec -> 10minutes

Steven Boss wrote:

Here is the problem:
An Ambulance are dispatched at a rate of one every 15 + 10 minutes in a
large metropolitan area. Fifteen percent of the calls are false alarm
which requires 12 + 2 minutes to complete. All other calls can be one of
two kinds. First kind are classified as serious. They constitute 15% of
the non-false alarm calls and take 25 + 5 minutes to complete. The
remaining call take 20 + 10 minutes to complete. Assume that there are
very large number of available ambulance, and that any number can be on
call at any time. Write a program that would simulate the system’s 500
call to be completed.

i think it is similar to this topic:
http://www.ruby-forum.com/topic/215134#new

Yes, remarkably similar.

My advice to you would be the same: start by doing the simulation by
hand
, using paper and pencil. Do it for at least 5 ambulances so that
you can be clear about the sequence of actions. Then automate that
sequence.

The question seems ambiguous in several ways, so as you do it, write
down what interpretation you have chosen. For example, what does “15 +
10 minutes” mean? Perhaps it means 15 +/- 10 minutes (i.e. 5 to 25), or
between 15 and 15 + 10 (i.e. 15 to 25). Is this a linear distribution,
i.e. all times equally likely? Is it discrete (exactly 5 or 6 or … 25
minutes), or continuous (any fractional value between 5.0 and 25.0)?

Just to Clarify:

An Ambulance are dispatched at a rate of one every 15sec to 10 minutes
in a
large metropolitan area. 15% of the calls are false alarm
which requires 12sec to 2 minutes to complete. All other calls can be
one of
two kinds. First kind are classified as serious. They constitute 15% of
the non-false alarm calls and take 25sec to 5 minutes to complete. The
remaining call take 20sec to 10 minutes to complete. Assume that there
are
very large number of available ambulance, and that any number can be on
call at any time. Write a program that would simulate the system’s 500
call to be completed.

Ok so i need to loop numbers from 1 -500 for the ambulance
then set a three type of calls
-> False Alarm Calls (it takes 12sec to 2 minutes to process the
calls)
-> Non-False Alarm Calls (it takes 25sec to 5 minutes to process the
calls)
-> Normal Calls (it takes 20sec to 10 minutes)

after getting a call i need to add the dispatch rate of an ambulance for
15sec to 10minutes
Example i’ll put it in a Table:
Ambulance # / Time(Call Received)/Time(Process Request)/Call Type/Time
Dispatch / Total Time

em i correct sir?

Brian C. wrote:

My advice to you would be the same: start by doing the simulation by
hand
, using paper and pencil. Do it for at least 5 ambulances so that
you can be clear about the sequence of actions. Then automate that
sequence.

The question seems ambiguous in several ways, so as you do it, write
down what interpretation you have chosen. For example, what does “15 +
10 minutes” mean? Perhaps it means 15 +/- 10 minutes (i.e. 5 to 25), or
between 15 and 15 + 10 (i.e. 15 to 25). Is this a linear distribution,
i.e. all times equally likely? Is it discrete (exactly 5 or 6 or … 25
minutes), or continuous (any fractional value between 5.0 and 25.0)?

thx for the response i’ll try your advice thanks brain

cheers

Steven Boss wrote:

Just to Clarify:

An Ambulance are dispatched at a rate of one every 15sec to 10 minutes
in a
large metropolitan area. 15% of the calls are false alarm
which requires 12sec to 2 minutes to complete. All other calls can be
one of
two kinds. First kind are classified as serious. They constitute 15% of
the non-false alarm calls and take 25sec to 5 minutes to complete. The
remaining call take 20sec to 10 minutes to complete. Assume that there
are
very large number of available ambulance, and that any number can be on
call at any time. Write a program that would simulate the system’s 500
call to be completed.

Ok so i need to loop numbers from 1 -500 for the ambulance
then set a three type of calls
-> False Alarm Calls (it takes 12sec to 2 minutes to process the
calls)
-> Non-False Alarm Calls (it takes 25sec to 5 minutes to process the
calls)
-> Normal Calls (it takes 20sec to 10 minutes)

after getting a call i need to add the dispatch rate of an ambulance for
15sec to 10minutes
Example i’ll put it in a Table:
Ambulance # / Time(Call Received)/Time(Process Request)/Call Type/Time
Dispatch / Total Time

em i correct sir?

As I said before, I’d replicate exactly what you’d do on paper. For
example, I suspect that on each piece of paper you’d mark the time which
the call arrived, the type of call it was, and the time it took to
complete (or end time).

Re-reading the question, it is still highly ambiguous. It starts by
saying that an ambulance is dispatched every N seconds, and I would
imagine that each ambulance is only dispatched in response to a call.
But presumably you would not dispatch an ambulance in response to a
“false alarm” call? So does it actually mean that a call is received
every N seconds, rather that an ambulance is dispatched every N seconds?

Or you are supposed to estimate the rate of incoming calls, working
backwards from the rate of ambulance dispatch and the proportion of
non-false alarms?

Another interpretation is that every call results in an ambulance being
dispatched, and the crew decide it’s a false alarm only once they’ve
arrived and assessed the situation. But then, all calls would take the
same amount of time to process, since you wouldn’t know at call time
whether it was a false alarm or not.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs