I'm trying to solve a problem very similar to the example here: https://pythonhosted.org/PuLP/CaseStudies/a_set_partitioning_problem.html
This uses the optimization framework called PuLP to assign seats to guests at a wedding.
To provide some context, I have N guests, T tables and max S seats at each table. I have a cost matrix (N by N) which represents how much each guest wants to sit with another guest.
In the first code section, they are creating a list of all possible tables:
possible_tables = [tuple(c) for c in pulp.allcombinations(guests,
max_table_size)]
This doesn't make sense to me. I didn't expect that generation of candidate tables to be done outside the algorithm.
Is this very different from just doing a N choose K
to generate candidates, score the generated tables using the cost matrix and pick the best tables?
I'm not limited to using PuLP. I've looked at cvxpy, jump, mini-zinc, etc. I'm just having trouble how to formulate the objective and constraint when there is such interaction among elements of selected sets (it's as if items in the knap-sack problem hated or loved each other!)