How to use fmincon's constraintviolation option
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello there,
I'm trying to use fmincon for an optimization problem.
I use Nonlinear constraints and my function returns a ceq value. This however is not "0" it is 0.0014693, hence fmincon will give me an exitflag of -2 (no feasible point was found). I then try to use the 'ConstraintTolerance' option (which by default is 1e-6) and put it to 0.01. However, still no feasible solution could be found (now the ceq value is 0.0012396).
Can you tell me what I'm doing wrong?
0 commentaires
Réponse acceptée
Torsten
le 17 Avr 2023
Déplacé(e) : Matt J
le 17 Avr 2023
Can you tell me what I'm doing wrong?
You try to betray yourself that your problem has a solution. But it has none.
2 commentaires
Torsten
le 17 Avr 2023
Modifié(e) : Torsten
le 17 Avr 2023
ConstraintTolerance is defined as:
ConstraintTolerance is an upper bound on the magnitude of any constraint functions. If a solver returns a point x with c(x) > ConstraintTolerance or |ceq(x)| > ConstraintTolerance, the solver reports that the constraints are violated at x. ConstraintTolerance can also be a relative bound. See Tolerance Details.
We cannot tell you more than this.
To diagnose why you get an exitflag of -2 although you set the constraint tolerance to 0.01 and the real error in the constraint is only 0.0012396 - we are not able to without your code. Maybe another constraint is now violated. Or the solver takes the relative error instead of the absolute error.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display 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!