필터 지우기
필터 지우기

How to use fmincon's constraintviolation option

조회 수: 2 (최근 30일)
xone92_
xone92_ 2023년 4월 17일
편집: Torsten 2023년 4월 17일
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?

채택된 답변

Torsten
Torsten 2023년 4월 17일
이동: Matt J 2023년 4월 17일
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
xone92_
xone92_ 2023년 4월 17일
편집: xone92_ 2023년 4월 17일
Hello there,
that's true it has none with this contraints. But actually the solution which gives me ceq=0.0014693 is a good solution for me. I just want to increase the Tolerance in a way that fmincon gives me back a 1 or 2 as exitflag. In fact if i set 'ConstraintTolerance' to 0.1 I get what i want. But fot this reason i don't understand the 'ConstraintTolerance' option, that's why I'm writing here
To clarify my question from above. The ceq constraints has some Tolerance, since its hard to have a solution ceq==0. I though it is adjusted by the 'ConstraintTolerance' option. If I have for example the case as above ceq=0.0014693 i want this still to be a valid tolerance.
Torsten
Torsten 2023년 4월 17일
편집: Torsten 2023년 4월 17일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by