What is first order optimality for fsolve?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Steven Rose
el 30 de Abr. de 2020
Respondida: Ameer Hamza
el 1 de Mayo de 2020
Apologies for what is a very basic question, but when running fsolve, it terminates later than I expect because while the function tolerance I have used is satisfied, it seems to want to keep working to get the first-order optimality as small as it can. I'm not really sure what first-order optimality is in the context of solving a non-linear system though - there's no reason to expect the gradient of the function to go to zero at the zero of the function and no reason to care about it in any case. What am I misunderstanding?
2 comentarios
Respuesta aceptada
Ameer Hamza
el 1 de Mayo de 2020
The documentation defines function tolerance as the difference between the function values in two consecutive iterations. So there is no direct way to specify the tolerance for the function value itself. The only way I found is to use the outputFcn property of the optimoptions. The fsolve() runs this function at the end of each iteration, and we can signal fsolve() when to stop its iteration. See the following example. I used an example objective function to illustrate the idea
options = optimoptions('fsolve','OutputFcn',@outFcn,'Display','iter');
finalomega = fsolve(@(x) sum(norm(x-3).*exp(x-2.5)),rand(1,4),options);
function stop = outFcn(x,optimValues,state)
if optimValues.fval < 1e-6
stop = 1;
else
stop = 0;
end
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
