2 objects envelope good treatment, N objects!
If N! is too much.
This problem is NP-hard problem , I think to save computing time, you may have to get the approximate optimal solution, such as genetic algorithms, simulated annealing, ant colony optimization algorithm,artificial neural networks .
For Artificial Intelligence , I think Lisp will be well-qualified .
I guess Evgeniy Master has write a generic genetic algorithm by Vlisp , why don't you ask he the next
(setq v0 (pt- p0 p1))?
Create a vector P1->P0