简体   繁体   English

通过最少移动数来最小化装满球的桶的最大重量的算法

[英]Algorithms to Minimize Maximum Weight across Buckets filled with Balls by Making Least Number of Moves

I have K number of buckets. 我有K个水桶。 Each bucket contains some number of Balls, B, where each ball has some Weight. 每个桶包含一定数量的球B,其中每个球都有一定的重量。

I am wondering if there are algorithms out there that accomplish the following: 我想知道是否有算法可以完成以下任务:

I would like to make one move at a time, and relocate some Weight from one bucket to another Bucket in a way that minimizes the maximum weight contained across all buckets. 我想一次移动一次,然后将一些重量从一个存储桶转移到另一个存储桶,以使所有存储桶的最大重量最小。 I would like to repeat this process until I have achieved the most balanced configuration of Weights in Buckets by taking the least number of steps. 我想重复此过程,直到通过最少的步骤获得最平衡的重量配置。

Are there algorithms out there that would be useful to look at when solving this problem? 有没有解决该问题的算法?

Here are approaches I thought of: 这是我想到的方法:

  1. Naive: Go through all combinations of balls in buckets, and take the variant that has min(max(weight across all buckets). This is my optimal configuration. Now move one ball at a time until you have achieved this configuration. This would work, but would not be possible to program because we have num_buckets^num_balls complexity which would be inefficient in number of balls were great. 天真:遍历铲斗中所有球的组合,并采用具有min(max(所有铲斗上的重量)的变体。这是我的最佳配置。现在一次移动一个球,直到实现此配置。 ,但无法编程,因为我们有num_buckets ^ num_balls个复杂度,这会导致无效的球数很大。

  2. Greedy Tree: Start from scratch and greedily distribute balls across bins in a round-robin fashion. 贪婪树:从头开始,以循环方式贪婪地将球分布在垃圾箱中。 At each iteration - put the ball into a bin that has the smallest maximum. 在每次迭代中-将球放入最大最小的容器中。 This would not give optimal balance, but it would give a better balance, and then I can take one step a time to achieve this configuration. 这不会带来最佳的平衡,但是会带来更好的平衡,然后我可以一步一步地实现此配置。

This feels like a problem where I have a cost function, and have BxK number of moves at my first step. 这感觉就像是一个问题,其中我具有成本函数,并且在第一步中具有BxK的移动次数。

Are there known algorithms out there that can inspire a better solution? 是否有已知的算法可以激发更好的解决方案? (Bin packing would not work here because I have a fixed number of bins.) I am not looking for a solution, but rather algorithms that solve balancing problems that look similar to this one, even if not exactly the same. (由于我有固定数量的垃圾箱,因此垃圾箱在这里不起作用。)我不是在寻找一种解决方案,而是寻找一种解决平衡问题的算法,即使看起来不完全一样,它也与此相似。

First, let's restrict the greedy algorithm a bit: place the balls in descending order, heaviest first. 首先,让我们对贪婪算法进行一些限制:将球按降序排列(最重)。

After that, work through the bins from heaviest to lightest. 之后,从最重到最轻的垃圾箱进行工作。 For each bin, look for a swap or move that will reduce its weight without making the move's other bin reach the max weight. 对于每个垃圾箱,寻找可以减轻其重量而又不使移动的其他垃圾箱达到最大重量的交换或移动。 Continue this process until the heaviest bin(s) can no longer be improved. 继续此过程,直到无法再改善最重的垃圾箱为止。

I can't prove whether or not this will give you the optimal solution, but it's going to be pretty good. 我无法证明这是否会为您提供最佳解决方案,但这将是非常不错的。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 给定一台可以一次移动无限个球的机器,以最少的动作将球从一组桶移动到另一组桶的算法 - Algorithm to move balls from one set of buckets to another set in least amount of moves given a machine that can move unlimited balls in one move 找到最少的移动次数 - Finding least number of moves 边缘权重最小的路径 - Path with least maximum edge weight 用最少的动作打开一个锁 - Open a lock with the least number of moves 桶中的重量分布,以便使用最少数量的桶 - Weight distribution in bucket such that minimum number of buckets are used 最小化旅行次数或组最大可能订单 - Minimize the number of trips or Group maximum possible orders 有哪些算法可以最小化图中节点之间的事务数量? - What algorithms exist to minimize the number of transactions between nodes in a graph? 预定义数量的节点的最大权重匹配(MWM) - Maximum weight matching (MWM) for a predefined number of nodes 找到具有相同权重的最大边数的生成树 - Find a spanning tree with maximum number of edges with same weight 通过选择边数最少的顶点进行最大匹配的贪心算法? - Greedy algorithm by selecting vertices with least number of edges for maximum matching?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM