I’m curious about the warehouse placement problem. Suppose N nodes exist, each with average demand across all products (or a single product for simplicity.) the problem is to position M warehouses that such that distances from each node to the closest warehouse is minimized.

How can I model this problem with MILP?

I’m more interested in an explanation of constraints, objective and relevant data than a specified model in a given framework (ex Gurobi).

  • 1
    $\begingroup$ Are the warehouses allowed to be placed anywhere, or must their locations be chosen from among the given nodes? $\endgroup$
    – RobPratt
    Jan 18 at 3:14
  • $\begingroup$ @RobPratt is either easier from implementation stand point? For this problem, either is acceptable. $\endgroup$
    – jbuddy_13
    Jan 18 at 3:33
  • 2
    $\begingroup$ Yes, the version where each warehouse must be located at a node is easier. For the other version, search for multi-source Weber problem. $\endgroup$
    – RobPratt
    Jan 18 at 4:50
  • 1
    $\begingroup$ Sounds like the Facility Location Problem. $\endgroup$ Jan 18 at 9:34

1 Answer 1


For the problem described in the question, with the added assumption that a finite set of potential warehouse locations is specified, a MILP model would look as follows. There would be a binary variable for each location (place a warehouse there or not) and a constraint that those variables sum to $M$ (or sum to less than or equal to $M$ if you are not required to use the full quota of warehouses). For each pair of customer and potential location there would be a binary variable (assign that customer to that location) along with constraints that every customer be assigned once and every no assignment can be made to a location without a warehouse. The objective would be the weighted sum of the assignment variables, with the distances being the weights.

Note that this is a rather bare-bones warehouse location problem. More common variants in supply chain management have capacity limits on warehouses, plus constraints that the total demand allocated to each warehouse not exceed its capacity. It is fairly common (though not universal) that client demands can be split across warehouses if desired. The objective function might combine the cost of fulfilling demands (which likely would depend on distances from warehouse to customer) plus possibly a construction/"setup" cost for placing a warehouse at a location, plus possibly a cost component dependent on the capacity of a warehouse (if it is possible to build various size warehouses at a site), plus possibly an operating cost for each warehouse (which again might be dependent on capacity).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.