Extensive debugging appears to have significantly improved the functioning of the optimization algorithms - I think they might actually all work now!