Commit cf2ee58e authored by Reimar Heinrich Leike's avatar Reimar Heinrich Leike

added a few bold optimizations to Yango that might have unpredictable effects

parent b1bdfbe2
......@@ -60,8 +60,11 @@ class Yango(Minimizer):
p = -energy.gradient
A_k = energy.curvature
Ap = A_k(p)
pAp = p.vdot(Ap)
pp = p.vdot(p)
energy, success = self._line_searcher.perform_line_search(
energy, p.vdot(p)/(p.vdot(A_k(p)))*p, f_k_minus_1)
energy, (pp/pAp)*p, f_k_minus_1)
if not success:
return energy, controller.ERROR
A_k = energy.curvature
......@@ -69,7 +72,6 @@ class Yango(Minimizer):
r = -energy.gradient
f_k = energy.value
Ar = A_k(r)
Ap = A_k(p)
rAr = r.vdot(Ar)
pAp = p.vdot(Ap)
pAr = p.vdot(Ar)
......@@ -88,13 +90,16 @@ class Yango(Minimizer):
return energy, controller.ERROR
# Try 1D Newton Step
energy, success = self._line_searcher.perform_line_search(
energy, (rr/rAr)*r, f_k_minus_1)
energy, (rr/rAr)*r, f_k_minus_1)
p = r
Ap = Ar
else:
a = (rAr*rp - rAp*rr)/det
b = (pAp*rr - pAr*rp)/det
energy, success = self._line_searcher.perform_line_search(
energy, p*a + r*b, f_k_minus_1)
p = r - p*(pAr/pAp)
Ap = Ar - Ap*(pAr/pAp)
if not success:
return energy, controller.ERROR
f_k_minus_1 = f_k
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment