Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Assign guests to hotel rooms

by QM (Parson)
on Sep 15, 2005 at 15:47 UTC ( [id://492293]=note: print w/replies, xml ) Need Help??


in reply to Assign guests to hotel rooms

Also without getting into specific algorithms, it seems you need to do something along the following:
1) Generate combinations of people-room tuples (perhaps using an iterator instead of all at once).
2) Write a scoring function that returns a value showing how good the match is on each tuple.
2a) You may also want a scoring function that looks at overall efficiency, such as wasted space and empty rooms.
3) Iterate through the combinations, keeping track of which solutions have the highest totals.

Depending on the size of the problem set, you may need to optimize this by pruning the search space. You need to ask yourself if you want a pretty good solution, or the optimal. Optimal may take a long time to find, while pretty good could be an order of magnitude quicker.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re^2: Assign guests to hotel rooms
by richard5mith (Beadle) on Sep 15, 2005 at 16:05 UTC
    I'm happy with good. The user can always change it afterwards to something more optimal.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found