I would like to find the best algorithm to solve the following problem:
In 2D, there are N starting points (purple) and N target points (green). I want an algorithm that connects the source points to the target points with a segment (brown), without any of these segments intersecting (red) and minimizing the cumulative length of all segments.
My first attempt in C ++ was to rearrange all possible states, search for states that are free from intersections, and among those that have a minimum total segment length of O (n!). But I think there should be a better way.

Any idea? Or good search keywords?
c ++ performance algorithm geometry
deepmax Mar 25 2018-12-12T00: 00Z
source share