3 ms·
Is Prolog good for assignment problems (assigning guests to rooms or people to beds) when there are soft constraints? I asked twice on StackOverflow [0][1] and
by pbowyer 10y ago
Is Prolog good for assignment problems (assigning guests to rooms or people to beds) when there are soft constraints?
I asked twice on StackOverflow [0][1] and had the question declined each time.
[0]: http://stackoverflow.com/questions/36148764/weak-rules-in-prolog http://stackoverflow.com/questions/36148764/weak-rules-in-pr...
[1]: http://stackoverflow.com/questions/37610341/assigning-people-to-beds-approaches-to-automate http://stackoverflow.com/questions/37610341/assigning-people...
- sesqu 10y agoProlog normally finds a solution, and if you decline it, a new solution, and so on until it can't find any more solutions. If you pay careful attention to your program, you can make it so that it finds ones that satisfy soft constraints first, and then solutions that don't satisfy them. This is what the replies in [0] suggested. Prolog isn't exactly intended for preferring some solutions over others, but it has predictable solution generation that can be used to prescribe priority. That's a lot of mental work, but the code is succinct. If you want to get by without flow diagrams, your best bet is to generate and optimize a cost function, and that can be done in any language.
- e12e 10y agoI was in touch with some researchers that had implemented a shift-scheduling system in Prolog - even got a sample of the code, bit in the end we had a small roster, and managed to agree on a good rotating schedule - so I never got around to really test it... But prior to that my plan was to try and write such a system in Prolog (or some kind of embedded logic, like mini kanten). Note that while Prolog can find all solutions to a combinatorial problem, it can't (obviously) protect you from the complexity of searching all solutions...