THMMY's "Optimization Techniques" course assignments.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
791 B

  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) + g * dk;
  11. % find g that minimizes fmin
  12. e = 0.0001;
  13. l = 0.001;
  14. [a,b,k,~] = fmin_bisection(fmin, 0.0001, 1, e, l); % g in (0, 1]
  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