Calculate shortest path through a grocery store

前端 未结 5 746
走了就别回头了
走了就别回头了 2020-12-31 06:31

I\'m trying to find a way to find the shortest path through a grocery store, visiting a list of locations (shopping list). The path should start at a specified start positio

5条回答
  •  清酒与你
    2020-12-31 07:03

    Well, you could limit the search-space using information about the layout of the store. For instance, a typical store (at least here in Germany) has many shelves in it that can be considered to form lanes. In between there are orthogonal lanes that connect the shelf-lanes. Now you define the crossings to be the nodes and the lanes to be edges in a graph. The edges are labeled with all the items in the shelves of that section of lane. Now, even for a big store this graph would be pretty small. You would now have to find the shortest path that includes all the edge-labels (items) you need. This should be possible by using the greedy/backtracking approach Tuomas Pelkonen suggested.

    This is just an idea, and I do not know if it really works, but maybe you can take it from here.

提交回复
热议问题