Algorithm to Minimize Number of Shipments from Multiple Warehouses

前端 未结 5 1683
伪装坚强ぢ
伪装坚强ぢ 2021-02-10 13:04

I have 10 warehouses across the US. Each of them may or may not have product A, B, C, D, E in stock. Someone orders all five items from my website.

I want to minimize th

5条回答
  •  既然无缘
    2021-02-10 13:34

    Your problem is exactly the classical set cover optimization problem, which is NP-hard; the "universe" is the set of items that the user wants, and the candidate sets are the warehouses.

    The algorithm proposed by @user384706 and @Kickaha is the greedy algorithm discussed there, which is an okay approximation.

    If you want to find the actual optimal solution, your best bet is to use the integer linear programming formulation and plug into some ILP solver.

    You say you don't care about distances, but if you did the set cover problem also accounts for a cost per warehouse (c(s) on the wiki page) that would represent farther-away warehouses being less optimal to pick.

提交回复
热议问题