question archive Trucks arrive at a warehouse in a random manner and are loaded/unloaded at a service bay

Trucks arrive at a warehouse in a random manner and are loaded/unloaded at a service bay

Subject:Computer SciencePrice: Bought3

Trucks arrive at a warehouse in a random manner and are loaded/unloaded at a service bay. If a truck arrives and no service bays are available, the truck waits in line until a service bay is available. This type of waiting line is called a first-in-first-out (FIFO) or first-come-first-serve (FCFS) waiting line model or queue. The Java LinkedList class is a good class for implementing a waiting line model like this in code.

A truck has a unique identifier (an integer number), an arrival time, and a service time (the time it takes to load/unload). Assume that, on average, 3 trucks per hour arrive at the warehouse, and that the average service time is 15 minutes. Further assume that the time between truck arrivals (the interarrival time) and the service times both follow an exponential probability distribution. You may use any integer number for a truck's identifier.

Let's suppose we need to an application that simulates the arrival and servicing of trucks. One part of such an application would involve generating the random arrivals of trucks and their associated attributes. Write a program that uses a LinkedList object to store a list of trucks in a FIFO queue. The program should generate truck arrivals over a 10 hour period. When the truck arrivals are generated the program should display the truck information in the order that trucks arrived. The arrival times and service times should be expressed in minutes. You may assume that time starts at zero minutes.

For this assignment, you can use the supplied ExpoRandom class code to generate exponential interarrival times and service times. To use this class you use an ExpoRandom class instance for each distribution that will be simulated and you must call its constructor with a random number seed (a long integer) and an arrival rate (a double). For example, if there are 30 arrivals per hour, you can use an exponential random number generator object like this:

ExpoRandom randomNumGenerator = new ExpoRandom(10302047, .50);

The first parameter in the constructor is the random number seed. A seed is used to generate a unique sequence of random numbers...and those random numbers will be generated each time a program is specifying a seed can be helpful in debugging a program. The second parameter in the constructor is the arrival rate (30 arrivals per hour is equivalent to .50 arrivals per minute). Once a random number generator is created, calling its nextValue() method will return the next interarrival time (or next service time) in the sequence. As an example, the following code will generate and display the first 10 interarrival times for the above random number generator:

for( int j = 1; j <= 10; j++ )

System.out.println( randomNumGenerator.nextValue() );

Using the above data, the first 10 interarrival times and system arrival time are as follows:

Interarrival time is 0.4568341875612324 Arrival time is 0.4568341875612324

Interarrival time is 2.2505058995841494 Arrival time is 2.707340087145382

Interarrival time is 2.208968067974442 Arrival time is 4.9163081551198236

Interarrival time is 1.458573153013569 Arrival time is 6.374881308133393

Interarrival time is 1.5951414910113557 Arrival time is 7.970022799144749

Interarrival time is 1.0783825823271758 Arrival time is 9.048405381471925

Interarrival time is 0.24061670590852366 Arrival time is 9.289022087380449

Interarrival time is 1.9579473641566292 Arrival time is 11.246969451537078

Interarrival time is 0.772750783678947 Arrival time is 12.019720235216026

Note that you should use a separate random number generator object for the interarrival distribution and the service time distribution.


Purchase A New Answer

Custom new solution created by our subject matter experts


Related Questions