Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Assign guests to hotel rooms

by gri6507 (Deacon)
on Sep 15, 2005 at 12:44 UTC ( [id://492188]=note: print w/replies, xml ) Need Help??


in reply to Assign guests to hotel rooms

This sounds like a very familiar problem. Before suggesting any algorithms, I will state some assumptions: At the time of this room assignment, the room statuses are staying in the constant state (i.e. all free rooms will remain free and all occupied rooms are not available for assignment and will remain that way) and the guest list is constant (we are asked to find the optimal arrangement for our guests given that no new guests will be signing up) Finally, a guest should be defined as a set of people (adults, children and infants) who make a single reservation. In other words, a family of two adults, one child and one infant is four people, but only one reservation.

With these disclamers in mind you want to do something like

  • Take the first available room. For every reservation, find the reservation that has the correct number of people for that room.
  • If no reservation is found that fits the room type completely, try finding a reservation with one fewer adults (least restrictive)
  • If that doesn't work, then try finding a reservation with one fewer children (next most restrictive)
  • If that doesn't work, then try finding a reservation with one fewer infants (lease restrictive)
  • If that doesn't work, then try finding a reservation with one fewer adults and one fewer children then one fewer adults and one fewer infants and one fewer children and one fewer infants
  • etc ...

This would require many passes through the guest list, but for a usual hotel, we are only talking about reservations numbering in low hundreds at most, so algorithm execution should not be that great of a concern. Hope this helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://492188]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-28 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found