restricting iterations in bfgs