根据以前的购物旅行对购物清单进行排序
我想根据以前的购物旅行中检查订单项目的购物清单。例如,我去商店和购物苹果,香蕉和鸡蛋。
接下来,我去商店我买鳄梨,番茄和苹果。在我下次旅行中,应用程序将鳄梨,番茄和苹果分类在鸡蛋fe之前,
我发现了这篇文章谈论拓扑排序:如何根据以前的选订单对购物清单进行分类?。
但是,我不确定这是如何工作的,因为从理论上讲,我可以有周期(用户可以从理论上检查苹果,然后是香蕉,然后在苹果面前检查香蕉)。
您能指导我解决这个问题吗?
亲切的问候
I want to sort a shopping list based on the order items were checked off in previous shopping trips. For example I go to the store and shop Apples, Bananas and Eggs.
Next I go to the store I shop Avocados and Tomatos and Apples. For my next trip the application sorts Avocados, Tomatos and Apples all before Eggs f.e.
I found this post talking about topological sorting: How to sort a shopping list based on previous pick order?.
However I am not sure how this should work since in theory I could have cycles (A user could theoretically check off apples and then bananas and the next time bananas are checked off before apples).
Could you guide me on how to tackle this problem?
Kind regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设:
我的想法是根据以下订单中看到的物品分配权重:
权重可能需要调整,但是,使用您链接到的其他问题的数据,下面的 python代码确实会根据历史订单创建订单:
I assume:
My idea is to assign weights to items seen in past orders based on:
The weightings might need adjusting, but, using data from that other question you link to, the Python code below does create orderings based on historic orderings: