utility function for trying out various optimizers