Case description
A local company owns three 3D printers installed in its three different branches. Clients can call the company and reserve the use of one printer for some hours. Because of the heavy request for its printers and the time needed for maintaining the machines, the company receives requests from clients for one week and then schedules the use of its machines for the next week. When a client calls the company, he/she has to specify the number of hours he/she needs a printer, the preferred printing branch (1, 2, or 3), and his/her name.
The company wants to test different scheduling strategies and select the most beneficial one. These strategies include:
- First Come First Serve (FCFS): This strategy will not consider the preferences of the clients. However, it will consider the order of their requests. It will assign the earliest available printer to the client.
- Shortest Work Duration First (SWDF): This strategy will not consider the preferences of the clients. It will assign the printers by giving priority to the clients who requested the shortest work durations. Like in FCFS, the clients will be assigned to the earliest available printer.
- Longest Work Duration First (LWDF): This strategy will not consider the preferences of the clients. It will assign the printers by giving priority to the clients who requested the longest work durations. Like in FCFS, the clients will be assigned to the earliest available printer.
- Preference-Based (PB): This strategy will assign the printers to the clients according to their preferences.
In order to assess the performance of each strategy, the company will be using the following two measures
- Work duration: For each of the four strategies FCFS, SWDF, LWDF, and PB, the company will schedule the requests of clients in a way to optimize the use of its printers (finish all the jobs as early as possible).
- Client satisfaction: For the three strategies FCFS, SWDF, and LWDF, the company will calculate the satisfaction percentage (percentage of clients who were assigned to the printers in the locations they prefer).
Your work
- Implement each of the four strategies as a separate user-defined function.
- Implement the function main() that asks the user to enter as many printer reservations as he/she wishes. For each reservation, the user has to enter the name of the client, the requested duration for the use of the printer as well as the preferred working site. Once the user stops entering new reservations, the function main() will call successively FCFS, SWDF, LWDF, and then PB. The function main() will do the following tasks:
2
o For each printing site, display the order of client names as well as their starting and finishing job times. The result will be something like:
1. Client1 (S:0 , F:7) 2. Client2 (S:7 , F:15) 3. Client3 (S:15 , F:20) ....
Remark: Here S means Start and F means Finish.
o For each printing site, display the total time to finish the assigned jobs.
o For each strategy, display the time needed to finish all the jobs as well as the clients' satisfaction percentage.
o Display which strategy if the best to choose if the company is trying to minimize the printers working duration.
The output of your C++ program could be something similar to what follows:
Please enter the following information ...
>>> Client: Adel
>>> Job duration: 7
>>> Preferred site (1/2/3): 1
More reservations (Y/N): Y
>>> Client: Leila
>>> Job duration: 10
>>> Preferred site (1/2/3): 3
More reservations (Y/N): Y
...
<<< First Come First Serve (FCFS) >>>
Site 1 -----------
Order: 1. Adel (S:0 , F:7) ...........................
Duration: 75 hours, Satisfaction: 25%
Site 2 -----------
Order: 2. Leila (S:0 , F:10) .....................
Duration: 50 hours, Satisfaction: 35%
Site 3: ............................................................
<<< Shortest Work Duration First (SWDF) >>>
Site 1 -----------
Order: 1. ...........................
Duration: ....................., Satisfaction: .....................
Site 2 ............................................................
Site 3: ............................................................
3
<<< Longest Work Duration First (LWDF) >>>
..................................................................
<<< Preference-Based (PB) >>>
..................................................................
BEST STRATEGY FOR THE CURRENT JOB REQUESTS IS .................................