What are you looking for is constraint solver. Unfortunately it seems from your description that linear constraints are not enough (distance is quadratic) and most open source solvers are linear. see http://www.gecode.org/ and http://www.plm.automation.siemens.com/en_us/products/open/d-cubed/ HTH Niki Spahiev