开发者

A traveling salesman like problem

Given a set of points in the 2D Euclidean plane: P={V1,V2,..,Vn}, and we assume that there are K different types of points:T1,T2,..,TK, every point Vi in P belongs to exactly one of the K types.

Definition of KTSP tour:

Given an arbitrary location point V0 in the same 2D Euclidean plane (V0 has no type), a path V0->V'1->V'2->V'3->....->V'K->V0 is called a KTSP tour iff V'i belongs to type i.

A KTSP tour is just an ordinary tour starting and ending in the same given arbitrary point but subject to two more constraints: (1)It passes every type of point one and only once. (2)The type of point the path passes has order. That is, it first starts from point V0, then first passes type T1 point, then type T2 point, then type T3 point, and so on until it passes type TK point, after which it comes back at V0.

Here is my question:

when the point location V0 is given find the shortest KTSP tour.

For example, in the following figure, every color represents one type of point, 开发者_如何学Cthere are 3 different types of points, we assume blue colored points are type 1, red type 2, black type 3,

and the little triangle with yellow is the given location V0, then the shortest TSKP tour corresponding to this particular V0 is shown with the four blue arrows.

It seems to me this a variant of the classical TSP problem, but i can't think of an algorithm, need help!

A traveling salesman like problem


It's not tsp, but shortest path.

Consider k layers of points :

  • on layer k you only have all points of color k
  • you have a directed edge between every point of a layer and every points of the next layer
  • add an edge between V0 and all points of layer 1
  • create a copy of V0, V0' and add an edge between every point of layer k and V0'

Now what you want is the shortest path between V0 and V0', it will pass at layer 1, 2...k and finally V0', given you your "shortest TSKP tour".


I would recommend backtracking (if the number of points isn't to large).

It's the easiest algorithm out there

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜