THMMY's "Optimization Techniques" course assignments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gamma_minimized.m 791 B

3 weken geleden
4 weken geleden
3 weken geleden
4 weken geleden
3 weken geleden
4 weken geleden
3 weken geleden
3 weken geleden
123456789101112131415161718192021222324
  1. function [gamma] = gamma_minimized(f, ~, dk, xk)
  2. % Calculates the step based on minimizing f(xk​− γk*dk)
  3. %
  4. %
  5. % f: Objective function
  6. % ~: Gradient function of f - Not used
  7. % dk: Current value of selected direction -∇f or -inv{H}*∇f or -inv{H + lI}*∇f
  8. % xk: Current point (x,y)
  9. % Define the line search function fmin(g) = f(xk - g * dk)
  10. fmin = @(g) f(xk(1) + g*dk(1), xk(2) + g*dk(2));
  11. % find g that minimizes fmin
  12. e = 0.0001;
  13. l = 0.001;
  14. [a,b,k,~] = fmin_bisection(fmin, 0, 5, e, l);
  15. gamma = 0.5*(a(k) + b(k));
  16. % Define the line search function fmin(g) = f(xk - g * dk)
  17. %fmin = @(g) f(xk(1) - gamma * dk(1), xk(2) - gamma * dk(2));
  18. % find g that minimizes fmin
  19. %gamma = fminbnd(g, 0, 1);
  20. end