How to code adaptive Wolfe Powell Code....?
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function [alpha, k] = calc_alpha(fun,fun_grad, xk, dk, rho, sigma)
Alpha=[];
alpha_low = 0;
alpha_high = 10;
alpha = 1;
k = 0;
stop = 0;
while stop == 0
k=k+ 1;
if fun(xk + alpha * dk) <= fun(xk) + rho * alpha *fun_grad(xk)'* dk && (fun_grad(xk + alpha * dk))'* dk >= (sigma*fun_grad(xk))'* dk
stop = 1;
else
if fun(xk + alpha * dk) > fun(xk) + rho * alpha *abs(fun_grad(xk))'* dk
alpha_high = alpha;
alpha = (alpha_high+alpha_low) / 2;
elseif (fun_grad(xk + alpha * dk))'* dk < (sigma*fun_grad(xk))'* dk
alpha_low = alpha;
if alpha_high > 10
alpha = 2 * alpha_low;
else
alpha = (alpha_high + alpha_low) / 2;
end
end
end
Alpha =[Alpha, alpha];
end
1 commentaire
Réponses (0)
Voir également
Catégories
En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!