I'm trying to formulate what I think is a solveable integer linear programming problem. The use application is creating a set of mutually exclusive patrol areas for a police department, and I have formulated it similar to an assignment problem. The main difference is I want to limit the number of source locations assigned to a destination location. So given S sources and J destinations, we then have a set of Part of my confusion is other work hasn't formulated the table like this S*D decision variables, but has destinations and sources as separate variables, and then simply says the sum of the source variables equals P (see this paper for one example). I'm not quite sure how to formulate the problem like that though. Here is my current code in python using the pulp library. Any suggestions are appreciated.
asked 28 Aug '17, 12:01 AndyW 
This is known as the \(p\)median problem. Some formulations use both \(x_{ij}\) and \(y_i\) as binary decision variables, but you can also eliminate \(y_i\) by replacing it with \(x_{ii}\). The cardinality constraint is either \(\sum_i y_i = p\) or \(\sum_i x_{ii} = p\). You don't need any permutations. answered 28 Aug '17, 14:45 Rob Pratt Thank you  I thought the second constraint you listed, just the sum of x_ii (on the diagonal) would work, but in my example if that is the only additional constraint then I get a solution for my example problem as
(28 Aug '17, 15:10)
AndyW

One solution I've found  for at least this particular problem  is the idea to set constraints on the sum of the rows. So if you take one unique destination for each source, they should at max sum to the total number of areas you want to limit the solution to. So in my example, the option
If folks have a simpler formula though I would appreciate the input. answered 28 Aug '17, 14:28 AndyW 