Implement the simulator customer queue and event queue

Assignment Help Other Subject
Reference no: EM132371429

Assignment -

TASK: You have been hired by a major supermarket chain to model the operation of a proposed supermarket by using a Discrete Event Simulation. The shop has several servers (or checkouts), each of which has a different level of efficiency due to the experience of the server operator. It also takes longer to serve credit card customers. The service time of each customer is calculated as follows:

service_time = (tally_time x efficiency) + payment_time

where:

tally_time: time it takes to tally up the customer's goods

efficiency: the efficiency of the server

payment_time: 0.3 for cash or 0.7 for credit card

The input file "ass2.txt" contains the records of each customer entering the shop and consist of:

1. arrival time (at the server queue),

2. tally time (time it takes to scan the customer's items and add up the cost)

3. payment method (cash or card).

Your program should:

arrival time (at the server queue),

tally time (time it takes to scan the customer's items and add up the cost)

payment method (cash or card).

1. Open the text file "ass2.txt" (Note: "ass2.txt" should be a hardcoded as a constant.)

2. Read the efficiencies of each server.

3. Read and process the customer arrival and service time data.

4. Print service statistics on the screen.

Note:

1. This shop has a single queue of customers waiting to be served.

2. The servers are initially all idle.

3. If more than one idle server is available, the next customer is served by the server with the best efficiency (i.e. the smallest efficiency value).

4. Customers must be served or queued in the order in which they arrive.

5. You should not attempt to read in all the arrival data at the start of the simulation.

At the end of the simulation, after the last customer in the file has been served, your program should print out the following information:

1. The number of customers served.

2. The time that it took to serve all the customers.

3. The greatest length reached by the customer queue.

4. The average length of the customer queue.

5. The average time spent by a customer in the customer queue. (If a customer is served immediately, their queue time is 0.0).

6. The percentage of customers who's waiting time in the customer queue was 0 (zero).

7. For each server:

  • The number of customers they served
  • The time they spent idle.

You must choose appropriate data structures and algorithms to accomplish this task quickly. You will lose marks if you use STL, or equivalent libraries, to implement data structures or algorithms. Note: A larger input data file may be used for the final assessment of your program.

Step-1

For step 1 you are to implement the simulator's customer queue and event queue.

Implement the customer queue (FIFO queue). It should have a maximum size of 500 records. Each record in the customer queue should contain two doubles and a boolean (i.e. arrival time, tally time and payment method). Your customer queue should have functions for adding an item (enqueue), removing an item (dequeue), and for testing if the queue is empty. (Note: C++ and Java coders should also add a constructor for initialsing the queue.)

FIFO Queue

1085_figure.png

Test your customer queue by declaring an instance of it in the main(). Use a for loop to add 10 records to the queue. Set the arrival time for each record between 1 and 100 using rand() or random(). The other fields can be set to 0 or false. Also, print the arrival times on the screen as you add them. Now use a while loop to remove all the records from the customer queue and print the arrival times on the screen. Is the output correct?

Now implement the simulator's event queue (i.e. a priority queue). The event queue's records should contain an event type (int or enum), event time & tally time (doubles), and payment method (boolean). You can assume the maximum number of events in the event queue is 100. The record with the minimum event time has the highest priority.

1768_figure1.png

 Test the event queue by declaring an instance of it in the main(). Use the while loop (implemented previously) to remove records from the customer queue and add them to the event queue. Set the event time with the customer's arrival time. Set the other ?elds to zero. Then implement a while loop in the main() to remove (dequeue) each record from the event queue and print the event time on the screen. Is the output correct?

Note: For step-1 (to get the 2 demo marks) you can implement the customer and event queues using any method you like. However, for the final submission, to get full marks, you should ensure all data structures and algorithms are optimised for speed.

Step-2 (Server array implementation)

The server array should have a maximum of 20 servers. Each server should have a busy flag (boolean), an efficiency factor (double) and other data members for calculating the stats. C++ and Java coders should implement the server array with a class, preferably, and provide public functions for adding, and removing customers to/from the servers, finding the fasted idle server, etc. according to the specs on page 1.

Step-3 (Processing in the data)

When you have the customer queue, event queue and server array correctly completed, delete the main() test code from step 1 and replace it with code for reading the input data file "ass2.txt" and processing the data, as explained on page 1. The following algorithm shows how a typical discrete time simulator can be implemented:

main()

Declare variables and instances and do initialisations

Open the input data file; if not found print error and exit

Read first CustomerArrival event from file and add it to the event queue

While the event queue is not empty . . .

Get the next event from the event queue and set CrntTime to the event time

If the event type = CustomerArrival event . . .

if an idle server is available . . .

Find fastest idle serve

set the server's idle flag to busy

calculate the server's finish time from event's customer data

add ServerFinish event to the event queue

Else

Add event's customer to the customer queue

End if

If not EOF...

Read next customer arrival from file

add CustomerArrival event to the event queue

End if

Else // event type must be a ServerFinish event . . .

Get server no. from event, set server[no] to idle and do server's stats If customer queue is not empty . . .

Get next customer from the customer queue

Find fastest idle serve

set the server's idle flag to busy.

calculate the server's finish time

add ServerFinish event to the event queue

End if

End if

End while

Print stats

End main()

Step-4 (Optimisation and stats)

When you have the discrete time simulation working correctly, add the necessary data members and variables needed for calculating all the required stats, as explained on page 1, and optimise your simulator for speed.

Step-5 (Specifications)

In a comment block at the bottom of your program (no more than 20 lines of text) list all the data structures and algorithms used by your program to process the input data. Include any enhancements you did to speed up your program (if any). For this step, marks will be awarded based on how accurately and clearly you describe your program.

Reference no: EM132371429

Questions Cloud

Provide a critical analysis of the disaster event : Assignment - Surveillance and Disaster Planning. Provide a critical analysis of the disaster event. Provide for appropriate management of resources
Famous quote from theodosius dobzhansky : What does the famous quote from Theodosius Dobzhansky "Nothing makes sense in biology except in the light of evolution"?
Project manager assigned to renovate parking garage : You are the project manager assigned to renovate a parking garage. What might be some examples of leads you encounter when scheduling work activities?
Explain how the framework guided the research decisions : Explain how the framework guided the research decisions, including the development of the problem statement, purpose statement
Implement the simulator customer queue and event queue : For step 1 you are to implement the simulator's customer queue and event queue. Test your customer queue by declaring an instance of it in the main()
Define organizational strategy : In your own words, define organizational strategy. Explain the relationship between a business's organizational strategy and its projects.
Principles of economics in mcgraw-hill connect : Read the following chapters of Principles of Economics in McGraw-Hill Connect. A country's net capital inflows equal its trade deficit?
Quaternary structures of protein synthesis : What occurs during the primary, secondary, tertiary, and quaternary structures of protein synthesis?
Who gains and who loses when economy opens for trade : Discuss who gains and who loses when an economy opens for trade. Explain what determines exchange rates in the short and long run.

Reviews

len2371429

9/16/2019 2:12:26 AM

Marking Guide - Marks will be awarded for the appropriate use of data structures and the efficiency of the program at processing the input and producing the correct output. Marks may be deducted for untidy or poorly designed code. Appropriate comments should be provided where needed. There will be a deduction of up to 4 marks for using STL, or equivalent libraries, rather than coding the data structures and algorithms yourself. You may use string or String type for storing words or text, if you wish.

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd