简体   繁体   English

Java和VTK中的2D良好路径最小化算法

[英]Good path minimization algorithm 2D in Java and VTK

I would like to find an algorithm for path minimization with some constraints in Java with VTK. 我想找到一种在具有VTK的Java中具有一些约束的路径最小化算法。 As input I am going to give an area for the polygon which is constant, the center of mass of the polygon, and a cost image. 作为输入,我将给出一个恒定的多边形面积,多边形的质心和成本图像。 As output I'd like a list of points which compose a path in 2D that is the minimal path length on the cost image satisfying the two constraints of specific area and center of mass. 作为输出,我想要一个点列表,这些点组成2D路径,这是成本图像上满足特定区域和质心两个约束的最小路径长度。 Does anyone know of a way to do this with Java and VTK? 有谁知道用Java和VTK做到这一点的方法吗? I was looking at building off of vtkDijkstraImageGeodesicPath, but I'm not sure even where to start. 我当时正在考虑从vtkDijkstraImageGeodesicPath构建,但是我不确定从哪里开始。 Honestly, my math in this field is rusty. 老实说,我在这一领域的数学是生锈的。

Thanks 谢谢

As mentioned it sounds like the travelling salesperson problem. 如前所述,这听起来像是旅行商的问题。 One way I have found to get reasonable answers is to start with three nodes (only one possible solution) and then for each subsequent node work out where it is cheapest to insert the node in the existing path. 我发现获得合理答案的一种方法是从三个节点开始(只有一个可能的解决方案),然后为每个后续节点找出将节点插入现有路径中最便宜的位置。 It works in n^2 time and is certainly not going to give you the best solution, but it should give reasonable solutions. 它可以在n ^ 2的时间内工作,并且肯定不会为您提供最佳的解决方案,但是应该提供合理的解决方案。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM