Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. def backtracking1(A,b,x,n):
  2. nu=1
  3. for t in range(0,n):
  4. nu=2*nu
  5. condition = False
  6. while condition==False:
  7. before = x
  8. x = x-nu*gradient(A,b,x)
  9. if np.linalg.norm(x,1)<=1 and funcion(A,b,x) <= funcion(A,b,before)+np.dot(gradient(A,b,before).T,x-before)+(1/nu)*(np.linalg.norm(x-before)**2):
  10. condition = True
  11. else:
  12. nu = nu/2
  13. x = before
  14. return x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement