1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| % Runs various limited-memory solvers on 2D rosenbrock function for 25
% function evaluations
fprintf('---------------------------------------\n');
fprintf('x1 = %.4f, x2 = %.4f (starting point)\n',4,1.5);
fprintf('x1 = %.4f, x2 = %.4f (optimal solution)\n',0,0);
fprintf('---------------------------------------\n');
options = [];
options.display = 'full';
options.progTol = 0.01;
% Steepest Descent
options.Method = 'sd';
options.LS_interp = 0;
x = minFunc(@f_2V,[4 1.5]',options);
fprintf('x1 = %.4f, x2 = %.4f (minFunc with steepest descent)\n',x(1),x(2));
fprintf('---------------------------------------\n'); |
Partager