SCG: printing corrected, dont return before end of method

This commit is contained in:
Max Zwiessele 2013-05-31 12:01:29 +01:00
parent df1e765507
commit 43c2f8af87

View file

@ -105,7 +105,8 @@ def SCG(f, gradf, x, optargs=(), maxiters=500, max_f_eval=500, display=True, xto
if function_eval >= max_f_eval: if function_eval >= max_f_eval:
status = "Maximum number of function evaluations exceeded" status = "Maximum number of function evaluations exceeded"
return x, flog, function_eval, status break
# return x, flog, function_eval, status
Delta = 2.*(fnew - fold) / (alpha * mu) Delta = 2.*(fnew - fold) / (alpha * mu)
if Delta >= 0.: if Delta >= 0.:
@ -127,7 +128,8 @@ def SCG(f, gradf, x, optargs=(), maxiters=500, max_f_eval=500, display=True, xto
# Test for termination # Test for termination
if (np.max(np.abs(alpha * d)) < xtol) or (np.abs(fnew - fold) < ftol): if (np.max(np.abs(alpha * d)) < xtol) or (np.abs(fnew - fold) < ftol):
status = 'converged' status = 'converged'
return x, flog, function_eval, status break
# return x, flog, function_eval, status
else: else:
# Update variables for new position # Update variables for new position