THMMY's "Optimization Techniques" course assignments.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536
  1. % Given environment
  2. clear;
  3. % Setup the function under test
  4. syms x [2 1] real;
  5. fexpr = (1/3)*x(1)^2 +3*x(2)^2;
  6. title_fun = "$f(x) = \frac{1}{3}{x_1}^2 + 3{x_2}^2$";
  7. XSetLimmits = [-10, 5 ; -8, 12];
  8. % Calculate the gradient and Hessian
  9. grad_fexpr = gradient(fexpr, x); % Gradient of f
  10. hessian_fexpr = hessian(fexpr, x); % Hessian of f
  11. % Convert symbolic expressions to MATLAB functions
  12. fun = matlabFunction(fexpr, 'Vars', {x}); % Function
  13. grad_fun = matlabFunction(grad_fexpr, 'Vars', {x}); % Gradient
  14. hessian_fun = matlabFunction(hessian_fexpr, 'Vars', {x}); % Hessian
  15. % Minimum reference
  16. [Xmin, Fmin] = fminsearch(fun, [-1, -1]');
  17. Xmin = round(Xmin, 3);
  18. Fmin = round(Fmin, 3);
  19. % Amijo globals
  20. global amijo_beta; % Step reduction factor in [0.1, 0.5] (typical range: [0.1, 0.8])
  21. global amijo_sigma; % Sufficient decrease constant in [1e-5, 0.1] (typical range: [0.01, 0.3])
  22. %fixed step size globals
  23. global gamma_fixed_step
  24. global image_width,
  25. global image_height;
  26. image_width = 960;
  27. image_height = 640;