Skip to content

Commit

Permalink
lagrang mult compute when red hess
Browse files Browse the repository at this point in the history
  • Loading branch information
MJKnowling committed Feb 4, 2020
1 parent 0b4da97 commit 729a0ab
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pyemu/prototypes/ennlouu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,14 +1020,17 @@ def _kkt_null_space(self,hessian, constraint_grad, constraint_diff, grad, choles
p = np.dot(y, p_y) + np.dot(self.z, self.p_z)

# now to compute lagrangian multipliers
if self.alg == "LBFGS": # we don't have the hessian
# pg. 539 of Nocedal and Wright (2006)
# simplify by dropping dependency of lm on hess (considered appropr given p converges to zero whereas grad does not..
lm = (constraint_grad * constraint_grad.T) * (constraint_grad * grad)
if self.alg is not "LBFGS":
if self.reduced_hessian is False:
# pg. 457 and 538
rhs = np.dot(y.T, (grad.x + (hessian * p).x))
lm = np.linalg.solve(ay.T.x, rhs)
else:
# pg. 539 of Nocedal and Wright (2006)
# simplify by dropping dependency of lm on hess (considered appropr given p converges to zero whereas grad does not..
lm = (constraint_grad * constraint_grad.T) * (constraint_grad * grad)
else:
# pg. 457 and 538
rhs = np.dot(y.T, (grad.x + (hessian * p).x))
lm = np.linalg.solve(ay.T.x, rhs)
self.logger.lraise("not sure if this can be done...")

return p, lm

Expand Down

0 comments on commit 729a0ab

Please sign in to comment.