Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: Assign guests to hotel rooms by gri6507
in thread Assign guests to hotel rooms by richard5mith

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found