I have a scheduling problem I’m trying to figure out a best fit algorithm to use.
A hotel owns a theme park and is a highlight for visitors staying at the hotel. However, the hotel has more rooms than day passes for visitors wanting to go to the theme park. So during the peak months, there is a possibility that some will not get to go to the theme park.
We want to have every visitor given at least 1 chance to visit the theme park.
If there is contention, we would want to favour giving the day pass to visitors who stay longer at the hotel.
Can anyone point me in the right direction on which algorithm will fit the problem best?
No this is not homework. 🙂
Thanks in advance.
You can use Priority Queue (PQ). Every day you put customers in your (PQ) computing the priority as
p = 1/rwhereris the number of remaining days for that guest in your hotel. In this way, every day you give away yournpasses to thencustomers who have fewer days to stay at your hotel (if a customer has just 1 more day to stay, she/he must have the highest priority in getting the pass, because there just one possibility). If you have several customers with equalpthen you choose among them by looking at the total number of days that they stay at your hotel, and you favour those customers staying longer.