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.
 
 

19 lines
595 B

  1. function [gamma] = gamma_minimized(f, grad_f, x0)
  2. % Calculates the step based on minimizing f(xk​− γ*∇f(xk))
  3. %
  4. %
  5. % f: Objective function
  6. % grad_f: Gradient of objective function
  7. % x0: Initial (x,y) point
  8. % Define the line search function g(gamma) = f(x0 - gamma * grad)
  9. grad = grad_f(x0(1), x0(2));
  10. g = @(gamma) f(x0(1) - gamma * grad(1), x0(2) - gamma * grad(2));
  11. % Perform line search
  12. gamma = fminbnd(g, 0, 1);
  13. % ToDo: Check if we can use fmin_bisection_der
  14. % from the previous assigment here!
  15. end