title: Non-intersecting line segments while minimizing the cumulative length
body: <p>I would like to find a better algorithm to solve the following problem:</p>
  
  <p>There are <em>N</em> starting points (purple) and <em>N</em> 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.</p>
  
  <p>My first effort in C++ was permuting all possible states, find intersection-free states, and among those the state with minimum total segment length  <em>O(n!)</em> . But I think there has to be a better way.</p>
  
  <p><img src="https://i.stack.imgur.com/h17NF.png" alt="enter image description here"></p>
  
  <p>Any idea? Or good keywords for search?</p>