need Help Simulation in ruby

Discussion in 'Ruby' started by Steven Boss, Sep 20, 2010.

  1. Steven Boss

    Steven Boss Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
    Steven Boss, Sep 20, 2010
    #1
    1. Advertising

  2. Steven Boss

    Steven Boss Guest

    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


    --
    Posted via http://www.ruby-forum.com/.
    Steven Boss, Sep 20, 2010
    #2
    1. Advertising

  3. 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)?
    --
    Posted via http://www.ruby-forum.com/.
    Brian Candler, Sep 20, 2010
    #3
  4. Steven Boss

    Steven Boss Guest

    Brian Candler 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
    --
    Posted via http://www.ruby-forum.com/.
    Steven Boss, Sep 21, 2010
    #4
  5. Steven Boss

    Steven Boss Guest

    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?
    --
    Posted via http://www.ruby-forum.com/.
    Steven Boss, Sep 21, 2010
    #5
  6. 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.
    --
    Posted via http://www.ruby-forum.com/.
    Brian Candler, Sep 21, 2010
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. spectrallypure
    Replies:
    0
    Views:
    827
    spectrallypure
    Mar 28, 2007
  2. KellyB
    Replies:
    4
    Views:
    1,076
    KellyB
    Aug 26, 2008
  3. jasperng
    Replies:
    0
    Views:
    1,297
    jasperng
    Nov 27, 2008
  4. Hal Fulton

    Ruby (quiz?) simulation idea

    Hal Fulton, Dec 7, 2004, in forum: Ruby
    Replies:
    8
    Views:
    149
    James Edward Gray II
    Dec 7, 2004
  5. mepython

    Simulation libraries in Ruby?

    mepython, Jan 29, 2005, in forum: Ruby
    Replies:
    2
    Views:
    164
    Joel VanderWerf
    Jan 29, 2005
Loading...

Share This Page