I would like to find a better algorithm to solve the following problem:
There are N starting points (purple) and N target points (green) in 2D. I want an algorithm that connects starting points to target points by a line segment (brown) without any of these segments intersecting (red) and while minimizing the cumulative length of all segments.
My first effort in C++ was permuting all possible states, find intersection-free states, and among those the state with minimum total segment length O(n!) . But I think there has to be a better way.
Any idea? Or good keywords for search?