Effacer les filtres
Effacer les filtres

I need an error message if fmincon converges out of constraints

2 vues (au cours des 30 derniers jours)
Michael Käufl
Michael Käufl le 30 Mar 2020
Hey Guys,
I am using the solver fmincon to find a local minimum of my systems of equations.
My input is some measured data. Some of the data is not good enough, so my script cannot handle it. Therefore i need an error message if the solver fmincon cannot converge within my given constraints. I dont want to change my whole code, I just have no clue about including a error message if the constraints are not fulfilled. :)
Please help me including an error message!
Thanks community! :-)

Réponses (1)

Walter Roberson
Walter Roberson le 30 Mar 2020
Exit flag -2 "No feasible point was found." implies that your constraints are so tight that fmincon could not find even one point that satisfied them.
If fmincon is able to find even one point that satisfies the constraints, then by definition it has located a minima (the best of the points it finds that satisfy constraints.) The only time you would talk about converging would be for
Exit flag 0 "Number of iterations exceeded options.MaxIterations or number of function evaluations exceeded options.MaxFunctionEvaluations."
That exit code is not entirely clear about the possibility that mathematically it still had places it was willing to look for feasible points but had not yet found any, compared to the possibility that it had found at least one feasible point but ran out of iterations before converging. In practice, exit flag 0 is reserved for having found at least one feasible point.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by