Implemented simulated annealing... which does the line-matching quite nicely :-)