I just want to add something that may occur and may be overlooked while programming...
*** if lines/arcs cross each other - if implementing Evgeniy's method of reassambling path by 2 disconnections and 2 reconnections, please be aware that there are 2 solutions from which only 1 is correct :
vector/arc1 (start1 end1); vector/arc2 (start2 end2)
* you disconnect them both :
* next reconnections :
- 1st : (start1 end2) + (start2 end1)
- 2nd : (start1 start2) + (end1 end2)
*** ONLY 1 of those is correct, as with the other, TSP - single path connections would break into 2 paths that are closed, but they are separated... Correct is only 1 path (single)...
And all in all, my last *.lsp posted was coded in relation to accounting this into postprocessing, but somehow in my testings it didn't actually worked (BricsCAD V21)... And further more with point(s) [ more than 10 ] : CAD(s) have memory issues and routine terminates with error(s) regarding failures not expected for this relatively simple task... Why it can't do on my PC with even 12 pts I can't really understand... With 10 pts - terribly slooow...
Anyway, for reasonable purposes, you can test it on your PC's and perhaps help us all to get better solutions [ TSP - sphere pts aspect ]...