That iteration component is why I agree with @jack regarding choice of algorithm. Open source is hugely important, but trial and error is perhaps even more-so.
is there a bounty out there for someone to build it?