종종 후자의 조건이 사용되며 대부분의 비선형 최적화 프로그램의 일부입니다 (특히 KKT 조건 또는 2 차 정보를 사용할 수없는 경우). 그것은 또한 이론을 직접적으로 따릅니다 :로컬 최적 점에 대한 1 차 필요한 최적 조건.
당신은 소스를 볼 수 있습니다 :
here: tol becomes gtol :
if meth in ('bfgs', 'cg', 'l-bfgs-b', 'tnc', 'dogleg',
'trust-ncg', 'trust-exact', 'trust-krylov'):
options.setdefault('gtol', tol)
here: _minimize_trust_krylov is called :
elif meth == 'trust-krylov':
return _minimize_trust_krylov(fun, x0, args, jac, hess, hessp,
callback=callback, **options)
_trustregion_krylov talks about the oder conditions 및 exact
/inexact
에 따라 최종 최적화 프로그램이 호출됩니다
if inexact:
return _minimize_trust_region(fun, x0, args=args, jac=jac,
hess=hess, hessp=hessp,
subproblem=get_trlib_quadratic_subproblem(
tol_rel_i=-2.0, tol_rel_b=-3.0,
disp=trust_region_options.get('disp', False)
),
**trust_region_options)
else:
return _minimize_trust_region(fun, x0, args=args, jac=jac,
hess=hess, hessp=hessp,
subproblem=get_trlib_quadratic_subproblem(
tol_rel_i=1e-8, tol_rel_b=1e-6,
disp=trust_region_options.get('disp', False)
),
**trust_region_options)
the optimizer used 함유 다음 행 :
gtol : float
Gradient norm must be less than `gtol`
before successful termination.
# check if the gradient is small enough to stop
if m.jac_mag < gtol:
warnflag = 0
break
# check if we have looked at enough iterations
if k >= maxiter:
warnflag = 1
break
here jac_mag is found는 :
은이 대답의 시작과 유클리드 놈 다음 @property
def jac_mag(self):
"""Magniture of jacobian of objective function at current iteration."""
if self._g_mag is None:
self._g_mag = scipy.linalg.norm(self.jac)
return self._g_mag
(p = 2가) 사용된다!