Using the Average Waiting Time program determine a reasonable number of queues t
ID: 3818150 • Letter: U
Question
Using the Average Waiting Time program determine a reasonable number of queues to use if there are 1000 customers and:
please answer the questions and no code as a response. Please do not use a image. please only execute and answer them. no image thank you.
a) The inter-arrival time is 5 and the service time is 5
b) The inter-arrival time is 1 and the service time is 5
c) The inter-arrival time ranges from 0 to 20, and the service time ranges from 20 to 100
d) The inter-arrival time ranges from 0 to 2, and the service time ranges from 20 to 100
in each case, de4scribe how you arrived at your result
ArrayUnbndQueue.java
//---------------------------------------------------------------------------
// ArrayUnbndQueue.java by Dale/Joyce/Weems Chapter 5
//
// Implements UnboundedQueueInterface with an array to hold queue elements.
//
// Two constructors are provided; one that creates a queue of a default
// original capacity and one that allows the calling program to specify the
// original capacity.
//
// If an enqueue is attempted when there is no room available in the array, a
// new array is created, with capacity incremented by the original capacity.
//---------------------------------------------------------------------------
package ch05.queues;
public class ArrayUnbndQueue<T> implements UnboundedQueueInterface<T>
{
protected final int DEFCAP = 100; // default capacity
protected T[] queue; // array that holds queue elements
protected int origCap; // original capacity
protected int numElements = 0; // number of elements in the queue
protected int front = 0; // index of front of queue
protected int rear; // index of rear of queue
public ArrayUnbndQueue()
{
queue = (T[]) new Object[DEFCAP];
rear = DEFCAP - 1;
origCap = DEFCAP;
}
public ArrayUnbndQueue(int origCap)
{
queue = (T[]) new Object[origCap];
rear = origCap - 1;
this.origCap = origCap;
}
private void enlarge()
// Increments the capacity of the queue by an amount
// equal to the original capacity.
{
// create the larger array
T[] larger = (T[]) new Object[queue.length + origCap];
// copy the contents from the smaller array into the larger array
int currSmaller = front;
for (int currLarger = 0; currLarger < numElements; currLarger++)
{
larger[currLarger] = queue[currSmaller];
currSmaller = (currSmaller + 1) % queue.length;
}
// update instance variables
queue = larger;
front = 0;
rear = numElements - 1;
}
public void enqueue(T element)
// Adds element to the rear of this queue.
{
if (numElements == queue.length)
enlarge();
rear = (rear + 1) % queue.length;
queue[rear] = element;
numElements = numElements + 1;
}
public T dequeue()
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes front element from this queue and returns it.
{
if (isEmpty())
throw new QueueUnderflowException("Dequeue attempted on empty queue.");
else
{
T toReturn = queue[front];
queue[front] = null;
front = (front + 1) % queue.length;
numElements = numElements - 1;
return toReturn;
}
}
public boolean isEmpty()
// Returns true if this queue is empty; otherwise, returns false
{
return (numElements == 0);
}
}
BoundedQueueInterface.java
//----------------------------------------------------------------------------
// BoundedQueueInterface.java by Dale/Joyce/Weems Chapter 5
//
// Interface for a class that implements a queue of T with a bound
// on the size of the queue. A queue is a "first in, first out" structure.
//----------------------------------------------------------------------------
package ch05.queues;
public interface BoundedQueueInterface<T> extends QueueInterface<T>
{
void enqueue(T element) throws QueueOverflowException;
// Throws QueueOverflowException if this queue is full;
// otherwise, adds element to the rear of this queue.
boolean isFull();
// Returns true if this queue is full; otherwise, returns false.
}
GlassQueue.java
//---------------------------------------------------------------------------
// GlassQueue.java by Dale/Joyce/Weems Chapter 5
//
// Extends ArrayUnbndQueue with operations to determine the size of the queue
// and to access the front and rear queue elements without removing them.
//---------------------------------------------------------------------------
package ch05.queues;
public class GlassQueue<T> extends ArrayUnbndQueue<T>
{
public GlassQueue()
{
super();
}
public GlassQueue(int origCap)
{
super(origCap);
}
public int size()
// Returns the number of elements in this queue.
{
return numElements;
}
public T peekFront()
// Returns the object at the front of this queue.
// If the queue is empty, returns null.
{
return queue[front];
}
public T peekRear()
// Returns the object at the rear of this queue.
// If the queue is empty, returns null.
{
return queue[rear];
}
}
QueueInterface.java
//----------------------------------------------------------------------------
// QueueInterface.java by Dale/Joyce/Weems Chapter 5
//
// Interface for a class that implements a queue of T.
// A queue is a "first in, first out" structure.
//----------------------------------------------------------------------------
package ch05.queues;
public interface QueueInterface<T>
{
T dequeue() throws QueueUnderflowException;
// Throws QueueUnderflowException if this queue is empty;
// otherwise, removes front element from this queue and returns it.
boolean isEmpty();
// Returns true if this queue is empty; otherwise, returns false.
}
QueueOverflowException.java
package ch05.queues;
public class QueueOverflowException extends RuntimeException
{
public QueueOverflowException()
{
super();
}
public QueueOverflowException(String message)
{
super(message);
}
}
QueueUnderFlowException.java
package ch05.queues;
public class QueueUnderflowException extends RuntimeException
{
public QueueUnderflowException()
{
super();
}
public QueueUnderflowException(String message)
{
super(message);
}
}
UnboundedQueueInterface.java
//----------------------------------------------------------------------------
// UnboundedQueueInterface.java by Dale/Joyce/Weems Chapter 5
//
// Interface for a class that implements a queue of T with no bound
// on the size of the queue. A queue is a "first in, first out" structure.
//----------------------------------------------------------------------------
package ch05.queues;
public interface UnboundedQueueInterface<T> extends QueueInterface<T>
{
void enqueue(T element);
// Adds element to the rear of this queue.
}
Simulation.java
package main;
//---------------------------------------------------------------------
// Simulation.java by Dale/Joyce/Weems Chapter 5
//
// Models a sequence of customers being serviced
// by a number of queues.
//---------------------------------------------------------------------
import support.*; // Customer, CustomerGenerator
import ch05.queues.*;
public class Simulation
{
final int MAXTIME = Integer.MAX_VALUE;
CustomerGenerator custGen; // a customer generator
//CustomerGenerator2 custGen; // fixed distribution of IATs and STs
float avgWaitTime = 0.0f; // average wait time for most recent simulation
int maxCustomersOnLine;
int maxOnQ;
public Simulation(int minIAT, int maxIAT, int minST, int maxST)
{
custGen = new CustomerGenerator(minIAT, maxIAT, minST, maxST);
}
public float getAvgWaitTime()
{
return avgWaitTime;
}
public int getMaxCustomersOnLine()
{
return maxCustomersOnLine;
}
public int getMaxOnQueue()
{
return maxOnQ;
}
public void simulate(int numQueues, int numCustomers, boolean useShortestQueue)
// Preconditions: numQueues > 0
// numCustomers > 0
// No time generated during simulation is > MAXTIME
//
// Simulates numCustomers customers entering and leaving the
// a queuing system with numQueues queues
{
// the queues
GlassQueue<Customer>[] queues = new GlassQueue[numQueues];
maxCustomersOnLine = 0;
Customer nextCust; // next customer from generator
Customer cust; // holds customer for temporary use
int customersOnLine;
int totWaitTime = 0; // total wait time
int custInCount = 0; // count of customers started so far
int custOutCount = 0; // count of customers finished so far
int nextArrTime; // next arrival time
int nextDepTime; // next departure time
int nextQueue; // index of queue for next departure
int assignedQueue;
int shortest; //
int shortestSize; //
int quickest; //
int shortestWait; //
Customer rearCust; // customer at rear of shortest queue
int finishTime; // calculated finish time for customer being enqueued
// instantiate the queues
for (int i = 0; i < numQueues; i++)
queues[i] = new GlassQueue<Customer>();
maxOnQ = 0;
// set customer generator and get first customer
custGen.reset();
nextCust = custGen.nextCustomer();
while (custOutCount < numCustomers) // while still more customers to handle
{
// get next arrival time
if (custInCount != numCustomers)
nextArrTime = nextCust.getArrivalTime();
else
nextArrTime = MAXTIME;
// get next departure time and set nextQueue
nextDepTime = MAXTIME;
nextQueue = -1;
for (int i = 0; i < numQueues; i++)
if (queues[i].size() != 0)
{
cust = queues[i].peekFront();
if (cust.getFinishTime() < nextDepTime)
{
nextDepTime = cust.getFinishTime();
nextQueue = i;
}
}
if (nextArrTime < nextDepTime)
// handle customer arriving
{
assignedQueue = 0;
if (numQueues > 1) { // determine assigned queue
shortest = 0;
quickest = 0;
if (queues[0].size() > 0) {
shortestSize = queues[0].size();
shortestWait = queues[0].peekRear().getFinishTime();
for (int i = 1; i < numQueues; i++) {
if (queues[i].size() > 0) {
if (queues[i].size() < shortestSize) {
shortest = i;
shortestSize = queues[i].size();
}
if (queues[i].peekRear().getFinishTime() < shortestWait) {
quickest = i;
shortestWait = queues[i].peekRear().getFinishTime();
}
}
else {
shortest = i;
quickest = i;
break;
}
}
}
if (useShortestQueue)
assignedQueue = shortest;
else
assignedQueue = quickest;
}
// determine the finish time
if (queues[assignedQueue].size() == 0)
finishTime = nextCust.getArrivalTime() + nextCust.getServiceTime();
else {
finishTime = queues[assignedQueue].peekRear().getFinishTime() + nextCust.getServiceTime();
}
// set finish time and enqueue customer
nextCust.setFinishTime(finishTime);
queues[assignedQueue].enqueue(nextCust);
if (queues[assignedQueue].size() > maxOnQ) maxOnQ = queues[assignedQueue].size();
custInCount = custInCount + 1;
// if needed, get next customer to enqueue
if (custInCount < numCustomers)
nextCust = custGen.nextCustomer();
}
else
// handle customer leaving
{
cust = queues[nextQueue].dequeue();
totWaitTime = totWaitTime + cust.getWaitTime();
custOutCount = custOutCount + 1;
}
customersOnLine = 0;
for (int i = 0; i < numQueues; i++) {
customersOnLine += queues[i].size();
}
if (customersOnLine > maxCustomersOnLine)
maxCustomersOnLine = customersOnLine;
//System.out.println(custInCount + " - " + custOutCount + " - " + customersOnLine);
} // end while
avgWaitTime = totWaitTime/(float)numCustomers;
}
}
SimulationApp.java
package main;
//---------------------------------------------------------------------
// SimulationApp.java by Dale/Joyce/Weems Chapter 5
//
// Simulates customers waiting in queues. Customers always enter
// the shortest queue.
//
// Input consists of customer information:
// Minimum and maximum customer inter-arrival time.
// Minimum and maximum customer service time.
// Followed by a sequence of simulation instance information:
// Number of queues and customers.
//
// Output includes, for each simulation instance:
// The average waiting time for a customer.
//----------------------------------------------------------------------
import java.util.Scanner;
public class SimulationApp
{
public static void main(String[] args)
{
Scanner conIn = new Scanner(System.in);
int minIAT; // minimum inter-arrival time
int maxIAT; // maximum inter-arrival time
int minST; // minimum service time
int maxST; // maximum service time
int numQueues; // number of queues
int numCust; // number of customers
boolean useShortestQueue;
String skip; // skip end of line after reading an integer
String more = null; // used to stop or continue processing
// Get customer information
System.out.print("Enter minimum inter-arrival time: ");
minIAT = conIn.nextInt();
System.out.print("Enter maximum inter-arrival time: ");
maxIAT = conIn.nextInt();
System.out.print("Enter minimum service time: ");
minST = conIn.nextInt();
System.out.print("Enter maximum service time: ");
maxST = conIn.nextInt();
// create object to perform simulation
Simulation sim = new Simulation(minIAT, maxIAT, minST, maxST);
do
{
// Get next simulation instance to be processed.
System.out.print("Enter number of queues: ");
numQueues = conIn.nextInt();
System.out.print("Enter number of customers: ");
numCust = conIn.nextInt();
skip = conIn.nextLine(); // skip end of line
useShortestQueue = true;
if (numQueues > 1) {
System.out.print("Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.");
skip = conIn.nextLine();
if (skip.length() > 0)
useShortestQueue = false;
}
// run simulation and output average waiting time
sim.simulate(numQueues, numCust, skip.length() == 0);
if (numQueues > 1) {
if (useShortestQueue)
System.out.println(">>> New customers are assigned to shortest queue." );
else
System.out.println(">>> New customers are assigned to queue with shortet finish time." );
}
System.out.println("Average waiting time is " + sim.getAvgWaitTime());
System.out.println("Max customers on line: " + sim.getMaxCustomersOnLine());
System.out.println("Max on a single queue: " + sim.getMaxOnQueue());
// Determine if there is another simulation instance to process
System.out.println();
System.out.print("Evaluate another simulation instance? (Y=Yes): ");
more = conIn.nextLine();
System.out.println();
}
while (more.equalsIgnoreCase("y"));
System.out.println("Program completed.");
}
}
Customer.java
//----------------------------------------------------------------------
// Customer.java by Dale/Joyce/Weems Chapter 5
//
// Supports customer objects having arrival, service, and finish time
// attributes. Responsible for computing and returning wait time.
//----------------------------------------------------------------------
package support;
public class Customer
{
protected int arrivalTime;
protected int serviceTime;
protected int finishTime;
public Customer(int arrivalTime, int serviceTime)
{
this.arrivalTime = arrivalTime;
this.serviceTime = serviceTime;
}
public int getArrivalTime()
{
return arrivalTime;
}
public int getServiceTime()
{
return serviceTime;
}
public void setFinishTime(int time)
{
finishTime = time;
}
public int getFinishTime()
{
return finishTime;
}
public int getWaitTime()
{
return (finishTime - arrivalTime - serviceTime);
}
}
CustomerGenerator.java
//----------------------------------------------------------------------
// CustomerGenerator.java by Dale/Joyce/Weems Chapter 5
//
// Generates a sequence of random Customer objects based on the
// constructor arguments for min and max interarrival and service times.
// Assumes a flat distribution of both interarrival and service times.
// Assumes time starts at 0.
//----------------------------------------------------------------------
package support;
import java.util.Random;
public class CustomerGenerator
{
protected int minIAT; // minimum inter-arrival time
protected int maxIAT; // maximum inter-arrival time
protected int minST; // minimum service time
protected int maxST; // maximum service time
protected int currTime = 0; // current time
Random rand = new Random(); // to generate random numbers
public CustomerGenerator (int minIAT, int maxIAT, int minST, int maxST)
// Preconditions: all arguments >= 0
// minIAT <= maxIAT
// minST <= maxST
{
this.minIAT = minIAT;
this.maxIAT = maxIAT;
this.minST = minST;
this.maxST = maxST;
}
public void reset()
{
currTime = 0;
}
public Customer nextCustomer()
// Creates and returns the next random customer.
{
int IAT; // next inter-arrival time
int ST; // next service time
IAT = minIAT + rand.nextInt(maxIAT - minIAT + 1);
ST = minST + rand.nextInt(maxST - minST + 1);
currTime = currTime + IAT; // updates current time to the arrival
// time of next customer
Customer next = new Customer(currTime, ST);
return next;
}
}
LLNode.java
//----------------------------------------------------------------------------
// LLNode.java by Dale/Joyce/Weems Chapter 3
//
// Implements <T> nodes for a Linked List.
//----------------------------------------------------------------------------
package support;
public class LLNode<T>
{
private LLNode<T> link;
private T info;
public LLNode(T info)
{
this.info = info;
link = null;
}
public void setInfo(T info)
// Sets info of this LLNode.
{
this.info = info;
}
public T getInfo()
// Returns info of this LLONode.
{
return info;
}
public void setLink(LLNode<T> link)
// Sets link of this LLNode.
{
this.link = link;
}
public LLNode<T> getLink()
// Returns link of this LLNode.
{
return link;
}
}
Explanation / Answer
Please find answers to each question below with the simulation run for each case.
a) The inter-arrival time is 5 and the service time is 5
Enter minimum inter-arrival time: 5
Enter maximum inter-arrival time: 5
Enter minimum service time: 5
Enter maximum service time: 5
Enter number of queues: 10
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 1
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 1
Enter number of customers: 1000
Average waiting time is 0.0
Max customers on line: 1
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): n
Program completed.
Result: It doesn't matter on how many number of queues are available when the arrival time and service time are equal. Even one queue in this case will work well. By the time the next customer arrives, the service for the current customer would be completed. Hence there would always be only one customer in the line.
b) The inter-arrival time is 1 and the service time is 5
Enter minimum inter-arrival time: 1
Enter maximum inter-arrival time: 1
Enter minimum service time: 5
Enter maximum service time: 5
Enter number of queues: 10
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 5
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 1
Enter number of customers: 1000
Average waiting time is 1998.0
Max customers on line: 801
Max on a single queue: 801
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 2
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 748.5
Max customers on line: 602
Max on a single queue: 301
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 5
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 5
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 4
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 124.5
Max customers on line: 204
Max on a single queue: 51
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 4
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 124.5
Max customers on line: 204
Max on a single queue: 51
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 5
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 5
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): n
Program completed.
Result: In this case when the number of queues was made 4 there was a waiting time of 124.5. But when the number of queues was made 5, the average time came down to 0.
Hence for this case the minimum number of queues needed would be 5. This is quite more because customers keep arriving every unit time but the service is for 5 units of time. So for every 5 units of time there would be 5 customers but only one of them is getting serviced. Hence we need 5 queues to make sure that no customer waits in line.
c) The inter-arrival time ranges from 0 to 20, and the service time ranges from 20 to 100
Enter minimum inter-arrival time: 0
Enter maximum inter-arrival time: 20
Enter minimum service time: 20
Enter maximum service time: 100
Enter number of queues: 11
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.279
Max customers on line: 13
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 12
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.021
Max customers on line: 13
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 13
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 12
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 12
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.02
Max customers on line: 14
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 13
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.002
Max customers on line: 14
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): N
Program completed.
Result: Over here the number of queues can be either 12 or 13 in order to maintain less waiting time for customers standing in the queue. This is more when compared to the previous case because the range differs for service time between 20 and 100 whereas customers arrive in time units of 0 to 20
d) The inter-arrival time ranges from 0 to 2, and the service time ranges from 20 to 100
Enter minimum inter-arrival time: 0
Enter maximum inter-arrival time: 2
Enter minimum service time: 20
Enter maximum service time: 100
Enter number of queues: 15
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 1495.621
Max customers on line: 759
Max on a single queue: 51
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 25
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 646.924
Max customers on line: 593
Max on a single queue: 24
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 35
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 316.741
Max customers on line: 426
Max on a single queue: 13
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 55
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 50.828
Max customers on line: 159
Max on a single queue: 3
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 60
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 10.486
Max customers on line: 89
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 63
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 15.675
Max customers on line: 101
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 70
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.324
Max customers on line: 73
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 72
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.451
Max customers on line: 77
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 75
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.05
Max customers on line: 77
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 80
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 75
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 79
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 79
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 78
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 78
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 77
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 74
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 76
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.054
Max customers on line: 77
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 76
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 73
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 75
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 72
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 74
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.0
Max customers on line: 72
Max on a single queue: 1
Evaluate another simulation instance? (Y=Yes): Y
Enter number of queues: 73
Enter number of customers: 1000
Please hit just Enter to assign customers to shortest queue; type anything, then Enter for shortest finish time assignment.
>>> New customers are assigned to shortest queue.
Average waiting time is 0.152
Max customers on line: 77
Max on a single queue: 2
Evaluate another simulation instance? (Y=Yes): n
Program completed.
Result: From the simulation, we can arrive at the solution that the number of queues must be in the range of 74 to 76 to maintain less waiting time for the customers int he queue. The number of queues is more in this case because the arrival time is very less comparing to the time that takes to complete service for a single customer. Hence the new customers have to wait in the queue for a long time. In order to reduce the waiting time for each customer we have to have more number of queues.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.