On Tue, 20 Oct 2015 20:01 Martin Schöön <martin.sch...@gmail.com> wrote:
It has been a while. I have mastered solving Kenken and Sudoku using Python-constraint. I still have no clue on how to tell the solver how to constrain the number of occupants in rooms: I have made up an simple example with nine persons and three rooms. Wishes for room mates are mild in the extreme so it is very easy for a human to place these nine persons in the three three-bed rooms such that all wishes are fulfilled. Python-constraint set up by me finds 27 solutions of which most place more than three persons in at least one room. Anyone into CSP willing to offer me a hint? How have you defined your constraints? How have you defined the variables you want to solve for? Do you know whether or not the real problem you want to solve typically has any solutions satisfying all constraints? It won't be possible to answer that question a priori without looking at the data and the approach to take differs substantially if the system is overdetermined. Another approach BTW would be to model the wishes as a directed graph with children as vertices and wishes as arcs. This way you can partition the graph into weakly connected components so that your problem is reduced to placing components into rooms rather than individuals. -- Oscar
-- https://mail.python.org/mailman/listinfo/python-list