var myPoints = [[25,28],[26,26],[70,40],[50,50],[300,300],[285,350],[1000,1000]];
假设我需要将阵列缩小到4分. (这是一个小例子,我的实际阵列有几千个点)我怎样才能根据密度对阵列进行细化,以便从点距离较近的区域中移除更多的点,从较低密度的区域移除较少的点?
在这种情况下(将上面的数组从8项减少到4项)我希望返回的数组看起来如下所示:
var thinnedPoints = [[25,1000]];
关于如何处理这个问题的想法是生成一个字典,将点映射到它与另一个点的最小距离(例如,靠近另一个点的点将具有较小的最小距离)然后根据递增的最小距离对字典进行排序,然后删除字典中的每个n’tn项.
这种方法的问题是我不知道如何有效地为每个点生成距离最近的其他点值的距离.
有没有一种有效的方法来生成这些值,或者是否有另一种方法来处理这种基于密度的细化问题?
谢谢!
解决方法
从Approximability Results for the p
-Center Problem by Stefan Buettcher,
The
p
-Center problem,also kNown as the Min-Max Multicenter problem
or the Facility Location problem,is a famous problem from operations
research. Informally,it is the problem of placing fire stations in a
city so that the maximum time to reach any point in the city is
minimized.
从J. Reese开始于Methods for Solving the p
-Median Problem: An Annotated Bibliography
The
p
-median problem is simply stated as: Given a graph or a network
G = (V,E)
,findVp ⊆ V
such that|Vp| = p
,wherep
may either
be variable or fixed […],and that the sum of the shortest distances
from the vertices in{V\Vp}
to their nearest vertex inVp
is
minimized.
原文地址:https://www.jb51.cc/js/157919.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。