如何解决迭代槽分配问题(点运动)

发布于 2025-01-17 11:49:40 字数 1110 浏览 5 评论 0原文

我正在启动一个涉及分配问题的项目,并且我自己进行了一些探索,有效解决它对我来说是相当具有挑战性的。

我在这里所说的分配问题如下:

  • 3D 空间中有一组可用槽,随机采样([xspot_0、yspot_0、zspot_0]、[xspot_1、yspot_1、zspot_1] 等)。这些槽位用ID和位置来标识,并且是固定的,因此不会随时间改变。
  • 然后还有可以从一个点移动到另一个点的移动元件(与可用槽位的数量相同,大约为 250,000)。它们通过 ID 进行识别,并在给定的时间步长中识别它们所在的位置。
  • 每个点在给定步骤中必须有一个且仅有一个元素。
  • 首先,元素的排序方式与点的排序方式相同:第一个元素 (element_id=0) 位于第一个点 (spot_id=0),依此类推。
  • 但是,这些元素需要根据运动矢量移动,即为每个点定义,这也是固定的。例如,理想情况下,在第一步中,第一个元素应从 [xspot_0, yspot_0, zspot_0] 移动到 [xspot_0 + dxspot_0, yspot_0 + Dyspot_0, zspot_0 + dzspot_0] 等。
  • 由于点是随机采样的,因此新的目标位置可能点之间不存在。因此,目标是为下一步找到一个尽可能接近元素应处于的“理想”位置的候选位置。
  • 除了第一个挑战之外,由于这可能会通过循环完成,因此最佳候选者可能已分配给另一个元素。
  • 一旦为每个元素定义了所有新槽(或者每个元素被分配给一个新槽,具体取决于您如何看待它),我们会再次执行此操作,以新顺序应用相同的运动。根据需要重复此操作多次。

既然我定义了问题,我尝试的第一件事就是根据这些信息进行简单的分配。但是,如果我每次都根据到目标位置的距离选择最佳候选,正如我所说,某些元素已经采用了最佳候选,因此它们选择第 2 个、第 3 个、...第 20 个、...第 100 个候选位置,与理想位置相比,这变得非常错误。

我正在尝试的另一种技术,在不完全确定我在做什么的情况下,是通过对插槽和目标位置之间的距离进行反指数计算来分配概率分布。然后我对这个分布进行归一化以获得概率(这似乎是任意的)。我一步仍然没有得到很好的结果。

因此,我想知道是否有人知道如何以更准确/更有效的方式解决此类问题。供您参考,我主要使用 Python 3 进行开发。

谢谢你!

I am starting a project which involves an allocation problem, and having explored a bit by myself, it is pretty challenging for me to solve it efficiently.

What I call here allocation problem is the following:

  • There is a set of available slots in 3D space, randomly sampled ([xspot_0, yspot_0, zspot_0], [xspot_1, yspot_1, zspot_1], etc.). These slots are identified with an ID and a position, and are fixed, so they will not change with time.
  • There are then mobile elements (same number as the number of available slots, on the order of 250,000) which can go from spot to spot. They are identified with an ID, and at a given time step, the spot in which they are.
  • Each spot must have one and only one element at a given step.
  • At first, elements are ordered in the same way as spots: the first element (element_id=0) is in the first spot (spot_id=0), etc.
  • But then, these elements need to move, based on a motion vector that is defined for each spot, which is also fixed. For example, ideally at the first step, the first element should move from [xspot_0, yspot_0, zspot_0] to [xspot_0 + dxspot_0, yspot_0 + dyspot_0, zspot_0 + dzspot_0], etc.
  • Since spots were randomly sampled, the new target position might not exist among the spots. The goal is therefore to find a candidate slot for the next step that is as close as possible to the "ideal" position the element should be in.
  • On top of that first challenge, since this will probably be done through a loop, it is possible that the best candidate was already assigned to another element.
  • Once all new slots are defined for each element (or each element is assigned to a new slot, depending on how you see it), we do it again, applying the same motion with the new order. This is repeated as many times as I need.

Now that I defined the problem, the first thing I tried was a simple allocation based on this information. However, if I pick the best candidate every time based on the distance to the target position, as I said some elements have their best candidate already taken, so they pick the 2nd, 3rd, ... 20th, ... 100th candidate slot, which becomes highly wrong compared to the ideal position.

Another technique I was trying, without being entirely sure about what I was doing, was to assign a probability distribution calculated by doing the inverse exponential of the distance between the slots and the target position. Then I normalized this distribution to obtain probabilities (which seem arbitrary). I still do not get very good results for a single step.

Therefore, I was wondering if someone knows how to solve this type of problem in a more accurate/more efficient way. For your information, I mainly use Python 3 for development.

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文